# Cplex parameters for Benders Algorithm could not be reconized in JuMP

**URL:** <https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [October 16, 2017, 8:31pm UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487 "2017-10-16T20:31:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wei\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wei_wang/32/15032_2.png) [@Wei\_Wang](https://discourse.julialang.org/u/Wei_Wang)\
**Post date:** [October 16, 2017, 8:31pm UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487/1 "2017-10-16T20:31:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [October 17, 2017, 5:57pm UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487/2 "2017-10-17T17:57:36Z")

</div>

It looks like CPLEX.jl has already been updated for v12.7.1: [https://github.com/JuliaOpt/CPLEX.jl/pull/131](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?

---

<div class="post-metadata">

**Author:** ![Wei\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wei_wang/32/15032_2.png) [@Wei\_Wang](https://discourse.julialang.org/u/Wei_Wang)\
**Post date:** [October 18, 2017, 12:55am UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487/3 "2017-10-18T00:55:23Z")

</div>

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](https://www.ibm.com/support/knowledgecenter/SS9UKU_12.7.0/com.ibm.cplex.zos.help/CPLEX/Parameters/topics/EpInt.html)

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [October 18, 2017, 2:48am UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487/4 "2017-10-18T02:48:57Z")

</div>

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](https://github.com/rdeits/CPLEX.jl/tree/new-params)

With those changes, I believe you can do:

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

```

please let me know if that works.

---

<div class="post-metadata">

**Author:** ![Wei\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wei_wang/32/15032_2.png) [@Wei\_Wang](https://discourse.julialang.org/u/Wei_Wang)\
**Post date:** [October 18, 2017, 4:18pm UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487/5 "2017-10-18T16:18:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [October 18, 2017, 5:40pm UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487/6 "2017-10-18T17:40:23Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![Wei\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wei_wang/32/15032_2.png) [@Wei\_Wang](https://discourse.julialang.org/u/Wei_Wang)\
**Post date:** [October 18, 2017, 7:25pm UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487/7 "2017-10-18T19:25:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [October 18, 2017, 9:54pm UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487/8 "2017-10-18T21:54:36Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Wei\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wei_wang/32/15032_2.png) [@Wei\_Wang](https://discourse.julialang.org/u/Wei_Wang)\
**Post date:** [October 18, 2017, 11:51pm UTC](https://discourse.julialang.org/t/cplex-parameters-for-benders-algorithm-could-not-be-reconized-in-jump/6487/9 "2017-10-18T23:51:58Z")

</div>

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.
