Previous Page | Next Page

The OPTMODEL Procedure

Identifier Expressions

Use an identifier-expression to refer to a variable, objective, constraint, parameter or problem location in expressions or initializations. This is the syntax for identifier-expressions :

name [ [ expression-1 [, ...expression-n] ] ] [ . suffix ] ;

To refer to a location in an array, follow the array name with a list of scalar expressions in square brackets ([ ]). The expression values are compared to the index set that was used to declare name. If there is more than one expression, then the values are formed into a tuple. The expression values for a valid array location must match a member of the array’s index set. For example, the following code defines a parameter array A that has two valid indices that match the tuples <1,2> and <3,4>:

   proc optmodel;
      set<number, number> ISET = {<1,2>, <3,4>};
      number A{ISET};
      a[1,2] = 0;  /* OK */
      a[3,2] = 0;  /* invalid index */

The first assignment is valid with this definition of the index set, but the second fails because <3,2> is not a member of the set parameter ISET.

Specify a suffix to refer to auxiliary locations for variables or objectives. See the section Suffixes for more information.

Previous Page | Next Page | Top of Page