Dynamic-Calibration/utils/YALMIP-master/extras/pennonm_callback_f.m

17 lines
357 B
Mathematica
Raw Normal View History

2019-12-18 11:25:45 +00:00
function f = ipopt_callback_f(x,model_in)
global latest_x
global latest_df
persistent model
if nargin>1
model = model_in;
return
end
% We compute both function value and gradient. If pennon calls later to get
% gradient, we have saved in a global variable (yea, I know, globals suck)
x = x(:);
[f,latest_df] = fmincon_fun(x,model);
latest_x = x;