# Unable to use setparam for Xpress under JuMP

**URL:** <https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [July 25, 2019, 5:10pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804 "2019-07-25T17:10:54Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diego](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Diego](https://discourse.julialang.org/u/Diego)\
**Post date:** [July 25, 2019, 5:10pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/1 "2019-07-25T17:10:54Z")

</div>

Team, I am trying to have Xpress report its log. When programming in Mosel I used:

setparam(“XPRS\_VERBOSE”,true)

Though I have tried many different things I am unable to do this with JuMP.

This is what I have tried last:

ucf=Model(with\_optimizer(Xpress.Optimizer))  
setparam(ucf,XPRS\_VERBOSE,true)

Any idea??

Thank you!!

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [July 25, 2019, 6:17pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/2 "2019-07-25T18:17:17Z")

</div>

See [Resetting TimeLimit of Gurobi Optimizer - #2 by blegat](https://discourse.julialang.org/t/resetting-timelimit-of-gurobi-optimizer/26627/2)

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [July 25, 2019, 7:43pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/3 "2019-07-25T19:43:25Z")

</div>

[This section](https://github.com/JuliaOpt/Xpress.jl#use-other-packages) of the Xpress README suggests something like:

```julia
Model(with_optimizer(Xpress.Optimizer, VERBOSE=true))

```

I don’t have access to Xpress so haven’t tried this.

---

<div class="post-metadata">

**Author:** ![Diego](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Diego](https://discourse.julialang.org/u/Diego)\
**Post date:** [July 26, 2019, 7:28am UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/4 "2019-07-26T07:28:30Z")

</div>

Thanks for the response, I am however still unable to make it work.

This is my model declaration:

ucf=Model(with\_optimizer(Xpress.Optimizer))

Based on your responses I have tried all these combinations, none of them work:

#setparam(ucf,XPRS\_VERBOSE,true)  
#Xpress.setparam!(backend(ucf).optimizer.model.inner, “XPRS\_VERBOSE”, true)  
#MOI.set(ucf, MOI.setparam(XPRS\_VERBOSE), 100.0);  
#setparam!(ucf, (XPRS\_VERBOSE, true))  
#setparam!(ucf, XPRS\_OUTPUTLOG, 0)  
#setparam(ucf,XPRS\_VERBOSE,true)  
#setparam(ucf,XPRS\_VERBOSE,false)

Any ideas?

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [July 26, 2019, 6:09pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/5 "2019-07-26T18:09:48Z")

</div>

The second one should work, please provide the error message as I don’t have Xpress available to test.  
Note that @mlubin’s solution is definitely the simplest one.

---

<div class="post-metadata">

**Author:** ![Diego](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Diego](https://discourse.julialang.org/u/Diego)\
**Post date:** [July 30, 2019, 5:20pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/6 "2019-07-30T17:20:27Z")

</div>

**With this wone I get:**  
setparam(ucf,XPRS\_VERBOSE,true)  
**UndefVarError: setparam not defined**  
in top-level scope at base\none

**With this wone I get:**  
setparam!(ucf,XPRS\_VERBOSE,true)  
**UndefVarError: XPRS\_VERBOSE not defined**  
in top-level scope at base\none

**With this wone I get:**  
Xpress.setparam!(backend(ucf).optimizer.model.inner, “XPRS\_VERBOSE”, true)  
**MethodError: no method matching setparam!(::Xpress.Model, ::String, ::Bool)**  
**Closest candidates are:  
setparam!(::Xpress.Model, !Matched::Symbol, ::Any) at C:\Users\Diego.juliapro\JuliaPro\_v1.1.1.1\packages\Xpress\Jdi4R\src\xprs\_params.jl:136  
setparam!(::Xpress.Model, !Matched::Int32, ::Any) at C:\Users\Diego.juliapro\JuliaPro\_v1.1.1.1\packages\Xpress\Jdi4R\src\xprs\_params.jl:139  
setparam!(::Xpress.Model, !Matched::Integer, ::Any) at C:\Users\Diego.juliapro\JuliaPro\_v1.1.1.1\packages\Xpress\Jdi4R\src\xprs\_params.jl:137  
…**  
in top-level scope at base\none

**With this wone I get:**  
setparam!(ucf, (XPRS\_VERBOSE, true))  
**UndefVarError: XPRS\_VERBOSE not defined**  
in top-level scope at base\none

**With this wone I get:**  
ucf=Model(with\_optimizer(Xpress.Optimizer, VERBOSE=true))  
**KeyError: key :VERBOSE not found**  
in top-level scope at base\none  
in Model at JuMP\jnmGG\src\JuMP.jl:217  
in #Model#5 at base\none  
in #set\_optimizer#76 at JuMP\jnmGG\src\optimizer\_interface.jl:38  
in at JuMP\jnmGG\src\JuMP.jl:116  
in at base\none  
in #Optimizer#31 at Xpress\Jdi4R\src\MOIWrapper.jl:56  
in getindex at base\dict.jl:478

**With this wone I get:**  
ucf=Model(with\_optimizer(Xpress.Optimizer, XPRS\_VERBOSE=true))  
**KeyError: key :XPRS\_VERBOSE not found**  
in top-level scope at base\none  
in Model at JuMP\jnmGG\src\JuMP.jl:217  
in #Model#5 at base\none  
in #set\_optimizer#76 at JuMP\jnmGG\src\optimizer\_interface.jl:38  
in at JuMP\jnmGG\src\JuMP.jl:116  
in at base\none  
in #Optimizer#31 at Xpress\Jdi4R\src\MOIWrapper.jl:56  
in getindex at base\dict.jl:478

---

<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:** [September 4, 2019, 9:50pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/7 "2019-09-04T21:50:00Z")

</div>

Hi @Diego,

I don’t have Xpress, so I’m not sure. But it looks like this might not be implemented in the Xpress wrapper at the moment. See: [https://github.com/JuliaOpt/Xpress.jl/issues/39#issuecomment-528102258](https://github.com/JuliaOpt/Xpress.jl/issues/39#issuecomment-528102258)

Once it is implemented, or for other parameters, this is the correct syntax:

```nohighlight
ucf=Model(with_optimizer(Xpress.Optimizer, VERBOSE=true))

```

---

<div class="post-metadata">

**Author:** ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Post date:** [September 5, 2019, 1:59am UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/8 "2019-09-05T01:59:32Z")

</div>

Hi @Diego,

That is nice that you are using JuMP and Xpress interface!  
The interface is community driven, let them (FICO - Xpress) know that you are using it.

Xpress does not have a `VERBOSE` key. The key you are looking for is probably `OUTPUTLOG`, its worth double checking in the manual if that is what you want.

Unfortunately, as described in the issue [https://github.com/JuliaOpt/Xpress.jl/issues/39](https://github.com/JuliaOpt/Xpress.jl/issues/39), that @odow posted this key won’t work properly on windows. If you are using windows you will need to use the logfile or create some callback if it is must to print in the screen. This is a limitation of the Xpress C API and not a limitation of julia, JuMP or the Xpress.jl wrapper.

---

<div class="post-metadata">

**Author:** ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Post date:** [September 5, 2019, 2:46am UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/9 "2019-09-05T02:46:28Z")

</div>

I update the Xpress.jl issue with a hint on how to use the log file.

---

<div class="post-metadata">

**Author:** ![Diego](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Diego](https://discourse.julialang.org/u/Diego)\
**Post date:** [September 22, 2019, 2:30pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/10 "2019-09-22T14:30:39Z")

</div>

This is great news.

Three questions:

1. When do you think the new JuMP that allows parameters passed at initialization on automatic mode will be released ?

2. Can you provide an example of callback to print the log

3. Finally, you mentioned XPRESS.jl uses Xpress C API, what is the performance of Xpress using Julia compared to the one of Python for which there is a native API?

Thank you!

Diego Luca de Tena

---

<div class="post-metadata">

**Author:** ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Post date:** [September 30, 2019, 2:24pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/11 "2019-09-30T14:24:35Z")

</div>

1. The new version of the Xpress bindings with JuMP is being discussed here: [https://github.com/JuliaOpt/Xpress.jl/pull/41](https://github.com/JuliaOpt/Xpress.jl/pull/41)

2. I don’t have an example now. however there is a callback example: [https://github.com/JuliaOpt/Xpress.jl/blob/master/test/cb\_intsol.jl](https://github.com/JuliaOpt/Xpress.jl/blob/master/test/cb_intsol.jl) and the function for the message callback is `set_callback_message!(model::Model, callback::Function)`, which is implemented in [https://github.com/JuliaOpt/Xpress.jl/blob/master/src/xprs\_callbacks.jl](https://github.com/JuliaOpt/Xpress.jl/blob/master/src/xprs_callbacks.jl)  
We will work on that after 1 is completed

3. I never used the python API. I know that the julia raw API has basically performance penalty compared do the C API.

---

<div class="post-metadata">

**Author:** ![Diego](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Diego](https://discourse.julialang.org/u/Diego)\
**Post date:** [October 1, 2019, 8:04am UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/12 "2019-10-01T08:04:58Z")

</div>

Thanks, how big do you think is the performance penalty of Julia?

---

<div class="post-metadata">

**Author:** ![joaquimg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joaquimg/32/223_2.png) [@joaquimg](https://discourse.julialang.org/u/joaquimg)\
**Post date:** [October 1, 2019, 1:13pm UTC](https://discourse.julialang.org/t/unable-to-use-setparam-for-xpress-under-jump/26804/13 "2019-10-01T13:13:52Z")

</div>

If you are using the low level API the penalty is negligible compared to the C API.

If you are using JuMP, then building models is a bit slower (I have no recent timings). On the other hand, its super easy to write, solve and query models. From personal experience, my programs require very efficient model building and JuMP is not a problem at all, actually it made it much easier the develop and maintain the program.
