[Ipopt] Ipopt exception handling

ax487 ax487 at gmx.de
Sun Sep 1 17:34:36 EDT 2013


Hello all,

first of all, I have been using Ipopt as a library in a C++ project and
I must say that I am very pleased with the performance of Ipopt and the
C++ interface in general.

There is one thing that bothers me though: I subclassed `Ipopt::TNLP'
and implemented the functions required to compute the objective value
etc. Unfortunately some of the subroutines I am using to compute the
required values throw exceptions indicating things like failed assertions.

As I am sure you know it is rather simple to get an idea of what is
causing an exception to be thrown using a debugger like gdb: As soon as
the exception is thrown and the program is being terminated gdb provides
a stack frame that contains the location in the code and the
corresponding data that is causing the exception to be thrown.

The problem is that Ipopt suppresses these exceptions using a
`catch(...)' block after executing the Ipopt::TNLP routines. So instead
of a stack trace all I get is a return status
`NonIpopt_Exception_Thrown'. This status is pretty useless to as it does
not tell me anything about what went wrong exactly.

The developers of the boost C++ library recommend to just let exceptions
pass through the code without doing handling them at all
(http://www.boost.org/community/error_handling.html). I would much
appreciate it if you could do the same. I ended up just commenting in
the problematic `catch(...)' blocks and recompiling Ipopt which solves
the problem for me.

ax487


More information about the Ipopt mailing list