Is there a way to set Ipopt's intemediate callback from JuMP?


I was looking at the Ipopt.jl MOI interface and I could not find an easy way to set the intermediate callback (to stop iteration if needed). Is there any workaround? Maybe grab the Ipopt Optimizer struct directly and call the setIntemediateCallback function directly? I tried to do that but it was not obvious to me how to grab the actual Ipopt.jl Optimizer object.



Don’t know the answer to the original question, but you can convert your JuMP model to NLPModels (using NLPModelsJuMP) and call ipopt using NLPModelsIpopt and set the callback like this:

Thanks, Abel. That is definitely an alternative. I’ll pass one to a friend that asked!

It looks like the intermediate callback hasn’t been implemented in the Ipopt/MOI interface. PRs are welcome :). You could look at Gurobi and CPLEX as examples; they have more complex callbacks exposed through MOI.

1 Like