append
OPL function to produce new arrays of integers, integer variables, or interval variables through concatenation
Purpose
This OPL function enables you to produce new arrays of integers, integer variables, or interval variables through concatenation.
| context | type |
|---|---|
| Model files (.mod) - Not allowed in a CPLEX constraint block. |
int[] interval[] |
Syntax
append( int, int, ... ) append( int[], int, ... ) append( int[], int[], ... ) append( dvar int, dvar int, ... ) append( dvar int[], dvar int, ... ) append( dvar int[], dvar int[], ... ) append( dvar interval, dvar interval, ... ) append( dvar interval[], dvar interval, ... ) append( dvar interval[], dvar interval[], ... )
Description
This OPL function enables you to produce new arrays of integers, integer variables, or interval variables through concatenation. You can use this function within IBM ILOG Script statements by specifying the OPL namespace:
( Opl.xxx() )
Example
using CP;
range R=1..10;
dvar int x[R] in 0..20;
dvar int y[R] in 0..20;
minimize sum(i in R)(x[i]+y[i]);
subject to
{
allDifferent(append(all(i in 1..2) x[i],all(i in 4..6) y[i]));
}
noOverlap(append(all (h in houses, w in workerNames, t in taskNames) normalPlan[h][w][t],
all (h in lines, w in workerNames, nt in newTasks) newPlan[h][w][nt]));