Integer variables

Top  Previous  Next

These can take on integer values between specified lower and upper bounds where note the default upper bound is 100.  Integer variables are declared as follows,

 

Integer Variable s1(i), t1(k,j), w1(i,k,j) ;

Example:

(basint.gms)

POSITIVE VARIABLE       X1

INTEGER VARIABLE        X2

BINARY VARIABLE         X3

VARIABLE                OBJ

EQUATIONS               OBJF

                        X1X2

                        X1X3;

OBJF..     7*X1-3*X2-10*X3 =E= OBJ;

X1X2..     X1-2*X2 =L=0;

X1X3..     X1-20*X3 =L=0;

x2.up=125;

option optcr=0.01;

MODEL IPTEST /ALL/;

SOLVE IPTEST USING MIP MAXIMIZING OBJ;

Notes:

These variables are automatically bounded by GAMS so they have a default upper bound of 100.  If the user wishes the integer variables to take on values greater than 100, a larger bound must be specified.
A lower bound of zero is automatically generated.  This may also be changed.
Priorities (.prior attributes of variables) can be used to override binary specifications as discussed below.