Cplex parameters for Benders Algorithm could not be reconized in JuMP

jump

#1

Hi,
I am tryting to use the build in Benders Decomposition in Cplex to solve problems, but the parameter key words couldn’t be reconized. It seems JuMP can only reconize key words in their old names (the version before V12.6). So I was wondering if I made any mistakes installing packages or it is the case that new key word names have not been supported.
Thanks.


#2

It looks like CPLEX.jl has already been updated for v12.7.1: https://github.com/JuliaOpt/CPLEX.jl/pull/131

What version of CPLEX.jl do you have? And could you please post how you’re trying to pass the parameters and what the error is?


#3

Thank you so much for your reply. I’ve tried to update my packages and they should be the latest ones. The versions of packages I am using are

CPLEX.jl: 0.2.8
JuMP.jl: 0.18.0

When I build the model using new parameter names, like

m=Model(solver=CplexSolver(CPXPARAM_MIP_Tolerances_Integrality=1e-6))

It will show the following error

KeyError: key “CPXPARAM_MIP_Tolerances_Integrality” not found
Stacktrace:
[1] getindex at .\dict.jl:474 [inlined]
[2] set_param!(::CPLEX.Env, ::String, ::Float64) at C:\Users\T.julia\v0.6\CPLEX\src\cpx_params.jl:56
[3] #CplexMathProgModel#28(::Int32, ::Array{Any,1}, ::Type{T} where T) at C:\Users\T.julia\v0.6\CPLEX\src\CplexSolverInterface.jl:22
[4] (::Core.#kw#Type)(::Array{Any,1}, ::Type{CPLEX.CplexMathProgModel}) at .<missing>:0
[5] LinearQuadraticModel(::CPLEX.CplexSolver) at C:\Users\T.julia\v0.6\CPLEX\src\CplexSolverInterface.jl:33
[6] #build#119(::Bool, ::Bool, ::JuMP.ProblemTraits, ::Function, ::JuMP.Model) at C:\Users\T.julia\v0.6\JuMP\src\solvers.jl:356
[7] (::JuMP.#kw##build)(::Array{Any,1}, ::JuMP.#build, ::JuMP.Model) at .<missing>:0
[8] #solve#116(::Bool, ::Bool, ::Bool, ::Array{Any,1}, ::Function, ::JuMP.Model) at C:\Users\T.julia\v0.6\JuMP\src\solvers.jl:168
[9] solve(::JuMP.Model) at C:\Users\T.julia\v0.6\JuMP\src\solvers.jl:150
[10] include_string(::String, ::String) at .\loading.jl:515

When I use the names prior to V12.6, like

m=Model(solver=CplexSolver(CPX_PARAM_EPINT=1e-6))

It will work well.

The names of parameters are found here
https://www.ibm.com/support/knowledgecenter/SS9UKU_12.7.0/com.ibm.cplex.zos.help/CPLEX/Parameters/topics/EpInt.html


#4

Ah, I understand, thanks!

I don’t have CPLEX installed, so I can’t actually test this, but I’ve pushed some (untested) changes to this branch: https://github.com/rdeits/CPLEX.jl/tree/new-params

With those changes, I believe you can do:

CplexSolver(Dict(CPLEX.CPXPARAM_MIP_Tolerances_Integrality=>1e-6))

please let me know if that works.


#5

Hi, sorry for my late reply, but I am a little bit confused about what should I do. Shall I update CPLEX.jl and then build my model as follow

m=Model(solver=CplexSolver())
CplexSolver(Dict(CPLEX.CPXPARAM_MIP_Tolerances_Integrality=>1e-6))

or I misunderstand your meaning?


#6

You’ll want to check out the branch of CPLEX.jl that I linked (you will have to do this manually using git, not through the Julia package manager, sorry), and then you’ll want to do:

m = Model(solver=CplexSolver(Dict(CPLEX.CPXPARAM_MIP_Tolerances_Integrality=>1e-6)))

#7

Thank you for your explanation. I hope I did the right thing. I downloaded the files from the link you shared, replaced the files in my CPLEX.jl folder and build the package. Then do

m=Model(solver=CplexSolver(Dict(CPLEX.CPXPARAM_MIP_Tolerances_Integrality=>1e-6)))

But this results in the following errors

TypeError: as_kwargs: in typeassert, expected Symbol, got Int32
Stacktrace:
[1] as_kwargs(::Dict{Int32,Float64}) at .\essentials.jl:343
[2] LinearQuadraticModel(::CPLEX.CplexSolver) at C:\Users\T.julia\v0.6\CPLEX\src\CplexSolverInterface.jl:33
[3] #build#119(::Bool, ::Bool, ::JuMP.ProblemTraits, ::Function, ::JuMP.Model) at C:\Users\T.julia\v0.6\JuMP\src\solvers.jl:356
[4] (::JuMP.#kw##build)(::Array{Any,1}, ::JuMP.#build, ::JuMP.Model) at .<missing>:0
[5] #solve#116(::Bool, ::Bool, ::Bool, ::Array{Any,1}, ::Function, ::JuMP.Model) at C:\Users\T.julia\v0.6\JuMP\src\solvers.jl:168
[6] solve(::JuMP.Model) at C:\Users\T.julia\v0.6\JuMP\src\solvers.jl:150
[7] include_string(::String, ::String) at .\loading.jl:515


#8

Ah, sorry, this is what happens when I write code I can’t test locally.

Somewhere (probably in the LinearQuadraticModel() function at CplexSolverInterface.jl line 33), the type of the options dictionary is being asserted as Dict{Symbol}, but the change I suggested actually changes some of the keys to be integers. That type assertion will have to be modified, but it’s difficult for me to do that remotely. This should be very possible for you to fix, though.

Although, realistically, it might be better to open an issue with CPLEX.jl asking for support for these keyword forms rather than me trying to guide your debugging from afar :slight_smile:


#9

Yeah, it is very difficult for you to guide me remotely. I will try to figure out how to do it on git. Thank you so much for helping me.