User Callback nodeid

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!

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

1 Like

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!!!

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 which is best for your purpose.

1 Like