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

**URL:** <https://discourse.julialang.org/t/is-there-a-way-to-set-ipopts-intemediate-callback-from-jump/41976>\
**Category:** Optimization (Mathematical)\
**Created:** [June 24, 2020, 12:14pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-set-ipopts-intemediate-callback-from-jump/41976 "2020-06-24T12:14:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjssilva](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pjssilva/32/4238_2.png) [@pjssilva](https://discourse.julialang.org/u/pjssilva)\
**Post date:** [June 24, 2020, 12:14pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-set-ipopts-intemediate-callback-from-jump/41976/1 "2020-06-24T12:14:42Z")

</div>

Hello,

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.

best,

Paulo

---

<div class="post-metadata">

**Author:** ![abelsiqueira](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abelsiqueira/32/47269_2.png) [@abelsiqueira](https://discourse.julialang.org/u/abelsiqueira)\
**Post date:** [June 24, 2020, 12:25pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-set-ipopts-intemediate-callback-from-jump/41976/2 "2020-06-24T12:25:15Z")

</div>

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: [https://github.com/JuliaSmoothOptimizers/NLPModelsIpopt.jl/blob/master/test/runtests.jl#L21-L28](https://github.com/JuliaSmoothOptimizers/NLPModelsIpopt.jl/blob/master/test/runtests.jl#L21-L28)

---

<div class="post-metadata">

**Author:** ![pjssilva](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pjssilva/32/4238_2.png) [@pjssilva](https://discourse.julialang.org/u/pjssilva)\
**Post date:** [June 24, 2020, 12:38pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-set-ipopts-intemediate-callback-from-jump/41976/3 "2020-06-24T12:38:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [June 24, 2020, 1:03pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-set-ipopts-intemediate-callback-from-jump/41976/4 "2020-06-24T13:03:11Z")

</div>

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.
