CPLEX - Setting branching priority


#1

Hi all!

I have been trying to set branching priority (in CPLEX) for a set of my variables (z) but I cannot do it. I tried using the linear indices and the internal model, but I get a method not found error.

Source code:

model_indices = zeros(length(indices.V)*length(indices.H))
priorities = zeros(length(indices.V)*length(indices.H))
idx = 1
for i=indices.V_cus, t=indices.H
    lin_idx = linearindex(z[i,t])
    model_indices[idx] = lin_idx
    priorities[idx] = 10
    idx += 1
end
CPLEX.set_branching_priority(m.internalModel, model_indices, priorities)

Error:
LoadError: MethodError: no method matching set_branching_priority(::CPLEX.CplexMathProgModel, ::Array{Float64,1}, ::Array{Float64,1})
Closest candidates are:
set_branching_priority(::Any, ::Any, ::Any, !Matched::Any) at C:\Users\lmano.julia\v0.6\CPLEX\src\cpx_solve.jl:21
set_branching_priority(!Matched::CPLEX.Model, ::Any, ::Any) at C:\Users\lmano.julia\v0.6\CPLEX\src\cpx_solve.jl:18
set_branching_priority(!Matched::CPLEX.Model, ::Any) at C:\Users\lmano.julia\v0.6\CPLEX\src\cpx_solve.jl:15
while loading C:\MyWork[Workspace] MIRP\Julia\MIRP\src\run.jl, in expression starting on line 34

The problem seems to be that CPLEX.jl set_branching_priority function needs a CPLEX.Model object while the internal model is a CPLEX.CplexMathProgModel. Is that a possible mismatch that needs to be fixed or I am doing something wrong. Any ideas on how to fix this?

Thanks,
Lefteris


#2

Hi Lefteris,

You can access the CPLEX Model as JuMP.internalmodel(m).inner.

m.internalModel is actual a MathProgBase wrapper of the internal C model. You can see the struct here:

In regard to set_branching_priority, you seem to know what your are doing. You can find the source in CPLEX.jl here:

You can find the C documentation for copyorder here:
https://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.1/ilog.odms.cplex.help/refcallablelibrary/mipapi/copyorder.html


#3

Thank you very much Oscar! Indeed it works when I use the inner field of the internalmodel struct.