The Constraint Programming Solver
ALLDIFF Predicate
ALLDIFF(variable-list)
ALLDIFFERENT(variable-list)
The ALLDIFF predicate defines an all-different constraint, which defines a unique global constraint on a set of variables that requires all of them to be different from each other. A global constraint is equivalent to a conjunction of elementary constraints.
The syntax of the all-different constraint consists of one part, a variable-list, which is defined in the section Common Syntax Components. For example, the statements
var X{1..3} integer, A integer, B integer;
con AD1: alldiff({j in 1..3} X[j]);
con AD2: alldiff(A B);
are equivalent to
To apply the all-different constraint to all the variables, use the problem symbol _VAR_ as follows:
con alldiff(_VAR_);
For a description of problem symbols, see the section Problem Symbols in Chapter 9, The OPTMODEL Procedure.