Variable attributes

Top  Previous  Next

Variables have attributes that can be used in specifying bounds, starting values, scaling and integer programming priorities.  The attributes also contain the solution level and marginal for the variable after execution of a solve statement.  They are more extensively discussed in the Calculations chapter and represent:

 

Variable attribute

Symbol

Description

Lower bound

.lo

Lower bound for the variable.  Set by the user either explicitly or through default values associated with the variable type.

Upper bound

.up

Upper bound for the variable.  Set by the user either explicitly or through default values associated with the variable type.

Fixed value

.fx

A fixed value for the variable which if set results in the variable up and lo bounds being set to the value of the fx attribute.

Range

.range

The difference between the lower and upper bounds for a variable cannot be assigned but can be used in computations.

Activity level

.l

Solution level for the variable, also the current value or starting point.  This attribute is reset to a new value when a model containing the variable is solved.

Marginal

.m

Reduced cost, simplex criterion or dual value marginal value for the variable.  This attribute is reset to a new value when a model containing the variable is solved.

Scale factor

.scale

Numerical scaling factor for all coefficients associated with the variable providing the model attribute scaleopt is set to 1.  This is discussed in the Scaling chapter.

Branching priority

.prior

Branching priority value used in integer programming models providing the model attribute prioropt is set to 1 as discussed in the MIP chapter.  Also permits one to relax integer restrictions by setting .prior = +inf regardless of prioropt setting.

Slack upper bound

.slackup

Slack from variable upper bound. This is computed as x.slackup = max(x.up-x.l,0)

Slack lower bound

.slacklo

Slack from variable lower bound. This is computed as x.slacklo = max(x.l-x.lo,0)

Slack

.slack

Largest slack from variable bound. This is computed as x.slack = max(x.slacklo,x.slackup)

Infeasibility

.infeas

Amount that variable is infeasible falling below its lower bound or above its  upper bound. This is computed as x.infeas = - min(x.l-x.lo,x.lu-x.l,0)

The user distinguishes between these attributes by appending a suffix to the variable name. Values may be assigned as defined here.

Examples:

(model.gms)

       Shipsw.up(Supplyl,Warehouse)=1000;

       Shipwm.scale(Warehouse,Market)=50;

       Shipsm.lo(Supplyl,Market)$(ord(supplyl) eq 1 and

                                            ord(market) eq 1)=1;

      totalship=

              sum((supplyl,market)   ,shipsm.l(supplyl,market))

           +sum((supplyl,warehouse),shipsw.l(supplyl,warehouse))

           +sum((warehouse,market) ,shipwm.l(warehouse,market));

Notes:

When variables are used in display statements you must specify which of the attributes should be displayed.  Appending the appropriate suffix to the variable name does this i.e.

 display x.m,y.l,z.scale;

 

No set element dependency specification appears.
Wherever a variable appears in a GAMS calculation statement, the attribute desired must be specified.
The only place where a variable name can appear without a attribute suffix is in a variable declaration, or a .. equation specification, which is discussed below.
One can use the .L and .M attributes of variables to construct reports on problem solution as discussed in the Improving Output via Report Writing chapter.
One can assign values to these items in data statements as discussed here.