The OPTMODEL Procedure

EXPAND Statement

EXPAND [identifier-expression] [ / options];

The EXPAND statement prints the specified constraint, variable, or objective declaration expressions after expanding aggregation operators, substituting the current value for parameters and indices, and resolving constant subexpressions. Identifier-expression is the name of a variable, objective, or constraint. If the name is omitted and no options are specified, then all variables, objectives, and undropped constraints are printed. The following code shows an example EXPAND statement:

    proc optmodel;
       number n=2;
       var x{1..n};
       min z1=sum{i in 1..n}(x[i]-i)**2;
       max z2=sum{i in 1..n}(i-x[i])**3;
       con c{i in 1..n}: x[i]>=0;
       fix x[2]=3;
       expand;
 


This code produces the output in Output 6.15.

                                                                                
                                                                                 
                                                                                 
 Var x[1]                                                                        
 Fix x[2] = 3                                                                    
 Objective z1=(x[1] - 1)**2 + (x[2] - 2)**2                                      
 Maximize z2=(-x[1] + 1)**3 + (-x[2] + 2)**3                                     
 Constraint c[1]: x[1] >= 0                                                      
 Constraint c[2]: x[2] >= 0                                                      
 


Figure 6.15: EXPAND Statement Output

Specifying an identifier-expression restricts output to the specified declaration. A nonarray name prints only the specified item. If an array name is used with a specific index, then information for the specified array location is output. Using an array name without an index restricts output to all locations in the array.

Use options to further control the EXPAND statement output. The supported options follow:

SOLVE
causes the EXPAND statement to print the variables, objectives, and constraints in the same form that would be seen by the solver if a SOLVE statement were executed. This includes any transformations by the OPTMODEL presolver (see the section "Presolver"). In this form any fixed variables are replaced by their values and any objectives are replaced by the expressions that define them. Unless an identifier-expression specifies a particular nonarray item or array location, the EXPAND output is restricted to only the variables, the constraints, and the most recent objective seen in a MAX or MIN declaration or specified in a SOLVE statement.

The following options restrict the types of declarations output when no specific nonarray item or array location is requested. By default all types of declarations are output. Only the requested declaration types are output when one or more of the following options are used.

VAR
requests the output of unfixed variables. The VAR option can also be used in combination with the name of a variable array to display just the unfixed elements of the array.

FIX


requests the output of fixed variables. These variables might have been fixed by the FIX statement (or by the presolver if the SOLVE option is specified). The FIX option can also be used in combination with the name of a variable array to display just the fixed elements of the array.

OBJECTIVE / OBJ


requests the output of objectives. Only the most recent objective seen in a MAX or MIN declaration or specified in a SOLVE statement is considered when the SOLVE option is used.

CONSTRAINT / CON


requests the output of undropped constraints.

IIS


restricts the display to items found in the irreducible infeasible set (IIS) after the most recent SOLVE performed by the LP solver with the IIS=ON option. The IIS option for the EXPAND statement can also be used in combination with the name of a variable or constraint array to display only the elements of the array in the IIS. For more information about IIS, see the section "Irreducible Infeasible Set".

For example, you can see the effect of a FIX statement on the problem that is presented to the solver by using the SOLVE option. You can modify the previous example as follows:

    proc optmodel;
       number n=2;
       var x{1..n};
       min z1=sum{i in 1..n}(x[i]-i)**2;
       max z2=sum{i in 1..n}(i-x[i])**3;
       con c{i in 1..n}: x[i]>=0;
       fix x[2]=3;
       expand / solve;
 

This code produces the output in Output 6.16.

                                                                                
                                                                                 
                                                                                 
 Var x[1] >= 0                                                                   
 Fix x[2] = 3                                                                    
 Maximize z2=(-x[1] + 1)**3 - 1                                                  
 


Figure 6.16: Expansion with Fixed Variable

Compare the results in Output 6.16 to those in Output 6.15. The constraint c[1] has been converted to a variable bound. The subexpression that uses the fixed variable has been resolved to a constant.

Previous Page | Next Page | Top of Page