Callback information about parent in B&B tree

question

#1

Hi everyone. in the B&B tree, I need to recover the father of the current node. A solution is to store the father id when the solver branchs, using a branch callback. I see that JuMP doesn’t have branch callbacks. How can I do this?

Thanks!


#2

I think you will need to give more context.


#3

I’m implementing a Bender’s type of algorithm in Julia, adding Lazy cuts on the B&B tree using addlazycallback. But, to construct the cut, I need to know information about the “father” node in the B&B tree (the node that was branched, generating the current node). The ID of the father node is enough.

My expertise is in CPLEX. The way to do this in CPLEX, is during the “branching” process. You can add a branch callback, after CPLEX decide how to branch a node and create these new nodes, and use that information to store the father ID of each generated node.

I don’t see branch callbacks in Julia (am I correct?), and I don’t know if this can be done in a different way. I saw the documentation of what addinfocallback and what MathProgBase can return as info for a given node, but it is not enough.

Any idea?


#4

You should be aware that the upcoming release of JuMP will not support solver independent callbacks. See

However, at present you can get the CPLEX model from a JuMP model as follows

m = Model(solver=CplexSolver())
# ... some stuff like @variable and @constraint...
JuMP.build(m)
cpx_mpb = JuMP.internalmodel(m)
# cpx_mpb is a CplexMathProgModel, see
# https://github.com/JuliaOpt/CPLEX.jl/blob/ad35be73747ba144fc67a685d4f0caee780a8c1d/src/CplexSolverInterface.jl#L3
cpx = cpx_mpb.inner 
# cpx is a CPLEX Model, see
# https://github.com/JuliaOpt/CPLEX.jl/blob/ad35be73747ba144fc67a685d4f0caee780a8c1d/src/cpx_model.jl#L1

You can then use the (wrapped) CPLEX C API to add branch callbacks etc.


#5

Excellent! Thanks!