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

StartLayout 1st Row 1st Column upper X Baseline 1 2nd Column not-equals 3rd Column upper X Baseline 2 normal upper A normal upper N normal upper D 2nd Row 1st Column upper X Baseline 2 2nd Column not-equals 3rd Column upper X Baseline 3 normal upper A normal upper N normal upper D 3rd Row 1st Column upper X Baseline 1 2nd Column not-equals 3rd Column upper X Baseline 3 normal upper A normal upper N normal upper D 4th Row 1st Column upper A 2nd Column not-equals 3rd Column upper B EndLayout

If the variable list is empty, the ALLDIFF constraint applies to all the variables.

Last updated: September 16, 2021