Page 1 of 1

Python API ignores default Solver?

Posted: Fri Aug 04, 2023 6:14 pm
by simcikr
Hello,

I'm trying to run a GAMS model with default options via the Python API.
The file optgams.def defines the default solver for LP models as Gurobi:

*
* optgams.def
*

LP string 0 "gurobi" 1 3 Linear Programming - default solver
etc.

However, the solve output starts with:

--- Job ModeleGAMS.gms Start 08/04/23 17:44:58 44.1.0 ab065035 WEX-WEI x86 64bit/MS Windows
--- Applying:
C:\GAMS\44\gmsprmNT.txt
--- GAMS Parameters defined
LP CPLEX
MIP CPLEX
etc.

And indeed, CPlex is used instead of Gurobi:

--- Executing CPLEX (Solvelink=5): elapsed 0:01:08.368

IBM ILOG CPLEX 44.1.0 ab065035 Jul 20, 2023 WEI x86 64bit/MS Window
etc.

I know I can change the solver, either in the GAMS code by using option lp=... or in the Python code by using GamsOptions.
My question is: is the above the intended behaviour? Personally I would expect the GAMS Python API to use the default solver specified in optgams.def rather than the "default default solver" (CPlex).
Just to be clear, when I run the same model via the GUI (studio) instead of the Python API, it uses the Gurobi solver as expected.

Best,
Roman

Re: Python API ignores default Solver?

Posted: Tue Aug 08, 2023 9:33 am
by bussieck
There are many ways to change options in GAMS, changing optgams.def is not one of them. Please read this part of the docs: https://www.gams.com/44/docs/UG_GamsCal ... Precedence

-Michael

Re: Python API ignores default Solver?

Posted: Wed Aug 30, 2023 6:50 pm
by simcikr
OK thanks for the answer.
The GAMS installation notes actually explain how to view and modify the default solvers: https://www.gams.com/44/docs/UG_WIN_INSTALL.html
This leaves me with the following question: what is the use of the optgams.def file? I remember that we used to use this file in the past to modify the default ResLim (which used to be 1024 seconds in older GAMS versions if I'm not mistaken) to higher values.

Re: Python API ignores default Solver?

Posted: Mon Sep 04, 2023 8:38 am
by bussieck
The optgams.def file is a file to let e.g. Studio know what options GAMS accepts and what their default values are. The GAMS documentation never had anything on adjusting the file. It is for pure internal use and editing might have some unexpected results.

-Michael

Re: Python API ignores default Solver?

Posted: Fri Sep 08, 2023 8:47 am
by simcikr
Thank you, that's good to know.