Previous Page | Next Page

The OPTMODEL Procedure

Tuple Expression

< expression-1, ...expression-n > ;

A tuple expression represents the value of a member in a set of tuples. Each scalar subexpression inside the angle brackets represents the value of a tuple element. This form is used only with IN, SETOF, and set constructor expressions.

The following code demonstrates the tuple expression:

proc optmodel;
   put (<1,2,3> in setof{i in 1..2}<i,i+1,i+2>);
   put ({<1,'a'>, <2,'b'>} cross {<3,'c'>, <4,'d'>});

The first PUT statement checks whether the tuple <1, 2, 3> is a member of a set of tuples. The second PUT statement outputs the cross product of two sets of tuples constructed by the set constructor.

This code produces the output in Figure 8.35.

Figure 8.35 Tuple Expression Output
1                                                                               
{<1,'a',3,'c'>,<1,'a',4,'d'>,<2,'b',3,'c'>,<2,'b',4,'d'>}                       

Previous Page | Next Page | Top of Page