Getting IPOPT exitflags with casadi.nlpsol class object

488 views
Skip to first unread message

Shyam Srinivasan

unread,
Aug 30, 2017, 9:02:23 AM8/30/17
to CasADi
Hi

I am wondering whether it is possible to get exitflags (in MATLAB) after IPOPT finishes with the solution to an NLP (in addition to the on screen message delivered by it).


I tried following the answer that was given i.e., to use the getStats() method of the solver object, but got an error. 

This is the code snippet:

estprob = struct('x',var,'f',obj,'g',cons,'p',par);
options.warn_initial_bounds = 1;
options.ipopt.fixed_variable_treatment = 'make_constraint';
options.ipopt.max_iter = 5000;
solver = casadi.nlpsol('solver','ipopt',estprob,options);
sol = solver('x0',x0,'p',par_val,'lbx',lb,'ubx',ub,'lbg',lbg,'ubg',ubg);

This code solves my problem. However, calling solver.getStats() gets me the following error:

Error using subsref
No appropriate method, property, or field getStats for class casadi.Function.

Error in casadi.Function/subsref (line 1443)
        [varargout{1:nargout}] = builtin('subsref',self,s);

I also could not find the getStats method associated with the solver object when I typed methods(solver).

Any help is appreciated.

Thank you

Joris Gillis

unread,
Aug 30, 2017, 10:32:23 AM8/30/17
to CasADi
Modern syntax is .stats as opposed to .getStats
Reply all
Reply to author
Forward
0 new messages