how to export a fmincon model?

66 views
Skip to first unread message

Xinwei Shen

unread,
Sep 19, 2017, 7:22:17 PM9/19/17
to YALMIP
I use the yalmip function 'export' to export a model for matlab fmincon, cause I want to set some parameters for optimization in matlab. But it seems that export produce an empty output 'Model'. So, how to export a fmincon model?

Johan Löfberg

unread,
Sep 20, 2017, 2:05:23 AM9/20/17
to YALMIP
You cannot export an fmincon model, as the interface to fmincon is based on various callback functions etc to compute objective/constraint functions/gradients

Johan Löfberg

unread,
Sep 20, 2017, 2:07:36 AM9/20/17
to YALMIP
...or actually it might be possible to export a model which includes anonymous functions which performs the calls. You will not be able to "look" at the model, or use it without YALMIP, as the functions will point to internal YALMIP functions which perform the computations

Johan Löfberg

unread,
Sep 20, 2017, 2:10:01 AM9/20/17
to YALMIP
thinking more, it will not be possible, as everything is glued together with persistent variables etc 

Xinwei Shen

unread,
Sep 21, 2017, 12:04:27 AM9/21/17
to YALMIP
Thank you. 
And here comes another problem: how to set some parameters that haven't been defined in sdpsettings? 
E.g.
    ops = sdpsettings('solver','fmincon','fmincon.SpecifyObjectiveGradient',true,...
        'fmincon.SpecifyConstraintGradient',true);
Matlab TOLD me that
Unrecognized property name 'fmincon.SpecifyObjectiveGradient'.

However, as we all know 
options = optimoptions('fmincon','Algorithm','interior-point','SpecifyObjectiveGradient',true,'SpecifyConstraintGradient',true)
is feasible in matlab.

Johan Löfberg

unread,
Sep 21, 2017, 2:33:19 AM9/21/17
to YALMIP
yalmip uses the options structure that fmincon exports

fmincon('defaults')


hence, they appear to have an inconsistency in exposes options from these two 

However, you would never touch something like specifyobjectivegradient as a user via YALMIP., since YALMIP always computes gradients and thus communicates this fact to the solver

Johan Löfberg

unread,
Sep 21, 2017, 2:34:54 AM9/21/17
to YALMIP
Correction: YALMIP does always compute derivatives, there is a weird special case here this is not done when sdpfun is used, but then this is of course communicated to the solver automatically
Reply all
Reply to author
Forward
0 new messages