Cody

Solution 1687407

Submitted on 6 Dec 2018
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, sign in.

Test Suite

Test Status Code Input and Output
1   Fail
assessFunctionPresence({'fminsearch', 'optimset'}, 'FileName','predictor.m', 'Feedback','You must use the specified methodology')

Unable to read the submission. If this is a function, please make sure to pass the function name as a value for 'Filename'.

2   Fail
% Adapted from a comment at https://www.mathworks.com/matlabcentral/cody/problems/44343 . assert(~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''.') assert(~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''.')

Error using fileread (line 23) Could not open file predictor.m. No such file or directory. Error in Test2 (line 2) assert(~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''.')

3   Fail
futureDate = '22-Jan-2019'; predictedRuntime_correct = round(0.935043294718475, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '23-Jan-2019'; predictedRuntime_correct = round(0.934448955935569, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '24-Jan-2019'; predictedRuntime_correct = round(0.933855075296061, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Undefined function 'predictor' for input arguments of type 'struct'. Error in Test3 (line 3) assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

4   Fail
futureDate = '09-Jan-2020'; predictedRuntime_correct = round(0.751755426901932, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '13-Jan-2020'; predictedRuntime_correct = round(0.749945312632780, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Undefined function 'predictor' for input arguments of type 'struct'. Error in Test4 (line 3) assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

5   Fail
futureDate = '06-Jan-2021'; predictedRuntime_correct = round(0.608254613313523, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '11-Jan-2021'; predictedRuntime_correct = round(0.606545074994730, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Undefined function 'predictor' for input arguments of type 'struct'. Error in Test5 (line 3) assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

6   Fail
futureDate = '06-Feb-2022'; predictedRuntime_correct = round(0.491354117473879, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '10-Feb-2022'; predictedRuntime_correct = round(0.490345992043568, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Undefined function 'predictor' for input arguments of type 'struct'. Error in Test6 (line 3) assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

7   Fail
futureDate = '06-Nov-2023'; predictedRuntime_correct = round(0.364155581026111, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '21-Nov-2023'; predictedRuntime_correct = round(0.361853937995679, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '25-Nov-2023'; predictedRuntime_correct = round(0.361244649648014, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct)) futureDate = '27-Nov-2023'; predictedRuntime_correct = round(0.360940709522436, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Undefined function 'predictor' for input arguments of type 'struct'. Error in Test7 (line 3) assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

8   Fail
futureDate = '01-Jan-3000'; predictedRuntime_correct = round(0.164021404839, 4); assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

Undefined function 'predictor' for input arguments of type 'struct'. Error in Test8 (line 3) assert(isequal(predictor(futureDate, data), predictedRuntime_correct))

9   Fail
% Assure no 'workarounds' that avoid appropriate use of optimset. % (Added 29 May 2018.) futureDate = {'19-Dec-2019'; '04-Oct-2020'; '06-Nov-2020'; '20-Nov-2020'; '07-Dec-2020'; '09-Dec-2020'; '11-Dec-2020'; '25-Feb-2021'; '04-Mar-2021'; '18-Apr-2021'; '19-May-2021'; '23-Jul-2021'}; pRuntime_c_unrounded = {0.761350673860113 0.641651747331991 0.629650497697623 0.624650604424140 0.618651428148657 0.617950799242008 0.617251250072375 0.591452258418511 0.589151203003048 0.574651625923890 0.564951737257372 0.545350739105932}; for j = 1 : length(futureDate) assert(isequal(predictor(futureDate{j}, data), round(pRuntime_c_unrounded{j}, 4))) end;

Undefined function 'predictor' for input arguments of type 'struct'. Error in Test9 (line 6) assert(isequal(predictor(futureDate{j}, data), round(pRuntime_c_unrounded{j}, 4)))