# The usage of callback

**URL:** <https://discourse.julialang.org/t/the-usage-of-callback/70219>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package, jump, optimization\
**Created:** [October 22, 2021, 2:45pm UTC](https://discourse.julialang.org/t/the-usage-of-callback/70219 "2021-10-22T14:45:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BYS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bys/32/25384_2.png) [@BYS](https://discourse.julialang.org/u/BYS)\
**Post date:** [October 22, 2021, 2:45pm UTC](https://discourse.julialang.org/t/the-usage-of-callback/70219/1 "2021-10-22T14:45:43Z")

</div>

Hi all,  
I have seen an example of callback usage \>[https://jump.dev/JuMP.jl/stable/tutorials/Optimization%20concepts/benders\_lazy\_constraints/](https://jump.dev/JuMP.jl/stable/tutorials/Optimization%20concepts/benders_lazy_constraints/) there is a line `x_current = callback_value.(Ref(cb_data), x)`, I wonder if it should judge the integer feasibility of solutions obtainted, then adding the Benders cuts.(`status = callback_node_status(cb_data, model)`)

---

<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:** [October 22, 2021, 6:34pm UTC](https://discourse.julialang.org/t/the-usage-of-callback/70219/2 "2021-10-22T18:34:56Z")

</div>

See the documentation for details

[https://jump.dev/JuMP.jl/stable/manual/callbacks/#Things-you-can-and-cannot-do-during-solver-independent-callbacks](https://jump.dev/JuMP.jl/stable/manual/callbacks/#Things-you-can-and-cannot-do-during-solver-independent-callbacks)

---

<div class="post-metadata">

**Author:** ![BYS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bys/32/25384_2.png) [@BYS](https://discourse.julialang.org/u/BYS)\
**Post date:** [October 23, 2021, 1:19am UTC](https://discourse.julialang.org/t/the-usage-of-callback/70219/3 "2021-10-23T01:19:02Z")

</div>

Hi, odow  
Thank you for your reply. I have seen the link, it uses the codes to judge the integer feasiblility during callback process. However, the Benders decomposition example doesn’t have the integer feasiblility judgement process.

---

<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:** [October 23, 2021, 2:47am UTC](https://discourse.julialang.org/t/the-usage-of-callback/70219/4 "2021-10-23T02:47:44Z")

</div>

Ah I misunderstood your question.

The only reason for not checking is that the tutorial was written before we added the status. Improvements to the tutorials are always welcomed if you want to make a pull request.

---

<div class="post-metadata">

**Author:** ![BYS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bys/32/25384_2.png) [@BYS](https://discourse.julialang.org/u/BYS)\
**Post date:** [October 23, 2021, 3:25am UTC](https://discourse.julialang.org/t/the-usage-of-callback/70219/5 "2021-10-23T03:25:16Z")

</div>

Adding cutting planes without considering the integer variables constraints don’t influence the solving process?(in other words,not consider the integer variable constraints, could the Benders cuts be valid?) I thought the effect is not the same whether the integer constraints are considered.

---

<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:** [October 23, 2021, 4:04am UTC](https://discourse.julialang.org/t/the-usage-of-callback/70219/6 "2021-10-23T04:04:55Z")

</div>

It doesn’t matter if you add cuts at fractional solutions.

---

<div class="post-metadata">

**Author:** ![BYS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bys/32/25384_2.png) [@BYS](https://discourse.julialang.org/u/BYS)\
**Post date:** [October 23, 2021, 4:07am UTC](https://discourse.julialang.org/t/the-usage-of-callback/70219/7 "2021-10-23T04:07:26Z")

</div>

Ok,i try to test whether it is better if the integer feasibility is considered. If so, the tutorial could be improved.
