# How to Use GAMS

GAMS is licensed software. Documentation, Forums, and FAQs are available from the GAMS home page: http://www.gams.com/

GAMS is a language compiler and also a stable of integrated high-performance solvers. GAMS is able to solve complex, large scale modeling applications. A five-user license of GAMS is made available to the NREL users. The GAMS license requires users to be a member of a “workgroup.” If you find yourself with a need for the GAMS software, if you need a specific solver from GAMS, or if you have trouble running GAMS, please send an e-mail to HPC-Help.

Peregrine currently has GAMS versions up to 24.4.1 (64-bit) in production. To load GAMS, simply type “*module load gams*”. GAMS will run by typing “*gams [input filename]*”. A *[input filename].lst* file will be created as the output file.

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

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

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

A detailed tutorial for GAMS modeling can be found here.

The available solution procedures and the available solvers for GAMS are:

Solution Procedure | Description | Default Solver | Other Available Solvers |
---|---|---|---|

LP | Linear Programming | GUROBI | BDMLP CBC IPOPT OSICPLEX OSIGUROBI OSIMOSKE OSIXPRESS SOPLEX |

MIP | Mixed Integer Programming | GUROBI | BDMLP BONMIN CBC OSICPLEX OSIGUROBI OSIMOSKE OSIXPRESS SCIP |

RMIP | Relaxed Mixed Integer Programming | GUROBI | BDMLP CBC IPOPT OSICPLEX OSIGUROBI OSIMOSKE OSIXPRESS SOPLEX |

NLP | Nonlinear Programming | SCIP | COUENNE IPOPT |

MCP | Mixed Complementarity Problems | NLPEC | MILES |

MPEC | Mathematical Programs with Equilibrium Constraints | NLPEC | |

RMPEC | Relaxed Mathematical Program with Equilibrium Constraints | NLPEC | |

CNS | Constrained Nonlinear Systems | SCIP | COUENNE IPOPT |

DNLP | Non-Linear Programming with Discontinuous Derivatives | SCIP | COUENNE IPOPT |

RMINLP | Relaxed Mixed Integer Non-Linear Programming | SCIP | COUENNE IPOPT |

MINLP | Mixed Integer Non-Linear Programming | SCIP | BONMIN COUENNE |

QCP | Quadratic Constraint Programming | GUROBI | COUENNE IPOPT SCIP |

MIQCP | Mixed Integer Quadratic Constraint Programming | GUROBI | BONMIN COUENNE SCIP |

RMIQCP | Relaxed Mixed Integer Quadratic Constraint Programming | GUROBI | COUENNE IPOPT SCIP |

EMP | Extended Mathematical Programming | JAMS | LOGMIP |

By typing “*gams [input filename]*” on the command line, a default solver will be used. In order to override the default solver, 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.

or

[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 #PBS -N gams_run #PBS -l nodes=1:ppn=24 #PBS -l walltime=00:05:00 #PBS -q batch #PBS -m abe #PBS -M your.email@nrel.gov #PBS -e ./gams.err #PBS -o ./gams.out # Ensure script location if test -n "$PBS_O_WORKDIR" then echo "PBS workdir set, so changing to $PBS_O_WORKDIR" cd $PBS_O_WORKDIR fi # Create runtime environment module purge module load gams

# 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 is “*gurobi.opt*”. For the details of how to set those parameters, please refer to the solver description webpage: http://www.gams.com/solvers/index.htm

**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.**