Previous Page | Next Page

The OPTMODEL Procedure

Set Constructor Expression

{ [ expression-1 [, ...expression-n] ] } ;

The set constructor expression returns the set of the expressions in the member list. Duplicated values are added to the set only once. A warning message is produced when duplicates are detected. The constructor expression consists of 0 or more subexpressions of the same scalar type or of tuple expressions that match in length and in element types.

The following code outputs a three-member set and warns about the duplicated value 2:

proc optmodel;
   put ({1,2,3,2}); /* outputs {1,2,3} */

The following example produces a three-member set of tuples, using PROC OPTMODEL parameters and variables. The output is displayed in Figure 8.31.

proc optmodel;
   number m = 3, n = 4;                                                                                                                           
   var x{1..4} init 1;                                                                                                                            
   string y = 'c';                                                                                                                                
   put ({<'a', x[3]>, <'b', m>, <y, m/n>});  

Figure 8.31 Set Constructor Expression Output
{<'a',1>,<'b',3>,<'c',0.75>}                                                    

Previous Page | Next Page | Top of Page