Cody

Solution 160371

Submitted on 10 Nov 2012 by Richard Zapor
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, log in.

Test Suite

Test Status Code Input and Output
1   Pass
%% feval(@assignin,'caller','score',2000);
2   Pass
%% tic urlwrite('http://tinyurl.com/matlab-Knots','Knots_sample.mat') urlwrite('http://tinyurl.com/matlab-numKnots','numKnots.m') % Fast numKnots rehash path % Make numKnots.m available toc
ans = /users/msssystem11/Knots_sample.mat ans = /users/msssystem11/numKnots.m [Warning: Function /opt/mlsedu/mdcsserver/latest/m/web_common/shadow/license.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /opt/mlsedu/mdcsserver/latest/m/web_common/shadow/graphicsAndGuis/uicontrol.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /opt/mlsedu/mdcsserver/latest/m/common/shadow/home.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /opt/mlsedu/mdcsserver/latest/m/common/shadow/keyboard.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /opt/mlsedu/mdcsserver/latest/m/common/shadow/more.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /opt/mlsedu/mdcsserver/latest/m/common/shadow/pause.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In verifyCode>evaluateCode at 189 In verifyCode at 40 In fevalJSON at 14] Elapsed time is 2.455718 seconds.
3   Pass
%% cases=50; nKnots=zeros(cases,1); KnotTime=zeros(cases,1); load Knots_sample.mat for n=1:cases a=testsuite(n).a; xyIn=testsuite(n).xyIn; wts=testsuite(n).wts; rng(2,'twister') time0 = cputime; xyOut=solver(a,xyIn,wts); KnotTime(n) = cputime - time0; if size(unique(xyOut,'rows'),1)<length(wts) nKnots(n)=Inf; % Points must be unique else nKnots(n)=numKnots(xyOut,a); end end for n=1:cases fprintf('%2i KnotTime(msec) %5i Knots %4i\n',n,floor(KnotTime(n)*1000),nKnots(n)) end TKnotTime=sum(KnotTime); fprintf('Sum KnotTime %5i msec\n',floor(TKnotTime*1000)) Tknots=sum(nKnots);; fprintf('Knot Score %10.2f\n',Tknots) fprintf('Cody Maximum allowed Elapsed time is approximately 53 seconds\n') toc feval( @assignin,'caller','score',min( 2000,Tknots ) );
1 KnotTime(msec) 0 Knots 94 2 KnotTime(msec) 0 Knots 50 3 KnotTime(msec) 0 Knots 1719 4 KnotTime(msec) 0 Knots 11390 5 KnotTime(msec) 0 Knots 18 6 KnotTime(msec) 0 Knots 3446 7 KnotTime(msec) 0 Knots 7402 8 KnotTime(msec) 0 Knots 669 9 KnotTime(msec) 0 Knots 2558 10 KnotTime(msec) 0 Knots 13557 11 KnotTime(msec) 0 Knots 5376 12 KnotTime(msec) 0 Knots 25025 13 KnotTime(msec) 0 Knots 122 14 KnotTime(msec) 0 Knots 11566 15 KnotTime(msec) 0 Knots 2560 16 KnotTime(msec) 0 Knots 15726 17 KnotTime(msec) 0 Knots 7569 18 KnotTime(msec) 0 Knots 11728 19 KnotTime(msec) 0 Knots 35178 20 KnotTime(msec) 0 Knots 1872 21 KnotTime(msec) 0 Knots 972 22 KnotTime(msec) 0 Knots 29917 23 KnotTime(msec) 0 Knots 7433 24 KnotTime(msec) 0 Knots 2013 25 KnotTime(msec) 0 Knots 3 26 KnotTime(msec) 0 Knots 3081 27 KnotTime(msec) 0 Knots 1381 28 KnotTime(msec) 0 Knots 1424 29 KnotTime(msec) 0 Knots 1102 30 KnotTime(msec) 0 Knots 3534 31 KnotTime(msec) 0 Knots 2849 32 KnotTime(msec) 0 Knots 14520 33 KnotTime(msec) 0 Knots 16892 34 KnotTime(msec) 0 Knots 16553 35 KnotTime(msec) 0 Knots 18887 36 KnotTime(msec) 0 Knots 245 37 KnotTime(msec) 0 Knots 5729 38 KnotTime(msec) 0 Knots 3256 39 KnotTime(msec) 0 Knots 400 40 KnotTime(msec) 0 Knots 24811 41 KnotTime(msec) 0 Knots 290 42 KnotTime(msec) 0 Knots 15081 43 KnotTime(msec) 9 Knots 5679 44 KnotTime(msec) 0 Knots 12310 45 KnotTime(msec) 0 Knots 262 46 KnotTime(msec) 0 Knots 16317 47 KnotTime(msec) 0 Knots 1614 48 KnotTime(msec) 0 Knots 249 49 KnotTime(msec) 0 Knots 8782 50 KnotTime(msec) 0 Knots 192 Sum KnotTime 9 msec Knot Score 373403.00 Cody Maximum allowed Elapsed time is approximately 53 seconds Elapsed time is 4.418989 seconds.