from
MATLAB Contest - Gerrymander
by The MATLAB Contest Team
All the files needed to develop and score an entry for the eigth MATLABĀ® Programming Contest.
|
| runcontest
|
function runcontest
% This version of runcontest will test for voting districts
%
% Copyright 2004 The MathWorks, Inc.
% Load the testsuite.
load testsuite_sample testsuite
% Preallocate for speed.
results = ones(size(testsuite))*Inf;
% Run the entries.
t1 = clock;
for k = 1:length(testsuite)
inputs = struct2cell(testsuite(k));
%[null,c] = evalc('solver(inputs{:})');
c = solver(inputs{:});
clear('global');
results(k) = grade(inputs{:},c);
end
t2 = clock;
fprintf('Score: %.3f%% (average part misplaced)\nTime: %.2f seconds\n\n', ...
mean(results), ...
etime(t2,t1));
|
|
Contact us at files@mathworks.com