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

optimize!(model)
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.
else
    # Something went wrong! Do something to recover.
end

You can see the list of Ipopt statuses here: https://github.com/JuliaOpt/Ipopt.jl/blob/d3641ae75475c778463907fc9dccb4518b0405b0/src/MOI_wrapper.jl#L729-L771

1 Like