Performance World [ Performance World Home | Board | Tools | PerformanceLib | Links | Gams World Forum | Search | Contact ]

Creating automated batch run files

The Performance Tool batch file creation utility, crbatch.gms, is useful if users wish to create batch files consisting of GAMS runs for Users specify the models to be included in the batch file via a text file containing the model names.

Some guidelines for the model file. The model file

The utility can also be run online using the PAVER Server.

The batch file created by crbatch.gms is a GAMS job which runs other GAMS jobs using the $call gams command. It is not a Windows batch (.bat) script. Thus batch files created using crbatch.gms are platform independent.


Sample Output:

Using crbatch.gms

The batch file creation utility makes use of the --option to initialize environment variables from the command line. You must have a GAMS system 20.1 or later installed. See the GAMS 20.1 release notes for details on this feature.

The general command for crbatch.gms is:

>>   gams crbatch.gms --batfile=(output filename) --gmsopts=(GAMS options) --iterlim=(GAMS iterlim) --modelfile=(file containing model names) --optfile=(1 for optfile use) --optca=(GAMS optca) --optcr=(GAMS optcr) --outdir=(.LST and .LOG output directory) --reslim=(GAMS reslim) --solver=(solvername) --type=(model type)

All of the --options are not required, that is if ommitted they are set to default options as described in the next section. A sample call is:

>>   gams crbatch --modelfile=tiny_mod.txt --batfile=samplebat --gmsopts="lo=2" --solver=bdmlp --type=lp

This will create a batch file called samplebat.gms consisting of all models in the tiny_mod.txt --modelfile (these are all of the tiny models from the LinLib collection). The solver used is BDMLP and the GAMS user option is lo=2. In order to run the batch file created, run as a regular GAMS model. In this case:

>>   gams samplebat

User can specify multiple entries within one --option. For example, users may want to run all tiny and small models. The commands differ slightly for Windows and UNIX:


Under Windows multiple entries can be inputted using quotes ("). For example

>>   gams crbatch --modelfile=tiny_mod.txt --gmsopts="lo=2 lf=output.log"


Under UNIX multiple entries can be inputted using the escape and quote sequence (\"). For example

>>   gams crbatch --modelfile=tiny_mod.txt --gmsopts=\" lo=2 lf=output.log \"

A sample batch.gms output:


List of crbatch.gms --options and defaults

Option Input Type Description Default
--batfile Text Output batch filename. File will automatically have .gms extension. batch
--gmsopts Text GAMS command line options. Users can spcify multiple entries. The command differs slightly for Windows and for UNIX. For example, if users wish to create a tracefile called trace.trc with trace option 3, users would specify for Windows:
  --gmsopts="trace=trace.trc traceopt=3"
  --gmsopts=\"trace=trace.trc traceopt=3\"
--iterlim Text GAMS iterlim (solver iteration limit). none (i.e. GAMS default)
--modelfile Text Model file containing modelnames. A sample modelfile is tiny_mod.txt. containing all tiny sized LPs. none given
--optca Text GAMS optca (absolute optimality tolerance for discrete models). none (i.e. GAMS default)
--optcr Text GAMS optcr (relative optimality tolerance for discrete models). none (i.e. GAMS default)
--optfile Text GAMS optfile (solver option file indicator). none (i.e. GAMS default)
--outdir Text Output directory for .LST and .LOG files. If the directory doesn't exist, it is created. none
--reslim Text GAMS reslim (resource time limit). none (i.e. GAMS default)
--solver Text Solver(s) to be used. In general, it is advised to only use one solver for each tracefile created. If multiple solvers are desired, then these can be inputted using
for Windows or
for UNIX.
--type Text Model type. LP