An index set represents a set of combinations of members from the component set expressions. The index set notation is used in PROC OPTMODEL to describe collections of valid array indices and to specify sets of values with which to perform an operation. Index sets can declare local dummy parameters and can further restrict the set of combinations by a selection expression.
In an index-set specification, the index set consists of one or more index-set-items that are separated by commas. Each index-set-item can include local dummy parameter declarations. An optional selection expression follows the list of index-set-items. The following syntax, which describes an index set, usually appears in braces ({}):
index-set-item , …index-set-item : logic-expression
index-set-item has these forms:
set-expression name IN set-expression < name-1 , …name-n > IN set-expression
Names that precede the IN keyword in index-set-items declare local dummy parameter names. Dummy parameters correspond to the dummy index variables in mathematical expressions. For example, the following statements output the number 385:
proc optmodel; put (sum{i in 1..10} i**2);
The preceding statements evaluate this summation:
In both the statements and the summation, the index name is .
The last form of index-set-item in the list can be modified to use the SLICE expression implicitly. See the section More on Index Sets for details.
Array index sets cannot be defined using functions that return different values each time the functions are called. See the section Indexing for details.