The CLP Procedure

ALLDIFF Statement

  • ALLDIFF (variable_list-1) <…(variable_list-n)>;

  • ALLDIFFERENT (variable_list-1) <…(variable_list-n)>;

The ALLDIFF statement can have multiple specifications. Each specification defines a unique global constraint on a set of variables, requiring all of them to be different from each other. A global constraint is equivalent to a conjunction of elementary constraints.

For example, the statements

var (X1-X3) A B;
alldiff (X1-X3) (A B);

are equivalent to

\[  \begin{array}{rcl} X1 &  \ne &  X2 \mr{~ ~ AND}\\ X2 &  \ne &  X3 \mr{~ ~ AND}\\ X1 &  \ne &  X3 \mr{~ ~ AND}\\ A &  \ne &  B \end{array}  \]

If the variable list is empty, the ALLDIFF constraint applies to all the variables declared in any VARIABLE statement.