GAMS-dev / gams.jl

A MathOptInterface Optimizer to solve JuMP models using GAMS
MIT License
34 stars 3 forks source link

Add an external option file #21

Closed ds2010 closed 1 year ago

ds2010 commented 1 year ago

Hi,

Is it possible to add an external option file (e.g., conopt.opt) in gams.jl by using the command set_optimizer_attribute or directly pass the options as we did in GAMS, e.g.,

$onecho > conopt.opt
lspret = false
$offecho

gmsmodel.optfile = 1;
Solve gmsmodel using [...];

Thanks!

renkekuhlmann commented 1 year ago

You can pass solver options via set_optimizer_attribute, yes. For example, do

set_optimizer_attribute(model, GAMS.Solver(), "conopt")
set_optimizer_attribute(model, "lspret", 0)

Note that it is important to specify the solver first. Otherwise the option is interpreted as GAMS option which would lead to an error as this isn't a GAMS option. GAMS.jl will create an option file for you in the background.

Does this work for you?

ds2010 commented 1 year ago

Yes, It works now. Thanks for your help!