The General Algebraic Modeling System

Authors: GAMS Development Corporation
Anthony Brooke
David Kendrick
Alexander Meeraus
Ramesh Raman

GAMS Development Corporation
1217 Potomac Street NW
Washington, DC 20007
Phone: (202) 342 0180, Fax: (202) 342 0181


GAMS is a high level modeling language for formulating models with concise algebraic statements that are easily read by modelers.

The GAMS language is formally similar to commonly used programming languages. It is therefore familiar to anyone with programming experience.

Using GAMS, data are entered only once in familiar list and table form. Models are described in concise algebraic statements which are easy for both humans and machines to read. Whole sets of closely related constraints are entered in one statement. GAMS automatically generates each constraint equation, and lets the user make exceptions in cases where generality is not desired. Statements in models can be reused without having to change the algebra when other instances of the same or related problems arise. The location and type of errors are pinpointed before a solution is attempted. GAMS handles dynamic models involving time sequences, lags and leads and treatment of temporal endpoints.

Structure of GAMS programs

GAMS programs consist of one or more statements that define data structures, initial values,data modification,and symbolic relationships (equations). While there is no fixed order in which statements have to be arranged, the order in which data modifications are carried out is important. Symbols must be declared as to type before they are used, and must have values assigned before they are used. Each statement is followed by semicolon except the last statement, where a semicolon is optional.

A GAMS program can be organized in three parts:

The two most common ways of organizing GAMS programs result by change above order inter MODEL part and DATA part.

Clasifications of GAMS statements

Each statement in GAMS is classified into one of two groups:

A declaration statement describes the class of symbol. Often initial values are provided in declaration, and then it may be called a definition. The specification of symbolic relationships for an equation is a definition.

Execution statements are instructions to carry out actions such as data transformation, model solution, and report generation.

Data types and definition

Set definitions

Sets are fundamental building blocks in any GAMS model. There are some more advanced set concepts, such as assignments to sets as well as lag and lead operations. GAMS language have simple sets, dinamic sets with multiple indices, ordered and unordered sets. There are set operations : union, intersection, complement, difference.


Tabular data can be declared and initialized in GAMS using table statement. For 2 si higher dimensional parameters this provides a more concise and easier method of data entry than the list based approach, since each label appears only once 9at least in small tables).


GAMS provides commonly used standard functions such as exponentiation, and logarithmic, and trigonometric functions.