If you’ve not used an option file before, create a new file of that name and save it in the same directory as your GAMS source file. If you want the options to appear in your GAMS source code, you can use the following code fragment as an example (with an option file for baron as example):
Model process /all/ ; Option MINLP = BARON; $onecho > baron.opt lpsol 2 nlpsol 2 $offecho process.OptFile = 1; Solve process maximizing pr using minlp ;
The option file that is being used is
solvername is the name of the solver that is
Do not forget to “tell” the solver to read the options file by adding a line
m.OptFile = 1; to you GAMS model right before your
Solve statement (m is the name of your model). You can also add
OptFile 1 to the parameter field of the GAMS IDE or at the command line.
The log will indicate whether an option file was used:
... --- Executing BARON ... --- Using Option File Reading parameter(s) from "D:\temp\baron.opt" >> lpsol 2 >> nlpsol 2 ...
To allow different option file names for the same solver, the modelname.OPTFILE parameter can take other values as well. Formally, the rule is M.OPTFILE = n will use solvename.opt if n=1, and solvername.opX, solvername.oXX or solvername.XXX, where x's are the characters representing the value of n for n > 1 and will use no option file at all for n = 0. This scheme implies an upper bound on n of 999. For example,
M.OPTFILE = 2the option file is
M.OPTFILE = 26the option file is
M.OPTFILE = 345the option file is
You’ll find the complete documentation about the solver option file at https://www.gams.com/latest/docs/UG_SolverUsage.html#BASIC_USAGE_SOLVER_OPTION_FILE
Note: Starting with Distribution 22.4 the GAMSIDE includes an option editor, which gives you access to all solver options and can generate an option file. To access the option editor within the GAMSIDE goto: Utilities –> Options Editor