all

OPL keyword that allows you to use only part of an array with functions that take array parameters.

context
Model files (.mod) - Not allowed in a CPLEX constraint block.

Syntax

all(float):*[range]

Description

With functions that take array parameters, such as allDifferent, count, and other CP functions, this keyword allows you to give all the values within a part of an array as parameters (like forall for constraints).

Example

using CP;

int n = 5;

range R = 1..n;
dvar int x[R] in R;

subject to {
  allDifferent(all(i in R:i%2==1) x[i]);
}