Unable to use setparam for Xpress under JuMP

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!!

See Resetting TimeLimit of Gurobi Optimizer

This section of the Xpress README suggests something like:

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

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

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?

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.

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

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

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

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

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, 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.

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

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

  1. The new version of the Xpress bindings with JuMP is being discussed here: 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 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
    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.

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

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.