Download gams a user's guide
Transcript
8
EQUATIONS
8.1 INTRODUCTION
Equations are the GAMS names for the symbolic algebraic relationships that will be used to
generate the constraints in the model. As with variables, one GAMS Equation will map into
arbitrarily many individual constraints, depending on the membership of the defining sets.
8.2 EQUATION DECLARATIONS
A GAMS equation, like all identifiers, must be declared before it can be used.
8.2.1 THE SYNTAX
The declaration of an equation is similar to a set or parameter declaration, in that domain
lists and explanatory text are allowed and recommended, and several equations can be declared
in one statement.
Equation[s] eqn_name text {, eqn_name} ;
eqn_name is the internal name of the equation (an identifier) in GAMS. An identifier has to
start with a letter followed by more letters or digits. It can only contain alphanumeric characters,
and can be up to 10 characters long. The accompanying text is used to describe the set or element
immediately preceding it. This must not exceed 80 characters and must all be contained on the
same line as the identifier it describes.
There are no modifying keywords as there are with variables, and no initializing data list as there
may be with parameters or sets.
8.2.2 AN ILLUSTRATIVE EXAMPLE
The example is adapted from [PRODSCH] , an inventory and production management problem.
The relevant set definitions are also shown
sets
q
s
'quarters'
'shifts'
/ summer,fall,winter,spring /
/ first,second /;
equations
cost
'total cost definition'
invb(q)
'inventory balance'
sbal(q,s) 'shift employment balance'
;
The declaration of the first equation follows the keyword equations. This declaration begins
with the name of the equation, in this case cost, and is followed by the text, namely 'Total
cost definition'. The equation cost above is a scalar equation, which will produce at
most one equation in the associated optimization problem.