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.
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 for your post. I’m also using set_branching_priority. I encounter a problem. Before I use CPLEX to solve the model, model.internalModel seems to be Void.
So I tried to solve(model) first, then model.internalModel.inner becomes a CPLEX object. I did the following experiment
Root node processing (before b&c):
Real time = 0.00 sec. (0.25 ticks)
Sequential b&c:
Real time = 0.00 sec. (0.00 ticks)
------------
Total (root+branch&cut) = 0.00 sec. (0.25 ticks)
ERROR: CPLEX: error getting error message(!)
Stacktrace:
[1] get_error_msg(::CPLEX.Env, ::Int32) at /home/canl1/.julia/v0.6/CPLEX/src/cpx_env.jl:71
[2] Type at /home/canl1/.julia/v0.6/CPLEX/src/cpx_env.jl:89 [inlined]
[3] optimize!(::CPLEX.Model) at /home/canl1/.julia/v0.6/CPLEX/src/cpx_solve.jl:11
[4] optimize!(::CPLEX.CplexMathProgModel) at /home/canl1/.julia/v0.6/CPLEX/src/CplexSolverInterface.jl:191
[5] #solve#116(::Bool, ::Bool, ::Bool, ::Array{Any,1}, ::Function, ::JuMP.Model) at /home/canl1/.julia/v0.6/JuMP/src/solvers.jl:175
[6] solve(::JuMP.Model) at /home/canl1/.julia/v0.6/JuMP/src/solvers.jl:150
I would appreciate it if you can share some solutions to this problem. Thanks!
using JuMP
using CPLEX
m = Model(solver=CplexSolver())
@variable(m, x[i in 1:2], Bin)
@objective(m, Min, x[1] + x[2])
priorities = [1, 2]
model_indices = [1, 2]
CPLEX.set_branching_priority(m.internalModel.inner, model_indices, priorities)
The error is
ERROR: LoadError: type Void has no field inner
Stacktrace:
[1] include_from_node1(::String) at ./loading.jl:576
[2] include(::String) at ./sysimg.jl:14
[3] process_options(::Base.JLOptions) at ./client.jl:305
[4] _start() at ./client.jl:371
while loading /home/canl1/work/learnbranching/temp.jl, in expression starting on line 8
I was wondering if the CPLEX.set_branching_priority function still exists in the latest versions please?
I tried running the suggested codes but I always get