Hi,
let me quote documentation IDE and OPL > Optimization Programming Language (OPL) > Language Reference Manual > OPL, the modeling language > Formal parameters
OPL enables simple equality constraints to be factorized inside tuples, which is important in obtaining more readable and efficient models. In this context, slicing refers to nested iterations with filtering conditions.
Consider, for instance, a transportation problem where products must be shipped from one set of cities to another set of cities. The model may include a constraint specifying that the total shipments for all products transported along a connection may not exceed a specified limit. This can be expressed by a constraint
Explicit slicing
forall(c in connections)
sum(<p,co> in routes: c == co) trans[<p,c>] <= limit;
A tiny example:
{
int} s={1,2,3};
{
int} s2={i| i in s:i mod 2==1}; // odd
execute
{
writeln
(s2);
}
which gives
{1 3}
regards
#DecisionOptimization#OPLusingCPLEXOptimizer