The OPTMODEL Procedure

Problem Symbols

The OPTMODEL procedure declares a number of symbols that are aliases for model components in the current problem. These symbols allow the model components to be accessed uniformly. These symbols are described in Table 17.

Table 17: Problem Symbols

Symbol Indexing Description
_NVAR_ Number of variables
_VAR_ {1.._NVAR_} Variable array
_NCON_ Number of constraints
_CON_ {1.._NCON_} Constraint array
_S_NVAR_ Number of presolved variables
_S_VAR_ {1.._S_NVAR_} Presolved variable array
_S_NCON_ Number of presolved constraints
_S_CON_ {1.._S_NCON_} Presolved constraint array
_NOBJ_ Number of objectives
_ALLOBJ_ {1.._NOBJ_} Objective array
_OBJ_ Current objective
_PROBLEM_ Current problem


If the table specifies indexing, then the corresponding symbol is accessed as an array. For example, if the problem includes two variables, x and y, then the value of _NVAR_ is 2 and the current variable values can be accessed as _var_[1] and _var_[2]. The problem variables prefixed with _S are restricted to model components in the problem after processing by the OPTMODEL presolver.

The following statements define a simple linear programming model and then use the problem symbols to print out some of the problem results. The .name suffix is used in the PRINT statements to display the actual variable and constraint names. Any of the suffixes that apply to a model component can be applied to the corresponding generic symbol.

proc optmodel printlevel=0;
   var x1 >= 0, x2 >= 0, x3 >= 0, x4 >= 0, x5 >= 0;

   minimize z = x1 + x2 + x3 + x4;

   con a1: x1 + x2 + x3          <= 4;
   con a2:               x4 + x5 <= 6;
   con a3: x1 +          x4      >= 5;
   con a4:      x2 +          x5 >= 2;
   con a5:           x3          >= 3;

   solve with lp;

   print _var_.name _var_ _var_.rc _var_.status;
   print _con_.name _con_.lb _con_.body _con_.ub _con_.dual _con_.status;

The PRINT statement output is shown in Figure 83.

Figure 83: Problem Symbol Output

[1]_VAR_.NAME_VAR__VAR_.RC_VAR_.STATUS
1x110B
2x201L
3x330B
4x440B
5x520B

[1]_CON_.NAME_CON_.LB_CON_.BODY_CON_.UB_CON_.DUAL_CON_.STATUS
1a1-1.7977E30844.0000E+000B
2a2-1.7977E30866.0000E+000L
3a3551.7977E+3081U
4a4221.7977E+3080U
5a5331.7977E+3081U


Last updated: June 22, 2026