Cody

# Problem 44655. Computational power of Cody servers

Solution 1721511

Submitted on 5 Feb 2019 by Alfonso Nieto-Castanon
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
% ADDED 2019-06-29. % Ensure only builtin functions will be called. ! rm -v fileread.m ! rm -v assert.m

rm: cannot remove 'fileread.m': No such file or directory rm: cannot remove 'assert.m': No such file or directory

2   Pass
assessFunctionPresence({'fminsearch', 'optimset'}, 'FileName','predictor.m', 'Feedback','You must use the specified methodology')

3   Pass

4   Pass
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))

5   Pass
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))

6   Pass
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))

7   Pass
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))

8   Pass
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))

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

10   Pass
% 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;