I have a MILP problem and I am trying to solve it using CPLEX package through JuMP in Julia Language. However, the problem takes a long time to be solved. Is there a way to stop the program and return decision variables when the optimality gap reaches for example 10%. Thank you.

# Stop Julia at certain optimiality gap and return decision variables

**rdeits**#2

I havenâ€™t used CPLEX, but I believe you can do:

```
m = Model(solver=CplexSolver(CPX_PARAM_EPGAP=1e-2))
```

or

```
setsolver(m, CplexSolver(CPX_PARAM_EPGAP=1e-2))
```

**rdeits**#3

(the above assumes you are using CPLEX through JuMP, which I just realized you didnâ€™t actually say).

**Rajat_Sanyal**#6

Hi @rdeits,

I am using Julia 1.1.0 and following packages:

â€śClpâ€ť => v"0.6.1"

â€śAtomâ€ť => v"0.7.14"

â€śCPLEXâ€ť => v"0.4.3"

â€śJuMPâ€ť => v"0.19.0"

â€śJunoâ€ť => v"0.5.4"

â€śCondaâ€ť => v"1.2.0"

â€śExcelReadersâ€ť => v"0.10.3"

â€śMathProgBaseâ€ť => v"0.7.7"

â€śXLSXâ€ť => v"0.4.6"

â€śCbcâ€ť => v"0.6.0"

â€śDataFramesâ€ť => v"0.17.1".

I am trying to set `m = Model(solver=CplexSolver(CPX_PARAM_EPGAP=1e-2))`

, but I am getting the following error:

`The solver= keyword is no longer available in JuMP 0.19 and later.`

However, they are suggesting a link for the reference which is somehow not a valid link.

Any help in this regard would be highly appreciated. Also, could you please share any link where I can find how to set different stopping criteria for the CPLEX solver through JuMP?

**odow**#7

JuMP has been updated.

The new syntax is

```
m = Model(with_optimizer(CPLEX.Optimizer, CPX_PARAM_EPGAP=1e-2))
```

**Rajat_Sanyal**#8

Thanks, @odow . Any idea where can I find the list of keywords to set the stopping criteria, example: absolute MIP gap, relative MIP gap, time etc.? Also, is there a way to set a warm start?

**odow**#9

The list of CPLEX parameters can be found here: https://www.ibm.com/support/knowledgecenter/en/SS9UKU_12.8.0/com.ibm.cplex.zos.help/CPLEX/Parameters/topics/introListAlpha.html

Warmstarts can set set using

These were mistakenly missing from the docs: https://github.com/JuliaOpt/JuMP.jl/issues/1871

**NiclasMattsson**#10

Youâ€™ll soon discover that itâ€™s extremely clunky to navigate the parameter list using the web interface. Luckily IBM also makes a nice easily searchable PDF of the whole thing, but to my knowledge they donâ€™t actually link to it anywhere. Some time ago I googled my way to an old version and then found the latest one by just modifying the URL:

By the way, I think the old parameter names are being deprecated. So if you want to future proof your code you may want to use the newer more verbose names, e.g. `CPXPARAM_MIP_Tolerances_MIPGap`

instead of `CPX_PARAM_EPGAP`

.