Problem with 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)?

Please read: PSA: make it easier to help you.

You need something like

if termination_status(model) == MOI.OPTIMAL || termination_status(model) == MOI.LOCALLY_SOLVED
    # Success!
elseif termination_status(model) == MOI.ITERATION_LIMIT
    # Increase iteration limit and re-solve.
    # Something went wrong! Do something to recover.

You can see the list of Ipopt statuses here:

1 Like