Skip to main content

computeVerificationOptimizationMainFunction.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function sets up GPOPS-II to run Verification Optimization.
%
% (struct) -> (struct, struct)
% Assigns optimal control settings and runs Verification Optimization


function output = computeVerificationOptimizationMainFunction(inputs, params)
bounds = setupProblemBounds(inputs, params);
guess = setupCommonOptimalControlInitialGuess(inputs);
setup = setupCommonOptimalControlSolverSettings(inputs, ...
bounds, guess, params, ...
@computeVerificationOptimizationContinuousFunction, ...
@computeVerificationOptimizationEndpointFunction);
checkInitialGuess(guess, inputs, ...
@computeVerificationOptimizationContinuousFunction);
solution = gpops2(setup);
solution = solution.result.solution;
solution.auxdata = inputs;
output = computeVerificationOptimizationContinuousFunction(solution);
output.solution = solution;
end

function bounds = setupProblemBounds(inputs, params)
bounds = setupCommonOptimalControlBounds(inputs, params);
end