Current status with callbacks

Hi everyone!

I am using JuMP 0.19 and I tried to set up an information callback to retrieve the relaxation value of the root node. After a lot of searching I think I got the picture with the non solver independent callbacks.
Do you suggest working with 0.18 and MPB or 0.19 MOI and try to set up the callbacks specifically for Gurobi. Is there any drawback if i continue with 0.18?

Thank you in advance,
Lefteris

There was some recent activity related to solver-independent callbacks (in particular GLPK and Gurobi). But I think these were focused on the functionality of lazy constraints, user cuts and heuristics.

So, if you want something else, I’d guess it would have to be solver-specific in JuMP 0.19 (or 0.20).

The drawback for sticking with 0.18 (while starting a new project) is that this version is no longer actively maintained, I guess.

1 Like

You can try Gurobi callbacks with https://github.com/JuliaOpt/Gurobi.jl/pull/258
To use the Gurobi-specific callback with JuMP v0.19 or v0.20, do

using JuMP
model = direct_model(Gurobi.Optimizer())
...
MOI.set(model, Gurobi.CallbackFunction(), (cb_data, cb_where) -> begin
    ...
end)
optimize!(model)
2 Likes

Thank you very much! So, does this mean that we have the complete functionality we had with jump 0.18 for heuristic, user and lazy constraint callbacks?

At a high level: yes. In addition, you will have complete access to the low level solver dependent callback.

Thanks for the great work, this functionality is very useful!

Is there a mechanism to control when the callback is called? For instance I would like to try using the callback only when an integer solution is found (typically made possible with Gurobi and CPLEX). Is there any chance to extract that information from the callback’s parameter? (usually called cb_data)

If you use the solver-dependent callbacks, you have this control. If you use the solver-independent callbacks, you don’t. Although we’re considering adding an attribute that you can query to ask.