[Ipopt] Redirecting the IPOPT output to mexPrintf

Joel Andersson j.a.e.andersson at gmail.com
Thu Jun 25 05:39:02 EDT 2015


I'm working on completing the addition of a MATLAB interface to CasADi, but
I'm struggling finding a way to send the text output from IPOPT to MATLAB's
mexPrintf. Is it possible to somehow set a user-defined function for
printing log messages? Or, alternatively, to have IPOPT write output to
C++'s iostream (i.e. std::cout and std::cerr) instead of C's printf (i.e.
stdout and stderr)? The former is much easier to redirect to a custom

In general, since Ipopt is a C++ code, I would expect iostream to be used
for printing, but I guess it uses printf because of the linear solvers

If anyone is interested, you can find an example of how to solve an NLP
using IPOPT with CasADi-MATLAB here:
This is complete with efficient calculation of sparse Hessians and
Jacobians but unless you start MATLAB from the command line without the
GUI, you'll lose the IPOPT text output due to the above issue. I'll get
back to this mailing list as soon as we make a stable release.

Best regards,

Joel Andersson, PhD
Ptge. Busquets 11-13, atico 3
E-08940 Cornella de Llobregat (Barcelona), Spain
Home: +34-93-6034011
Mobile: +34-63-4408800 (in Sweden also +46-707-360512)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20150625/4f1cd7f1/attachment.html>

More information about the Ipopt mailing list