# JuMP 0.21. How to stop the solver in callback?

**URL:** https://discourse.julialang.org/t/jump-0-21-how-to-stop-the-solver-in-callback/35028
**Category:** Optimization (Mathematical)
**Created:** [February 22, 2020, 7:42pm UTC](https://discourse.julialang.org/t/jump-0-21-how-to-stop-the-solver-in-callback/35028 "2020-02-22T19:42:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mike\_k](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike_k/32/211864_2.png) [@mike\_k](https://discourse.julialang.org/u/mike_k)
#### Post date: [February 22, 2020, 7:42pm UTC](https://discourse.julialang.org/t/jump-0-21-how-to-stop-the-solver-in-callback/35028/1 "2020-02-22T19:42:14Z")

</div>

Dear community,

in older JuMP versions, one was able to stop the solving process in a callback with `JuMP.StopTheSolver`. However, I did not find something similar in the documentation of the current release 0.21. Do have any suggestions?

Thanks in advance.

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [February 25, 2020, 4:21am UTC](https://discourse.julialang.org/t/jump-0-21-how-to-stop-the-solver-in-callback/35028/2 "2020-02-25T04:21:20Z")

</div>

I don’t think we have a way to do this at present.

If you’re willing to use one particular solver, you can write a solver-dependent callback.  
e.g., [JuMP.jl/callbacks.jl at 13ad5db156210f805699e8a1004610d60bc3be3b · jump-dev/JuMP.jl · GitHub](https://github.com/JuliaOpt/JuMP.jl/blob/13ad5db156210f805699e8a1004610d60bc3be3b/examples/callbacks.jl#L132-L149)  
You would need to find the write `GLPK.ios_xxx` function to call though (from memory, it’s something like `ios_terminate(cb_data.tree)`).

If you’re using Gurobi or CPLEX, you can do something similar, but it isn’t well documented. The best thing to do is look in the `test/MOI_callbacks.jl` file in each repository.
