Skip to main content

Using the General Algebraic Modeling System on Eagle

The General Algebraic Modeling System (GAMS) is a commercial high-level modeling system for mathematical programming and optimization. It is licensed software.

GAMS includes a DSL compiler and also a stable of integrated high-performance solvers. GAMS is able to solve complex, large-scale modeling problems. For documentation, forums, and FAQs, see the GAMS website.

A 40-user license of GAMS is made available to Eagle users. The GAMS license requires users to be a member of a "workgroup." If you need the GAMS software or a specific solver from GAMS, or if you have trouble running GAMS, please contact us.

Initializing Your Environment

To initialize your environment to use GAMS, simply type module load gams/<version> — see module avail gams output to see available versions on Eagle. GAMS is run with the command format gams <input filename>. A file <input filename>.lst will be created as the output file.

For a test run, in your home directory, type the following:

module load gams/<version>
cp /nopt/nrel/apps/gams/example/trnsport.gms .
gams trnsport

A result of 153.675 should be found from screen output. More detailed output is in the file trnsport.lst.

Selecting an Alternative Solver

By typing gams <input_filename> on the command line, the default solver (CPLEX) will be used. In order to override the default option to use, e.g., Gurobi, you can try the following two methods:

[1]  Use the option statement in your GAMS input file. For example, if your model input uses LP procedure and you want to use Gurobi solver to solve it, just add "option lp=gurobi" to your input file.


[2]  Specify the solver in the command line, e.g., gams <input_filename> lp=gurobi.

A sample script for batch submission is provided here:

#!/bin/bash --login
#SBATCH --name gams_run
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=36 #SBATCH --time=00:05:00 #SBATCH --account=<allocation-id> #SBATCH --error=gams-%j.err #SBATCH --output=gams-%j.out   # Ensure script location cd $SLURM_SUBMIT_DIR   # Create runtime environment module purge module load gams/<version>

# Run GAMS gams trnsport lp=gurobi

For a certain solver, necessary control parameters for the algorithm—such as convergence criteria—can be loaded from the option file named as <solver_name>.opt in the directory that you run GAMS. For example, for the Gurobi solver, its option file would be "gurobi.opt". For the details of how to set those parameters, please see the GAMS Solver Manuals.

Important: When using the Gurobi solver in GAMS, the user should NOT try to load the Gurobi module. Simply using "module load gams" will automatically load the Gurobi solver.