12.07.2015 Views

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

ILOG OPL Development Studio Language Reference Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Tuples of parameters<strong>OPL</strong> allows tuples of formal parameters to appear in aggregate operators, forall statements,and generic sets.The code sample Tuple of formal parameters states precedence constraints between tasks.The constraint declaration requires explicit accesses to the fields of the tuple to state theconstraints. In addition, the field before is accessed twice. An alternate way to state thesame constraint is to use a tuple of formal parameters, as shown in the last line of Tuple offormal parameters, precluding the need to access the tuple fields explicitly. The tuple in the forall quantifier contains two components that are successively giventhe values of the fields of each tuple in Prec.Tuple of formal parametersint minTime=7*60;int maxTime=9*60;{string} Tasks = { "Make dinner","Have dinner","Clean after dinner" };tuple Precedence {string before;string after;}{Precedence} Prec = {,};int Duration[Tasks]= [20,60,10];dvar int Start[Tasks] in minTime..maxTime;subject to {forall(p in Prec) Start[p.after] >= Start[p.before] + Duration[p.before];}More generally, an expressionp in Swhere S is a set of tuples containing n fields, can be replaced by a formal parameter expression in Sthat contains n formal parameters. Each time a tuple r is selected from S, its fields are assignedto the corresponding formal parameters. This functionality is often useful in producing morereadable models.I L O G O P L D E V E L O P M E N T S T U D I O L A N G U A G ER E F E R E N C E M A N U A L137

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!