Error handling in JuMP

I’m trying to use a JuMP model as an input to an ODE solver (using the DifferentialEquations.jl package). It seems to work well most of the time, but occasionally, the solver will output warnings at intermediate values along the ODE solver, e.g.

WARNING: Not solved to optimality, status: Error
WARNING: Ipopt finished with status Search_Direction_Becomes_Too_Small
WARNING: Not solved to optimality, status: Error

Is there a suggested workflow for how to handle these kinds of errors so as to make the call to the jump optimization try to troubleshoot itself (as the outer ode solver goes along)?

In JuMP 0.18, you should check the status symbol that is returned from the solve function. Maybe something like

status = solve(model)
if status == :Optimal
    # carry on as normal
elseif status == :Infeasible
    # oops
elseif status == :Unbounded
    # oops
    # Something went wrong

JuMP 0.19 will contain a much richer status reporting system that will make this a whole lot easier.


Thank you!