{"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":44655,"title":"Computational power of Cody servers","description":"It has been \u003chttps://en.wikipedia.org/wiki/Moore%27s_law#History predicted\u003e that the performance of integrated circuits would _double_ every 18 months.  That suggests the time to perform a given computation should _halve_ roughly every 18 months.  \r\n\r\nWhat about on Cody?  Observational data is available from the final test case of \u003chttps://www.mathworks.com/matlabcentral/cody/problems/963-we-love-vectorized-solutions-problem-1-remove-the-row-average Problem 963\u003e to help us quantify the improvement in performance!  And thereby even make predictions for future computations.\r\n\r\n Solution    Date\t   Runtime [s]\r\n ...\r\n 144393\t     04-Oct-12\t   4.230\r\n ...\r\n 654812\t     17-Apr-15\t   3.099\r\n ...\r\n 1272817     20-Sep-17\t   2.0402\r\n ...\r\n\r\nThe complete data set will be provided to you as input.  You should assume the general trend can be described by the following law:\r\n\r\n runtime = r0 - δ [1 - exp(-t/k)]\r\n runtime = r∞ + δ exp(-t/k)\r\n\r\nwhere |r0| is the runtime at the start of the period in seconds, |r∞| is the predicted runtime (in seconds) that will be approached far in the future, |δ = r0 - r∞|, and |t| is the time in nominal years since the start of the period, and |k| is a kinetic parameter (in nominal years).  \r\n\r\nThe start of the period is defined by the earliest date in the series.  Compute the number of days exactly, and assume that a nominal year comprises 365.24 days.\r\n\r\nYour task is to \u003chttps://au.mathworks.com/help/matlab/math/example-curve-fitting-via-optimization.html fit the curve\u003e and thereby predict the runtime for various future dates.  Your output should be rounded to four decimal places.  \r\n\r\nMETHOD:  You _must_ use \u003chttps://au.mathworks.com/help/matlab/ref/fminsearch.html |fminsearch|\u003e to perform the non-linear regression, and you _must_ set the options using \u003chttps://au.mathworks.com/help/matlab/ref/optimset.html |optimset|\u003e to ensure sufficient accuracy.  The 'best' fit is defined — _for this problem, as in the common convention_ — as that which minimises the sum of the squares of the residuals.  \r\n\r\nEXAMPLE:\r\n\r\n % Input\r\n futureDate = '21-Nov-2023';\r\n data.solutionNumber = [1036949, ..., 1272817];\r\n data.date = ['29-Oct-2016'; ...; '20-Sep-2017'];\r\n data.runtime = [1.2630, ..., 2.0402];\r\n % Output\r\n predictedRuntime = 0.3619;  % seconds\r\n\r\n","description_html":"\u003cp\u003eIt has been \u003ca href = \"https://en.wikipedia.org/wiki/Moore%27s_law#History\"\u003epredicted\u003c/a\u003e that the performance of integrated circuits would \u003ci\u003edouble\u003c/i\u003e every 18 months.  That suggests the time to perform a given computation should \u003ci\u003ehalve\u003c/i\u003e roughly every 18 months.\u003c/p\u003e\u003cp\u003eWhat about on Cody?  Observational data is available from the final test case of \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/963-we-love-vectorized-solutions-problem-1-remove-the-row-average\"\u003eProblem 963\u003c/a\u003e to help us quantify the improvement in performance!  And thereby even make predictions for future computations.\u003c/p\u003e\u003cpre\u003e Solution    Date\t   Runtime [s]\r\n ...\r\n 144393\t     04-Oct-12\t   4.230\r\n ...\r\n 654812\t     17-Apr-15\t   3.099\r\n ...\r\n 1272817     20-Sep-17\t   2.0402\r\n ...\u003c/pre\u003e\u003cp\u003eThe complete data set will be provided to you as input.  You should assume the general trend can be described by the following law:\u003c/p\u003e\u003cpre\u003e runtime = r0 - δ [1 - exp(-t/k)]\r\n runtime = r∞ + δ exp(-t/k)\u003c/pre\u003e\u003cp\u003ewhere \u003ctt\u003er0\u003c/tt\u003e is the runtime at the start of the period in seconds, \u003ctt\u003er∞\u003c/tt\u003e is the predicted runtime (in seconds) that will be approached far in the future, \u003ctt\u003eδ = r0 - r∞\u003c/tt\u003e, and \u003ctt\u003et\u003c/tt\u003e is the time in nominal years since the start of the period, and \u003ctt\u003ek\u003c/tt\u003e is a kinetic parameter (in nominal years).\u003c/p\u003e\u003cp\u003eThe start of the period is defined by the earliest date in the series.  Compute the number of days exactly, and assume that a nominal year comprises 365.24 days.\u003c/p\u003e\u003cp\u003eYour task is to \u003ca href = \"https://au.mathworks.com/help/matlab/math/example-curve-fitting-via-optimization.html\"\u003efit the curve\u003c/a\u003e and thereby predict the runtime for various future dates.  Your output should be rounded to four decimal places.\u003c/p\u003e\u003cp\u003eMETHOD:  You \u003ci\u003emust\u003c/i\u003e use \u003ca href = \"https://au.mathworks.com/help/matlab/ref/fminsearch.html\"\u003e\u003ctt\u003efminsearch\u003c/tt\u003e\u003c/a\u003e to perform the non-linear regression, and you \u003ci\u003emust\u003c/i\u003e set the options using \u003ca href = \"https://au.mathworks.com/help/matlab/ref/optimset.html\"\u003e\u003ctt\u003eoptimset\u003c/tt\u003e\u003c/a\u003e to ensure sufficient accuracy.  The 'best' fit is defined — \u003ci\u003efor this problem, as in the common convention\u003c/i\u003e — as that which minimises the sum of the squares of the residuals.\u003c/p\u003e\u003cp\u003eEXAMPLE:\u003c/p\u003e\u003cpre\u003e % Input\r\n futureDate = '21-Nov-2023';\r\n data.solutionNumber = [1036949, ..., 1272817];\r\n data.date = ['29-Oct-2016'; ...; '20-Sep-2017'];\r\n data.runtime = [1.2630, ..., 2.0402];\r\n % Output\r\n predictedRuntime = 0.3619;  % seconds\u003c/pre\u003e","function_template":"function predictedRuntime = predictor(futureDate, data)\r\n    % Preliminaries:\r\n    ...\r\n    \r\n    \r\n    % Use fminsearch to find the parameters that minimize the objective function.\r\n    myObjectiveFun = ...\r\n    myOptions = ...\r\n    ... = fminsearch\r\n\r\n    % Report your prediction of the runtime at the specified future date.\r\n    predictedRuntime = ...\r\nend\r\n\r\n% Function that accepts a trial set of parameters and the observed data, \r\n% and returns the sum of squared errors for the model . \r\n% https://au.mathworks.com/help/matlab/math/example-curve-fitting-via-optimization.html\r\nfunction SSE = sseVal(...)\r\n    % runtime = r0 - δ [1 - exp(-t/k)]\r\n    % runtime = r∞ + δ exp(-t/k)\r\n    \r\n    ...\r\n    \r\n    SSE = ...\r\nend\r\n","test_suite":"data.solutionNumber = [1036949\t1048171\t1051202\t1078061\t1078699\t1081561\t886761\t1165117\t1202850\t1211446\t1241478\t1241530\t1329044\t1323931\t1382633\t1345204\t1281524\t1272814\t1272815\t1272823\t1272845\t1287012\t1287386\t1262442\t1262445\t1251993\t1252843\t1407137\t1412687\t1448359\t1448368\t1410187\t1465616\t1472214\t1472225\t1490596\t1490602\t1541085\t1541132\t860114\t143879\t144156\t144393\t202249\t210894\t539555\t182974\t276887\t1133109\t654812\t1272817];\r\ndata.date = ['29-Oct-2016';\t'08-Nov-2016';\t'12-Nov-2016';\t'09-Dec-2016';\t'10-Dec-2016';\t'14-Dec-2016';\t'06-May-2016';\t'18-Apr-2017';\t'02-Jun-2017';\t'13-Jun-2017';\t'28-Jul-2017';\t'28-Jul-2017';\t'06-Nov-2017';\t'01-Nov-2017';\t'16-Dec-2017';\t'15-Nov-2017';\t'05-Oct-2017';\t'20-Sep-2017';\t'20-Sep-2017';\t'20-Sep-2017';\t'20-Sep-2017';\t'15-Oct-2017';\t'15-Oct-2017';\t'05-Sep-2017';\t'05-Sep-2017';\t'16-Aug-2017';\t'17-Aug-2017';\t'06-Jan-2018';\t'10-Jan-2018';\t'24-Feb-2018';\t'24-Feb-2018';\t'08-Jan-2018';\t'18-Mar-2018';\t'27-Mar-2018';\t'27-Mar-2018';\t'13-Apr-2018';\t'13-Apr-2018';\t'26-May-2018';\t'26-May-2018';\t'31-Mar-2016';\t'02-Oct-2012';\t'03-Oct-2012';\t'04-Oct-2012';\t'08-Feb-2013';\t'01-Mar-2013';\t'03-Dec-2014';\t'29-Dec-2012';\t'09-Jul-2013';\t'03-Mar-2017';\t'17-Apr-2015';\t'20-Sep-2017'];\r\ndata.runtime = [1.2630\t0.624\t1.3326\t1.2939\t0.5995\t1.1307\t1.3505\t1.2613\t1.2737\t1.3081\t1.2774\t1.252\t1.2179\t1.4431\t1.2637\t1.1614\t1.2542\t1.9135\t1.2996\t1.2595\t1.2664\t1.1858\t1.1501\t1.2516\t1.2786\t1.9461\t1.2492\t1.3654\t1.3263\t1.1484\t1.1728\t1.6177\t1.0538\t1.0571\t1.0454\t1.3873\t1.0600\t1.1154\t1.0635\t1.4359\t4.498\t4.198\t4.230\t5.264\t4.022\t3.153\t4.740\t4.112\t2.3409\t3.099\t2.0402];\r\n\r\n%% Anti-hacking provision\r\n% ADDED 2019-06-29.  \r\n% Ensure only builtin functions will be called.  \r\n! rm -v fileread.m\r\n! rm -v assert.m\r\n\r\n%% Required methodology\r\nassessFunctionPresence({'fminsearch', 'optimset'}, 'FileName','predictor.m', 'Feedback','You must use the specified methodology')\r\n\r\n%% Anti-hardcoding test\r\n% Adapted from a comment at https://www.mathworks.com/matlabcentral/cody/problems/44343 .\r\nassert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[2012,2019:2023,3000]),regexp(fileread('predictor.m'),'[\\d\\.\\+\\-\\*\\/\\(\\) \\[\\]\\,\\;]+','match'))), 'Please don''t hard-code your ''solution''.') \r\nassert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[2012,2019:2023,3000]),regexp(fileread('predictor.m'),'\\d+','match'))), 'Please do not hard-code your ''solution''.') \r\n\r\n%% January 2019\r\nfutureDate = '22-Jan-2019';\r\npredictedRuntime_correct = round(0.935043294718475, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '23-Jan-2019';\r\npredictedRuntime_correct = round(0.934448955935569, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '24-Jan-2019';\r\npredictedRuntime_correct = round(0.933855075296061, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% January 2020\r\nfutureDate = '09-Jan-2020';\r\npredictedRuntime_correct = round(0.751755426901932, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '13-Jan-2020';\r\npredictedRuntime_correct = round(0.749945312632780, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% January 2021\r\nfutureDate = '06-Jan-2021';\r\npredictedRuntime_correct = round(0.608254613313523, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '11-Jan-2021';\r\npredictedRuntime_correct = round(0.606545074994730, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% February 2022\r\nfutureDate = '06-Feb-2022';\r\npredictedRuntime_correct = round(0.491354117473879, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '10-Feb-2022';\r\npredictedRuntime_correct = round(0.490345992043568, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% November 2023\r\nfutureDate = '06-Nov-2023';\r\npredictedRuntime_correct = round(0.364155581026111, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '21-Nov-2023';\r\npredictedRuntime_correct = round(0.361853937995679, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '25-Nov-2023';\r\npredictedRuntime_correct = round(0.361244649648014, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '27-Nov-2023';\r\npredictedRuntime_correct = round(0.360940709522436, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% Let's all meet up in the year 3000\r\nfutureDate = '01-Jan-3000';\r\npredictedRuntime_correct = round(0.164021404839, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% Enforce antihacking\r\n% Assure no 'workarounds' that avoid appropriate use of optimset.\r\n% (Added 29 May 2018.)\r\nfutureDate = {'19-Dec-2019';\t'04-Oct-2020';\t'06-Nov-2020';\t'20-Nov-2020';\t'07-Dec-2020';\t'09-Dec-2020';\t'11-Dec-2020';\t'25-Feb-2021';\t'04-Mar-2021';\t'18-Apr-2021';\t'19-May-2021';\t'23-Jul-2021'};\r\npRuntime_c_unrounded = {0.761350673860113\t0.641651747331991\t0.629650497697623\t0.624650604424140\t0.618651428148657\t0.617950799242008\t0.617251250072375\t0.591452258418511\t0.589151203003048\t0.574651625923890\t0.564951737257372\t0.545350739105932};\r\nfor j = 1 : length(futureDate)\r\n    assert(isequal(predictor(futureDate{j}, data), round(pRuntime_c_unrounded{j}, 4)))\r\nend;\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2,"test_suite_updated_at":"2019-06-29T12:58:19.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-05-27T08:32:09.000Z","updated_at":"2019-06-29T12:58:19.000Z","published_at":"2018-05-27T12:35:16.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\u003eIt has been\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=\\\"https://en.wikipedia.org/wiki/Moore%27s_law#History\\\"\u003e\u003cw:r\u003e\u003cw:t\u003epredicted\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e that the performance of integrated circuits would\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edouble\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e every 18 months. That suggests the time to perform a given computation should\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ehalve\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e roughly every 18 months.\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\u003eWhat about on Cody? Observational data is available from the final test case of\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=\\\"https://www.mathworks.com/matlabcentral/cody/problems/963-we-love-vectorized-solutions-problem-1-remove-the-row-average\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 963\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e to help us quantify the improvement in performance! And thereby even make predictions for future computations.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Solution    Date     Runtime [s]\\n ...\\n 144393       04-Oct-12     4.230\\n ...\\n 654812       17-Apr-15     3.099\\n ...\\n 1272817     20-Sep-17     2.0402\\n ...]]\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\u003eThe complete data set will be provided to you as input. You should assume the general trend can be described by the following law:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ runtime = r0 - δ [1 - exp(-t/k)]\\n runtime = r∞ + δ exp(-t/k)]]\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\u003ewhere\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003er0\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the runtime at the start of the period in seconds,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003er∞\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the predicted runtime (in seconds) that will be approached far in the future,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eδ = r0 - r∞\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003et\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the time in nominal years since the start of the period, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ek\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a kinetic parameter (in nominal years).\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 start of the period is defined by the earliest date in the series. Compute the number of days exactly, and assume that a nominal year comprises 365.24 days.\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\u003eYour task is to\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=\\\"https://au.mathworks.com/help/matlab/math/example-curve-fitting-via-optimization.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efit the curve\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and thereby predict the runtime for various future dates. Your output should be rounded to four decimal places.\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\u003eMETHOD: You\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emust\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e use\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=\\\"https://au.mathworks.com/help/matlab/ref/fminsearch.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efminsearch\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e to perform the non-linear regression, and you\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emust\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e set the options using\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=\\\"https://au.mathworks.com/help/matlab/ref/optimset.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eoptimset\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e to ensure sufficient accuracy. The 'best' fit is defined —\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efor this problem, as in the common convention\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e — as that which minimises the sum of the squares of the residuals.\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\u003eEXAMPLE:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ % Input\\n futureDate = '21-Nov-2023';\\n data.solutionNumber = [1036949, ..., 1272817];\\n data.date = ['29-Oct-2016'; ...; '20-Sep-2017'];\\n data.runtime = [1.2630, ..., 2.0402];\\n % Output\\n predictedRuntime = 0.3619;  % seconds]]\u003e\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":44655,"title":"Computational power of Cody servers","description":"It has been \u003chttps://en.wikipedia.org/wiki/Moore%27s_law#History predicted\u003e that the performance of integrated circuits would _double_ every 18 months.  That suggests the time to perform a given computation should _halve_ roughly every 18 months.  \r\n\r\nWhat about on Cody?  Observational data is available from the final test case of \u003chttps://www.mathworks.com/matlabcentral/cody/problems/963-we-love-vectorized-solutions-problem-1-remove-the-row-average Problem 963\u003e to help us quantify the improvement in performance!  And thereby even make predictions for future computations.\r\n\r\n Solution    Date\t   Runtime [s]\r\n ...\r\n 144393\t     04-Oct-12\t   4.230\r\n ...\r\n 654812\t     17-Apr-15\t   3.099\r\n ...\r\n 1272817     20-Sep-17\t   2.0402\r\n ...\r\n\r\nThe complete data set will be provided to you as input.  You should assume the general trend can be described by the following law:\r\n\r\n runtime = r0 - δ [1 - exp(-t/k)]\r\n runtime = r∞ + δ exp(-t/k)\r\n\r\nwhere |r0| is the runtime at the start of the period in seconds, |r∞| is the predicted runtime (in seconds) that will be approached far in the future, |δ = r0 - r∞|, and |t| is the time in nominal years since the start of the period, and |k| is a kinetic parameter (in nominal years).  \r\n\r\nThe start of the period is defined by the earliest date in the series.  Compute the number of days exactly, and assume that a nominal year comprises 365.24 days.\r\n\r\nYour task is to \u003chttps://au.mathworks.com/help/matlab/math/example-curve-fitting-via-optimization.html fit the curve\u003e and thereby predict the runtime for various future dates.  Your output should be rounded to four decimal places.  \r\n\r\nMETHOD:  You _must_ use \u003chttps://au.mathworks.com/help/matlab/ref/fminsearch.html |fminsearch|\u003e to perform the non-linear regression, and you _must_ set the options using \u003chttps://au.mathworks.com/help/matlab/ref/optimset.html |optimset|\u003e to ensure sufficient accuracy.  The 'best' fit is defined — _for this problem, as in the common convention_ — as that which minimises the sum of the squares of the residuals.  \r\n\r\nEXAMPLE:\r\n\r\n % Input\r\n futureDate = '21-Nov-2023';\r\n data.solutionNumber = [1036949, ..., 1272817];\r\n data.date = ['29-Oct-2016'; ...; '20-Sep-2017'];\r\n data.runtime = [1.2630, ..., 2.0402];\r\n % Output\r\n predictedRuntime = 0.3619;  % seconds\r\n\r\n","description_html":"\u003cp\u003eIt has been \u003ca href = \"https://en.wikipedia.org/wiki/Moore%27s_law#History\"\u003epredicted\u003c/a\u003e that the performance of integrated circuits would \u003ci\u003edouble\u003c/i\u003e every 18 months.  That suggests the time to perform a given computation should \u003ci\u003ehalve\u003c/i\u003e roughly every 18 months.\u003c/p\u003e\u003cp\u003eWhat about on Cody?  Observational data is available from the final test case of \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/963-we-love-vectorized-solutions-problem-1-remove-the-row-average\"\u003eProblem 963\u003c/a\u003e to help us quantify the improvement in performance!  And thereby even make predictions for future computations.\u003c/p\u003e\u003cpre\u003e Solution    Date\t   Runtime [s]\r\n ...\r\n 144393\t     04-Oct-12\t   4.230\r\n ...\r\n 654812\t     17-Apr-15\t   3.099\r\n ...\r\n 1272817     20-Sep-17\t   2.0402\r\n ...\u003c/pre\u003e\u003cp\u003eThe complete data set will be provided to you as input.  You should assume the general trend can be described by the following law:\u003c/p\u003e\u003cpre\u003e runtime = r0 - δ [1 - exp(-t/k)]\r\n runtime = r∞ + δ exp(-t/k)\u003c/pre\u003e\u003cp\u003ewhere \u003ctt\u003er0\u003c/tt\u003e is the runtime at the start of the period in seconds, \u003ctt\u003er∞\u003c/tt\u003e is the predicted runtime (in seconds) that will be approached far in the future, \u003ctt\u003eδ = r0 - r∞\u003c/tt\u003e, and \u003ctt\u003et\u003c/tt\u003e is the time in nominal years since the start of the period, and \u003ctt\u003ek\u003c/tt\u003e is a kinetic parameter (in nominal years).\u003c/p\u003e\u003cp\u003eThe start of the period is defined by the earliest date in the series.  Compute the number of days exactly, and assume that a nominal year comprises 365.24 days.\u003c/p\u003e\u003cp\u003eYour task is to \u003ca href = \"https://au.mathworks.com/help/matlab/math/example-curve-fitting-via-optimization.html\"\u003efit the curve\u003c/a\u003e and thereby predict the runtime for various future dates.  Your output should be rounded to four decimal places.\u003c/p\u003e\u003cp\u003eMETHOD:  You \u003ci\u003emust\u003c/i\u003e use \u003ca href = \"https://au.mathworks.com/help/matlab/ref/fminsearch.html\"\u003e\u003ctt\u003efminsearch\u003c/tt\u003e\u003c/a\u003e to perform the non-linear regression, and you \u003ci\u003emust\u003c/i\u003e set the options using \u003ca href = \"https://au.mathworks.com/help/matlab/ref/optimset.html\"\u003e\u003ctt\u003eoptimset\u003c/tt\u003e\u003c/a\u003e to ensure sufficient accuracy.  The 'best' fit is defined — \u003ci\u003efor this problem, as in the common convention\u003c/i\u003e — as that which minimises the sum of the squares of the residuals.\u003c/p\u003e\u003cp\u003eEXAMPLE:\u003c/p\u003e\u003cpre\u003e % Input\r\n futureDate = '21-Nov-2023';\r\n data.solutionNumber = [1036949, ..., 1272817];\r\n data.date = ['29-Oct-2016'; ...; '20-Sep-2017'];\r\n data.runtime = [1.2630, ..., 2.0402];\r\n % Output\r\n predictedRuntime = 0.3619;  % seconds\u003c/pre\u003e","function_template":"function predictedRuntime = predictor(futureDate, data)\r\n    % Preliminaries:\r\n    ...\r\n    \r\n    \r\n    % Use fminsearch to find the parameters that minimize the objective function.\r\n    myObjectiveFun = ...\r\n    myOptions = ...\r\n    ... = fminsearch\r\n\r\n    % Report your prediction of the runtime at the specified future date.\r\n    predictedRuntime = ...\r\nend\r\n\r\n% Function that accepts a trial set of parameters and the observed data, \r\n% and returns the sum of squared errors for the model . \r\n% https://au.mathworks.com/help/matlab/math/example-curve-fitting-via-optimization.html\r\nfunction SSE = sseVal(...)\r\n    % runtime = r0 - δ [1 - exp(-t/k)]\r\n    % runtime = r∞ + δ exp(-t/k)\r\n    \r\n    ...\r\n    \r\n    SSE = ...\r\nend\r\n","test_suite":"data.solutionNumber = [1036949\t1048171\t1051202\t1078061\t1078699\t1081561\t886761\t1165117\t1202850\t1211446\t1241478\t1241530\t1329044\t1323931\t1382633\t1345204\t1281524\t1272814\t1272815\t1272823\t1272845\t1287012\t1287386\t1262442\t1262445\t1251993\t1252843\t1407137\t1412687\t1448359\t1448368\t1410187\t1465616\t1472214\t1472225\t1490596\t1490602\t1541085\t1541132\t860114\t143879\t144156\t144393\t202249\t210894\t539555\t182974\t276887\t1133109\t654812\t1272817];\r\ndata.date = ['29-Oct-2016';\t'08-Nov-2016';\t'12-Nov-2016';\t'09-Dec-2016';\t'10-Dec-2016';\t'14-Dec-2016';\t'06-May-2016';\t'18-Apr-2017';\t'02-Jun-2017';\t'13-Jun-2017';\t'28-Jul-2017';\t'28-Jul-2017';\t'06-Nov-2017';\t'01-Nov-2017';\t'16-Dec-2017';\t'15-Nov-2017';\t'05-Oct-2017';\t'20-Sep-2017';\t'20-Sep-2017';\t'20-Sep-2017';\t'20-Sep-2017';\t'15-Oct-2017';\t'15-Oct-2017';\t'05-Sep-2017';\t'05-Sep-2017';\t'16-Aug-2017';\t'17-Aug-2017';\t'06-Jan-2018';\t'10-Jan-2018';\t'24-Feb-2018';\t'24-Feb-2018';\t'08-Jan-2018';\t'18-Mar-2018';\t'27-Mar-2018';\t'27-Mar-2018';\t'13-Apr-2018';\t'13-Apr-2018';\t'26-May-2018';\t'26-May-2018';\t'31-Mar-2016';\t'02-Oct-2012';\t'03-Oct-2012';\t'04-Oct-2012';\t'08-Feb-2013';\t'01-Mar-2013';\t'03-Dec-2014';\t'29-Dec-2012';\t'09-Jul-2013';\t'03-Mar-2017';\t'17-Apr-2015';\t'20-Sep-2017'];\r\ndata.runtime = [1.2630\t0.624\t1.3326\t1.2939\t0.5995\t1.1307\t1.3505\t1.2613\t1.2737\t1.3081\t1.2774\t1.252\t1.2179\t1.4431\t1.2637\t1.1614\t1.2542\t1.9135\t1.2996\t1.2595\t1.2664\t1.1858\t1.1501\t1.2516\t1.2786\t1.9461\t1.2492\t1.3654\t1.3263\t1.1484\t1.1728\t1.6177\t1.0538\t1.0571\t1.0454\t1.3873\t1.0600\t1.1154\t1.0635\t1.4359\t4.498\t4.198\t4.230\t5.264\t4.022\t3.153\t4.740\t4.112\t2.3409\t3.099\t2.0402];\r\n\r\n%% Anti-hacking provision\r\n% ADDED 2019-06-29.  \r\n% Ensure only builtin functions will be called.  \r\n! rm -v fileread.m\r\n! rm -v assert.m\r\n\r\n%% Required methodology\r\nassessFunctionPresence({'fminsearch', 'optimset'}, 'FileName','predictor.m', 'Feedback','You must use the specified methodology')\r\n\r\n%% Anti-hardcoding test\r\n% Adapted from a comment at https://www.mathworks.com/matlabcentral/cody/problems/44343 .\r\nassert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[2012,2019:2023,3000]),regexp(fileread('predictor.m'),'[\\d\\.\\+\\-\\*\\/\\(\\) \\[\\]\\,\\;]+','match'))), 'Please don''t hard-code your ''solution''.') \r\nassert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[2012,2019:2023,3000]),regexp(fileread('predictor.m'),'\\d+','match'))), 'Please do not hard-code your ''solution''.') \r\n\r\n%% January 2019\r\nfutureDate = '22-Jan-2019';\r\npredictedRuntime_correct = round(0.935043294718475, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '23-Jan-2019';\r\npredictedRuntime_correct = round(0.934448955935569, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '24-Jan-2019';\r\npredictedRuntime_correct = round(0.933855075296061, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% January 2020\r\nfutureDate = '09-Jan-2020';\r\npredictedRuntime_correct = round(0.751755426901932, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '13-Jan-2020';\r\npredictedRuntime_correct = round(0.749945312632780, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% January 2021\r\nfutureDate = '06-Jan-2021';\r\npredictedRuntime_correct = round(0.608254613313523, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '11-Jan-2021';\r\npredictedRuntime_correct = round(0.606545074994730, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% February 2022\r\nfutureDate = '06-Feb-2022';\r\npredictedRuntime_correct = round(0.491354117473879, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '10-Feb-2022';\r\npredictedRuntime_correct = round(0.490345992043568, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% November 2023\r\nfutureDate = '06-Nov-2023';\r\npredictedRuntime_correct = round(0.364155581026111, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '21-Nov-2023';\r\npredictedRuntime_correct = round(0.361853937995679, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '25-Nov-2023';\r\npredictedRuntime_correct = round(0.361244649648014, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\nfutureDate = '27-Nov-2023';\r\npredictedRuntime_correct = round(0.360940709522436, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% Let's all meet up in the year 3000\r\nfutureDate = '01-Jan-3000';\r\npredictedRuntime_correct = round(0.164021404839, 4);\r\nassert(isequal(predictor(futureDate, data), predictedRuntime_correct))\r\n\r\n%% Enforce antihacking\r\n% Assure no 'workarounds' that avoid appropriate use of optimset.\r\n% (Added 29 May 2018.)\r\nfutureDate = {'19-Dec-2019';\t'04-Oct-2020';\t'06-Nov-2020';\t'20-Nov-2020';\t'07-Dec-2020';\t'09-Dec-2020';\t'11-Dec-2020';\t'25-Feb-2021';\t'04-Mar-2021';\t'18-Apr-2021';\t'19-May-2021';\t'23-Jul-2021'};\r\npRuntime_c_unrounded = {0.761350673860113\t0.641651747331991\t0.629650497697623\t0.624650604424140\t0.618651428148657\t0.617950799242008\t0.617251250072375\t0.591452258418511\t0.589151203003048\t0.574651625923890\t0.564951737257372\t0.545350739105932};\r\nfor j = 1 : length(futureDate)\r\n    assert(isequal(predictor(futureDate{j}, data), round(pRuntime_c_unrounded{j}, 4)))\r\nend;\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":2,"test_suite_updated_at":"2019-06-29T12:58:19.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2018-05-27T08:32:09.000Z","updated_at":"2019-06-29T12:58:19.000Z","published_at":"2018-05-27T12:35:16.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\u003eIt has been\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=\\\"https://en.wikipedia.org/wiki/Moore%27s_law#History\\\"\u003e\u003cw:r\u003e\u003cw:t\u003epredicted\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e that the performance of integrated circuits would\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edouble\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e every 18 months. That suggests the time to perform a given computation should\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ehalve\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e roughly every 18 months.\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\u003eWhat about on Cody? Observational data is available from the final test case of\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=\\\"https://www.mathworks.com/matlabcentral/cody/problems/963-we-love-vectorized-solutions-problem-1-remove-the-row-average\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 963\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e to help us quantify the improvement in performance! And thereby even make predictions for future computations.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Solution    Date     Runtime [s]\\n ...\\n 144393       04-Oct-12     4.230\\n ...\\n 654812       17-Apr-15     3.099\\n ...\\n 1272817     20-Sep-17     2.0402\\n ...]]\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\u003eThe complete data set will be provided to you as input. You should assume the general trend can be described by the following law:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ runtime = r0 - δ [1 - exp(-t/k)]\\n runtime = r∞ + δ exp(-t/k)]]\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\u003ewhere\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003er0\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the runtime at the start of the period in seconds,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003er∞\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the predicted runtime (in seconds) that will be approached far in the future,\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eδ = r0 - r∞\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003et\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is the time in nominal years since the start of the period, and\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ek\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is a kinetic parameter (in nominal years).\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 start of the period is defined by the earliest date in the series. Compute the number of days exactly, and assume that a nominal year comprises 365.24 days.\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\u003eYour task is to\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=\\\"https://au.mathworks.com/help/matlab/math/example-curve-fitting-via-optimization.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003efit the curve\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e and thereby predict the runtime for various future dates. Your output should be rounded to four decimal places.\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\u003eMETHOD: You\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emust\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e use\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=\\\"https://au.mathworks.com/help/matlab/ref/fminsearch.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efminsearch\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e to perform the non-linear regression, and you\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emust\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e set the options using\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=\\\"https://au.mathworks.com/help/matlab/ref/optimset.html\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eoptimset\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e to ensure sufficient accuracy. The 'best' fit is defined —\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003efor this problem, as in the common convention\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e — as that which minimises the sum of the squares of the residuals.\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\u003eEXAMPLE:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ % Input\\n futureDate = '21-Nov-2023';\\n data.solutionNumber = [1036949, ..., 1272817];\\n data.date = ['29-Oct-2016'; ...; '20-Sep-2017'];\\n data.runtime = [1.2630, ..., 2.0402];\\n % Output\\n predictedRuntime = 0.3619;  % seconds]]\u003e\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:\"optimisation\"","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:\"optimisation\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"optimisation\"","","\"","optimisation","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007effc4569260\u003e":null,"#\u003cMathWorks::Search::Field:0x00007effc45691c0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007effc4568900\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007effc45694e0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007effc4569440\u003e":50,"#\u003cMathWorks::Search::Field:0x00007effc45693a0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007effc4569300\u003e":"tag:\"optimisation\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007effc4569300\u003e":"tag:\"optimisation\""},"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:\"optimisation\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"optimisation\"","","\"","optimisation","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007effc4569260\u003e":null,"#\u003cMathWorks::Search::Field:0x00007effc45691c0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007effc4568900\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007effc45694e0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007effc4569440\u003e":50,"#\u003cMathWorks::Search::Field:0x00007effc45693a0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007effc4569300\u003e":"tag:\"optimisation\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007effc4569300\u003e":"tag:\"optimisation\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":44655,"difficulty_rating":"unrated"}]}}