Python API ignores default Solver?

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

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_GamsCall.html#UG_GamsCall_OrderOfPrecedence

-Michael

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.

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

Thank you, that’s good to know.