{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":1173,"title":"Binpack Contest: Retro  - - Best Packing","description":"The \u003chttp://www.mathworks.com/matlabcentral/contest/contests/3/rules Full Binpack Rules and examples\u003e.\r\n\r\nThis Challenge is a partial replay of the First Matlab Contest, 1998 BinPack. The Twist is to Achieve the Best Packing, no time or code size penalty. The twelve songList sets will be scored once each.\r\n\r\nBrief Challenge statement: Pack a 45(mediaLength) minute CD as maximally as possible given a list of songs of varying lengths. No penalty for unused songs. No song duplication allowed. Return the indices of the songs used.\r\n\r\n*Input:* [songList, mediaLength]\r\n\r\n*Output:* indexList\r\n\r\n*Example:*\r\n\r\nInput:  [ 0.5 2 3 1.5 4], [5.6]\r\n\r\nOutput: [4 5]  as 1.5+4 is very near and below 5.6.\r\n\r\nThe answer of [1 2 3] is also valid and also gives 5.5.\r\n\r\n*Scoring:* 1000*(Known_Best_Possibles - sum(songList(indexList))\r\n\r\n*Initial Leader:*  Cases [2 3 4 6 8 11] have best possible scores of [44.9990 44.9971 44.8 44.6 44.584024853.. 44.25]\r\n\r\n\r\nFinal Score of 1 achieved in \u003c 6 Cody seconds for entry 10.\r\n\r\nFinal Score of 0, optimal, achieved using recursive searches with iter limits and thresholds.\r\n\r\n","description_html":"\u003cp\u003eThe \u003ca href=\"http://www.mathworks.com/matlabcentral/contest/contests/3/rules\"\u003eFull Binpack Rules and examples\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eThis Challenge is a partial replay of the First Matlab Contest, 1998 BinPack. The Twist is to Achieve the Best Packing, no time or code size penalty. The twelve songList sets will be scored once each.\u003c/p\u003e\u003cp\u003eBrief Challenge statement: Pack a 45(mediaLength) minute CD as maximally as possible given a list of songs of varying lengths. No penalty for unused songs. No song duplication allowed. Return the indices of the songs used.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [songList, mediaLength]\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e indexList\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eInput:  [ 0.5 2 3 1.5 4], [5.6]\u003c/p\u003e\u003cp\u003eOutput: [4 5]  as 1.5+4 is very near and below 5.6.\u003c/p\u003e\u003cp\u003eThe answer of [1 2 3] is also valid and also gives 5.5.\u003c/p\u003e\u003cp\u003e\u003cb\u003eScoring:\u003c/b\u003e 1000*(Known_Best_Possibles - sum(songList(indexList))\u003c/p\u003e\u003cp\u003e\u003cb\u003eInitial Leader:\u003c/b\u003e  Cases [2 3 4 6 8 11] have best possible scores of [44.9990 44.9971 44.8 44.6 44.584024853.. 44.25]\u003c/p\u003e\u003cp\u003eFinal Score of 1 achieved in \u0026lt; 6 Cody seconds for entry 10.\u003c/p\u003e\u003cp\u003eFinal Score of 0, optimal, achieved using recursive searches with iter limits and thresholds.\u003c/p\u003e","function_template":"function indexList = binpack_scr(songList,mediaLength)\r\n  indexList=[1 2];\r\nend","test_suite":"%%\r\nfeval(@assignin,'caller','score',200);\r\n%%\r\nmediaLength=45;\r\nrng(0)\r\nsongList=floor(10000*rand(1,100))/10000;\r\nindexList = binpack_scr(songList,mediaLength) ;\r\nsum(songList(indexList))\r\n%[songList(indexList)' indexList']\r\nassert(sum(songList(indexList))\u003e44.8) % anti hardcode\r\n%%\r\na{1} = [4.3078    2.5481    1.4903    5.4302    3.4142    2.9736    3.3768 ...\r\n        2.1612    3.3024    0.3269    2.6761    4.2530    2.6648    1.9644 ...\r\n        3.3389    22.122    4.1015    3.2104    2.3945    4.7151];\r\na{2} = [1.2671    3.1377    4.0687    4.1459    3.6469    6.1881    8.2452 ...\r\n        7.3962    9.7071   10.4798   11.4082   12.2282   12.6320   13.9705 ...\r\n        13.8851   15.6195   17.0187   18.5778   18.4140   20.0473];\r\na{3} = [1.6283    6.0703    8.1323    2.6226    3.1230    3.0081    6.1405 ...\r\n        1.1896    4.2769    5.0951    6.4869    3.9215    2.5858    4.7130 ...\r\n        4.5529];\r\na{4} = [40:-1:1]+.1;\r\na{5} = [1.0979    3.5540    1.8627    0.0849    3.2110    3.6466    4.8065 ...\r\n        3.2717    0.1336    2.5008    0.4508    3.0700    3.1658    0.8683 ...\r\n        3.5533    3.7528    2.7802    4.2016    1.6372    9.6254    1.3264 ...\r\n        0.3160    4.3212    3.0192    0.7744    2.3970    1.7416    2.4751 ...\r\n        1.0470    1.9091];\r\na{6} = [1 1 2 3 5 8 13 21 34]+.1;\r\na{7} = [0.8651    3.3312    0.2507    0.5754    2.2929    2.3818    2.3783 ...\r\n        0.0753    0.6546    0.3493    0.3734    1.4516    1.1766    4.3664 ...\r\n        0.2728    20.279    2.1335    0.1186    0.1913    1.6647    0.5888 ...\r\n        2.6724    1.4286    3.2471    1.3836    1.7160    2.5080    3.1875 ...\r\n        2.8819    1.1423    0.7998    1.3800    1.6312    1.4238    2.5805 ...\r\n        1.3372    2.3817    2.4049    0.0396    0.3134];\r\na{8} = [pi*ones(1,10) exp(1)*ones(1,10)];\r\na{9} = [1.6041    0.2573    1.0565    1.4151    0.8051    0.5287    0.2193 ...\r\n        0.9219    2.1707    0.0592    1.0106    0.6145    0.5077    1.6924 ...\r\n        0.5913    0.6436    0.3803    1.0091    0.0195    0.0482    20.000 ...\r\n        0.3179    1.0950    1.8740    0.4282    0.8956    0.7310    0.5779 ...\r\n        0.0403    0.6771    0.5689    0.2556    0.3775    0.2959    1.4751 ...\r\n        0.2340    8.1184    0.3148    1.4435    0.3510    0.6232    0.7990 ...\r\n        0.9409    0.9921    0.2120    0.2379    1.0078    0.7420    1.0823 ...\r\n        0.1315];\r\na{10}= [1.6041    0.2573    1.0565    1.4151    0.8051    0.5287    0.2193 ...\r\n        0.9219    2.1707    0.0592    1.0106    0.6145    0.5077    1.6924 ...\r\n        0.5913    0.6436    0.3803    10.091    0.0195    0.0482    20.000 ...\r\n        0.3179    1.0950    1.8740    44.999    0.8956    0.7310    0.5779 ...\r\n        0.0403    0.6771    0.5689    0.2556    0.3775    0.2959    1.4751 ...\r\n        0.2340    0.1184    0.3148    1.4435    0.3510    0.6232    0.7990 ...\r\n        0.9409    0.9921    0.2120    0.2379    1.0078    0.7420    1.0823 ...\r\n        0.1315];\r\na{11}= [40*ones(1,50) ones(1,20)]+0.05;\r\na{12}= 4.3 + sin(1:100);\r\n\r\nmediaLength=45;\r\n\r\nnet_gap=0;\r\nt0=clock;\r\nfor j=1:1\r\nfor i=1:12\r\n   songList=a{i};\r\n   indexList = binpack_scr(songList,mediaLength) ;\r\n   indexList=unique(indexList); % No dupes\r\n   total(i)=sum(songList(indexList));\r\n   if total(i)\u003e45+1.5*eps(mediaLength) % Rqmt \u003c= 45\r\n    total(i)=-Inf;\r\n   end\r\n   net_gap=net_gap+45-total(i) ;\r\nend\r\nend\r\ntte=etime(clock,t0);\r\nfprintf('Total Time E %f\\n',tte)\r\nfprintf('Totals: ');fprintf('%.5f  ',total);fprintf('\\n')\r\nfprintf('Net Gap: %.2f\\n',net_gap)\r\n%format long\r\nfprintf('Performance: %.4f\\n',net_gap/(12*45))\r\nfprintf('Score=1000*(12*45-1.76987514-sum(total): %.3f\\n',1000*(12*45-1.76987514-sum(total)))\r\nfprintf('Final Score %i\\n',round(1000*(12*45-1.76987514-sum(total))))\r\n\r\nScore=round(1000*(12*45-1.76987514-sum(total)));\r\n\r\nassert(Score\u003e=0)\r\n\r\n\r\nfeval( @assignin,'caller','score',floor(min( 200,Score )) );\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":"2013-01-06T00:41:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-01-04T16:28:33.000Z","updated_at":"2013-01-06T00:52:17.000Z","published_at":"2013-01-04T18:16:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/contest/contests/3/rules\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eFull Binpack Rules and examples\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is a partial replay of the First Matlab Contest, 1998 BinPack. The Twist is to Achieve the Best Packing, no time or code size penalty. The twelve songList sets will be scored once each.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBrief Challenge statement: Pack a 45(mediaLength) minute CD as maximally as possible given a list of songs of varying lengths. No penalty for unused songs. No song duplication allowed. Return the indices of the songs used.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [songList, mediaLength]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e indexList\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput: [ 0.5 2 3 1.5 4], [5.6]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput: [4 5] as 1.5+4 is very near and below 5.6.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe answer of [1 2 3] is also valid and also gives 5.5.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eScoring:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 1000*(Known_Best_Possibles - sum(songList(indexList))\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInitial Leader:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cases [2 3 4 6 8 11] have best possible scores of [44.9990 44.9971 44.8 44.6 44.584024853.. 44.25]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFinal Score of 1 achieved in \u0026lt; 6 Cody seconds for entry 10.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFinal Score of 0, optimal, achieved using recursive searches with iter limits and thresholds.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":1173,"title":"Binpack Contest: Retro  - - Best Packing","description":"The \u003chttp://www.mathworks.com/matlabcentral/contest/contests/3/rules Full Binpack Rules and examples\u003e.\r\n\r\nThis Challenge is a partial replay of the First Matlab Contest, 1998 BinPack. The Twist is to Achieve the Best Packing, no time or code size penalty. The twelve songList sets will be scored once each.\r\n\r\nBrief Challenge statement: Pack a 45(mediaLength) minute CD as maximally as possible given a list of songs of varying lengths. No penalty for unused songs. No song duplication allowed. Return the indices of the songs used.\r\n\r\n*Input:* [songList, mediaLength]\r\n\r\n*Output:* indexList\r\n\r\n*Example:*\r\n\r\nInput:  [ 0.5 2 3 1.5 4], [5.6]\r\n\r\nOutput: [4 5]  as 1.5+4 is very near and below 5.6.\r\n\r\nThe answer of [1 2 3] is also valid and also gives 5.5.\r\n\r\n*Scoring:* 1000*(Known_Best_Possibles - sum(songList(indexList))\r\n\r\n*Initial Leader:*  Cases [2 3 4 6 8 11] have best possible scores of [44.9990 44.9971 44.8 44.6 44.584024853.. 44.25]\r\n\r\n\r\nFinal Score of 1 achieved in \u003c 6 Cody seconds for entry 10.\r\n\r\nFinal Score of 0, optimal, achieved using recursive searches with iter limits and thresholds.\r\n\r\n","description_html":"\u003cp\u003eThe \u003ca href=\"http://www.mathworks.com/matlabcentral/contest/contests/3/rules\"\u003eFull Binpack Rules and examples\u003c/a\u003e.\u003c/p\u003e\u003cp\u003eThis Challenge is a partial replay of the First Matlab Contest, 1998 BinPack. The Twist is to Achieve the Best Packing, no time or code size penalty. The twelve songList sets will be scored once each.\u003c/p\u003e\u003cp\u003eBrief Challenge statement: Pack a 45(mediaLength) minute CD as maximally as possible given a list of songs of varying lengths. No penalty for unused songs. No song duplication allowed. Return the indices of the songs used.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e [songList, mediaLength]\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e indexList\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eInput:  [ 0.5 2 3 1.5 4], [5.6]\u003c/p\u003e\u003cp\u003eOutput: [4 5]  as 1.5+4 is very near and below 5.6.\u003c/p\u003e\u003cp\u003eThe answer of [1 2 3] is also valid and also gives 5.5.\u003c/p\u003e\u003cp\u003e\u003cb\u003eScoring:\u003c/b\u003e 1000*(Known_Best_Possibles - sum(songList(indexList))\u003c/p\u003e\u003cp\u003e\u003cb\u003eInitial Leader:\u003c/b\u003e  Cases [2 3 4 6 8 11] have best possible scores of [44.9990 44.9971 44.8 44.6 44.584024853.. 44.25]\u003c/p\u003e\u003cp\u003eFinal Score of 1 achieved in \u0026lt; 6 Cody seconds for entry 10.\u003c/p\u003e\u003cp\u003eFinal Score of 0, optimal, achieved using recursive searches with iter limits and thresholds.\u003c/p\u003e","function_template":"function indexList = binpack_scr(songList,mediaLength)\r\n  indexList=[1 2];\r\nend","test_suite":"%%\r\nfeval(@assignin,'caller','score',200);\r\n%%\r\nmediaLength=45;\r\nrng(0)\r\nsongList=floor(10000*rand(1,100))/10000;\r\nindexList = binpack_scr(songList,mediaLength) ;\r\nsum(songList(indexList))\r\n%[songList(indexList)' indexList']\r\nassert(sum(songList(indexList))\u003e44.8) % anti hardcode\r\n%%\r\na{1} = [4.3078    2.5481    1.4903    5.4302    3.4142    2.9736    3.3768 ...\r\n        2.1612    3.3024    0.3269    2.6761    4.2530    2.6648    1.9644 ...\r\n        3.3389    22.122    4.1015    3.2104    2.3945    4.7151];\r\na{2} = [1.2671    3.1377    4.0687    4.1459    3.6469    6.1881    8.2452 ...\r\n        7.3962    9.7071   10.4798   11.4082   12.2282   12.6320   13.9705 ...\r\n        13.8851   15.6195   17.0187   18.5778   18.4140   20.0473];\r\na{3} = [1.6283    6.0703    8.1323    2.6226    3.1230    3.0081    6.1405 ...\r\n        1.1896    4.2769    5.0951    6.4869    3.9215    2.5858    4.7130 ...\r\n        4.5529];\r\na{4} = [40:-1:1]+.1;\r\na{5} = [1.0979    3.5540    1.8627    0.0849    3.2110    3.6466    4.8065 ...\r\n        3.2717    0.1336    2.5008    0.4508    3.0700    3.1658    0.8683 ...\r\n        3.5533    3.7528    2.7802    4.2016    1.6372    9.6254    1.3264 ...\r\n        0.3160    4.3212    3.0192    0.7744    2.3970    1.7416    2.4751 ...\r\n        1.0470    1.9091];\r\na{6} = [1 1 2 3 5 8 13 21 34]+.1;\r\na{7} = [0.8651    3.3312    0.2507    0.5754    2.2929    2.3818    2.3783 ...\r\n        0.0753    0.6546    0.3493    0.3734    1.4516    1.1766    4.3664 ...\r\n        0.2728    20.279    2.1335    0.1186    0.1913    1.6647    0.5888 ...\r\n        2.6724    1.4286    3.2471    1.3836    1.7160    2.5080    3.1875 ...\r\n        2.8819    1.1423    0.7998    1.3800    1.6312    1.4238    2.5805 ...\r\n        1.3372    2.3817    2.4049    0.0396    0.3134];\r\na{8} = [pi*ones(1,10) exp(1)*ones(1,10)];\r\na{9} = [1.6041    0.2573    1.0565    1.4151    0.8051    0.5287    0.2193 ...\r\n        0.9219    2.1707    0.0592    1.0106    0.6145    0.5077    1.6924 ...\r\n        0.5913    0.6436    0.3803    1.0091    0.0195    0.0482    20.000 ...\r\n        0.3179    1.0950    1.8740    0.4282    0.8956    0.7310    0.5779 ...\r\n        0.0403    0.6771    0.5689    0.2556    0.3775    0.2959    1.4751 ...\r\n        0.2340    8.1184    0.3148    1.4435    0.3510    0.6232    0.7990 ...\r\n        0.9409    0.9921    0.2120    0.2379    1.0078    0.7420    1.0823 ...\r\n        0.1315];\r\na{10}= [1.6041    0.2573    1.0565    1.4151    0.8051    0.5287    0.2193 ...\r\n        0.9219    2.1707    0.0592    1.0106    0.6145    0.5077    1.6924 ...\r\n        0.5913    0.6436    0.3803    10.091    0.0195    0.0482    20.000 ...\r\n        0.3179    1.0950    1.8740    44.999    0.8956    0.7310    0.5779 ...\r\n        0.0403    0.6771    0.5689    0.2556    0.3775    0.2959    1.4751 ...\r\n        0.2340    0.1184    0.3148    1.4435    0.3510    0.6232    0.7990 ...\r\n        0.9409    0.9921    0.2120    0.2379    1.0078    0.7420    1.0823 ...\r\n        0.1315];\r\na{11}= [40*ones(1,50) ones(1,20)]+0.05;\r\na{12}= 4.3 + sin(1:100);\r\n\r\nmediaLength=45;\r\n\r\nnet_gap=0;\r\nt0=clock;\r\nfor j=1:1\r\nfor i=1:12\r\n   songList=a{i};\r\n   indexList = binpack_scr(songList,mediaLength) ;\r\n   indexList=unique(indexList); % No dupes\r\n   total(i)=sum(songList(indexList));\r\n   if total(i)\u003e45+1.5*eps(mediaLength) % Rqmt \u003c= 45\r\n    total(i)=-Inf;\r\n   end\r\n   net_gap=net_gap+45-total(i) ;\r\nend\r\nend\r\ntte=etime(clock,t0);\r\nfprintf('Total Time E %f\\n',tte)\r\nfprintf('Totals: ');fprintf('%.5f  ',total);fprintf('\\n')\r\nfprintf('Net Gap: %.2f\\n',net_gap)\r\n%format long\r\nfprintf('Performance: %.4f\\n',net_gap/(12*45))\r\nfprintf('Score=1000*(12*45-1.76987514-sum(total): %.3f\\n',1000*(12*45-1.76987514-sum(total)))\r\nfprintf('Final Score %i\\n',round(1000*(12*45-1.76987514-sum(total))))\r\n\r\nScore=round(1000*(12*45-1.76987514-sum(total)));\r\n\r\nassert(Score\u003e=0)\r\n\r\n\r\nfeval( @assignin,'caller','score',floor(min( 200,Score )) );\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":"2013-01-06T00:41:02.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-01-04T16:28:33.000Z","updated_at":"2013-01-06T00:52:17.000Z","published_at":"2013-01-04T18:16:41.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/contest/contests/3/rules\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eFull Binpack Rules and examples\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is a partial replay of the First Matlab Contest, 1998 BinPack. The Twist is to Achieve the Best Packing, no time or code size penalty. The twelve songList sets will be scored once each.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eBrief Challenge statement: Pack a 45(mediaLength) minute CD as maximally as possible given a list of songs of varying lengths. No penalty for unused songs. No song duplication allowed. Return the indices of the songs used.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [songList, mediaLength]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e indexList\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput: [ 0.5 2 3 1.5 4], [5.6]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOutput: [4 5] as 1.5+4 is very near and below 5.6.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe answer of [1 2 3] is also valid and also gives 5.5.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eScoring:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 1000*(Known_Best_Possibles - sum(songList(indexList))\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInitial Leader:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cases [2 3 4 6 8 11] have best possible scores of [44.9990 44.9971 44.8 44.6 44.584024853.. 44.25]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFinal Score of 1 achieved in \u0026lt; 6 Cody seconds for entry 10.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFinal Score of 0, optimal, achieved using recursive searches with iter limits and thresholds.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"optimiozation\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"optimiozation\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"optimiozation\"","","\"","optimiozation","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f03d354c260\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f03d354c120\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f03d354b860\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f03d354c4e0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f03d354c440\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f03d354c3a0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f03d354c300\u003e":"tag:\"optimiozation\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f03d354c300\u003e":"tag:\"optimiozation\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"optimiozation\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"optimiozation\"","","\"","optimiozation","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f03d354c260\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f03d354c120\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f03d354b860\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f03d354c4e0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f03d354c440\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f03d354c3a0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f03d354c300\u003e":"tag:\"optimiozation\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f03d354c300\u003e":"tag:\"optimiozation\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":1173,"difficulty_rating":"unrated"}]}}