# Cplex.jl change parameters and display info

**URL:** https://discourse.julialang.org/t/cplex-jl-change-parameters-and-display-info/40821
**Category:** Optimization (Mathematical)
**Tags:** question
**Created:** [June 5, 2020, 4:18pm UTC](https://discourse.julialang.org/t/cplex-jl-change-parameters-and-display-info/40821 "2020-06-05T16:18:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![geoffroyleconte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/geoffroyleconte/32/21661_2.png) [@geoffroyleconte](https://discourse.julialang.org/u/geoffroyleconte)
#### Post date: [June 5, 2020, 4:18pm UTC](https://discourse.julialang.org/t/cplex-jl-change-parameters-and-display-info/40821/1 "2020-06-05T16:18:07Z")

</div>

Hello,  
I am trying to use cplex.jl to solve linear problems without using JuMP or MOI. I want to use the barrier method without presolve and crossover/vertex, so I used these commands:

> ```
> CPLEX.set_param!(env, "CPX_PARAM_MIPCBREDLP", 0) 
> CPLEX.set_param!(env, "CPXPARAM_Barrier_Algorithm", 0)
> 
> ```

Are these commands correct, and is there a way to be sure they are doing what I want, using some display messages?  
Thanks

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [June 5, 2020, 7:21pm UTC](https://discourse.julialang.org/t/cplex-jl-change-parameters-and-display-info/40821/2 "2020-06-05T19:21:58Z")

</div>

CPLEX.jl wraps CPLEX’s C API. You can find the full documentation at:

> **[List of CPLEX parameters](https://www.ibm.com/docs/en/icos/12.10.0?topic=cplex-list-parameters)**
>
> CPLEX parameters, documented here alphabetically by name in the Callable Library (C API), are available in the C++, Java, .NET, and Python APIs, as well as in the Interactive Optimizer and the MathWorks MATLAB connector.

For example, the documentation for `CPX_PARAM_MIPCBREDLP` can be found:

> **[MIP callback switch between original model and reduced, presolved model](https://www.ibm.com/docs/en/icos/12.10.0?topic=lcp-mip-callback-switch-between-original-model-reduced-presolved-model)**
>
> Controls whether your callback accesses node information of the original model (off) or node information of the reduced, presolved model (on, default).

I don’t think this is what you want because it is about callbacks.

Instead, you’re probably looking for:

> **[presolve switch](https://www.ibm.com/docs/en/icos/12.10.0?topic=parameters-presolve-switch)**
>
> Decides whether CPLEX applies presolve during preprocessing.

---

<div class="post-metadata">

### Author: ![mtanneau](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mtanneau/32/17787_2.png) [@mtanneau](https://discourse.julialang.org/u/mtanneau)
#### Post date: [June 6, 2020, 5:25pm UTC](https://discourse.julialang.org/t/cplex-jl-change-parameters-and-display-info/40821/3 "2020-06-06T17:25:44Z")

</div>

This is the setting I use for solving problems with barrier, no presolve, no crossover.  
Hope it can be useful.

```julia
CPXENV = CPLEX.Env() # create CPLEX environment

# Set parameters
CPLEX.set_param!(CPXENV, "CPXPARAM_ScreenOutput", 1) # Enable output
CPLEX.set_param!(CPXENV, "CPXPARAM_TimeLimit", 3600) # Time limit
CPLEX.set_param!(CPXENV, "CPXPARAM_Threads", 1) # Single thread
CPLEX.set_param!(CPXENV, "CPXPARAM_SolutionType", 2) # No crossover
CPLEX.set_param!(CPXENV, "CPXPARAM_LPMethod", 4) # Use barrier
CPLEX.set_param!(CPXENV, "CPXPARAM_Preprocessing_Presolve", 0) # No presolve

...

```

CPLEX should display non-default parameters values at the beginning of the optimization.  
For the above case, you should see something like this in the log:

```julia
...
CPXPARAM_Preprocessing_Presolve 0
CPXPARAM_LPMethod 4
CPXPARAM_Threads 1
CPXPARAM_SolutionType 2
CPXPARAM_TimeLimit 3600
...

```

FWIW, I’ve observed that CPLEX still performs a “reduced presolve”, even with the `CPXPARAM_Preprocessing_Presolve` set to `0`.

As odow points out, the answer to all these questions will be in CPLEX’s documentation, there’s nothing additional that’s done in the Julia wrapper.

---

<div class="post-metadata">

### Author: ![geoffroyleconte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/geoffroyleconte/32/21661_2.png) [@geoffroyleconte](https://discourse.julialang.org/u/geoffroyleconte)
#### Post date: [June 8, 2020, 9:16am UTC](https://discourse.julialang.org/t/cplex-jl-change-parameters-and-display-info/40821/4 "2020-06-08T09:16:46Z")

</div>

Thank you!

---

<div class="post-metadata">

### Author: ![geoffroyleconte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/geoffroyleconte/32/21661_2.png) [@geoffroyleconte](https://discourse.julialang.org/u/geoffroyleconte)
#### Post date: [June 8, 2020, 9:19am UTC](https://discourse.julialang.org/t/cplex-jl-change-parameters-and-display-info/40821/5 "2020-06-08T09:19:04Z")

</div>

Thank you this is what I was looking for!
