# User Callback nodeid

**URL:** <https://discourse.julialang.org/t/user-callback-nodeid/43847>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump, optimization\
**Created:** [July 28, 2020, 11:01pm UTC](https://discourse.julialang.org/t/user-callback-nodeid/43847 "2020-07-28T23:01:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![afazevedo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/afazevedo/32/16394_2.png) [@afazevedo](https://discourse.julialang.org/u/afazevedo)\
**Post date:** [July 28, 2020, 11:01pm UTC](https://discourse.julialang.org/t/user-callback-nodeid/43847/1 "2020-07-28T23:01:53Z")

</div>

Is there any way to retrieve the node id on user callback?

On the Gurobi callback, cbget\_mipnode\_nodcnt serves well. But I want to use the MOI user callback, instead.

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:** [July 29, 2020, 2:18am UTC](https://discourse.julialang.org/t/user-callback-nodeid/43847/2 "2020-07-29T02:18:59Z")

</div>

You have to use the `Gurobi.CallbackFunction` callback.

You cannot get the node ID from a `MOI.UserCutCallback`.

In fact, the only thing you can query in solver-independent callbacks is the variable primal:  
[https://jump.dev/JuMP.jl/v0.21.1/callbacks/#Information-that-can-be-queried-during-callbacks-1](https://jump.dev/JuMP.jl/v0.21.1/callbacks/#Information-that-can-be-queried-during-callbacks-1)

---

<div class="post-metadata">

**Author:** ![afazevedo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/afazevedo/32/16394_2.png) [@afazevedo](https://discourse.julialang.org/u/afazevedo)\
**Post date:** [July 29, 2020, 12:54pm UTC](https://discourse.julialang.org/t/user-callback-nodeid/43847/3 "2020-07-29T12:54:08Z")

</div>

Speaking of which, is there another way to create cuts in Gurobi.Callback instead cbcut?  
I’m having trouble with the second index parameter. Is there any way to retrieve the information of the order that the variables is? Thanks a lot!!!

---

<div class="post-metadata">

**Author:** ![mtanneau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mtanneau/32/17787_2.png) [@mtanneau](https://discourse.julialang.org/u/mtanneau)\
**Post date:** [July 29, 2020, 1:34pm UTC](https://discourse.julialang.org/t/user-callback-nodeid/43847/4 "2020-07-29T13:34:26Z")

</div>

Gurobi supports three types of callbacks where you can provide information to the solver: user cuts, lazy constraints and heuristic solutions.

See in the [Gurobi documentation](https://www.gurobi.com/documentation/9.0/refman/c_modifying_solver_behavio.html) which is best for your purpose.
