4.2.2.1. All-Different and related constraints
In this section: all_different, all_different_except, all_different_except_0, all_disjoint, all_equal, nvalue, symmetric_all_different.
all_different
1. predicate all_different(array [$X] of var int: x)
2. predicate all_different(array [$X] of var set of int: x)
3. predicate all_different(array [$X] of var opt int: x)
|
|
all_different_except
predicate all_different_except(array [$X] of var int: vs,
set of int: S)
|
Constrain the elements of the array of integers vs to be pairwise different except for those values that appear in the set S. |
all_different_except_0
predicate all_different_except_0(array [$X] of var int: vs)
|
Constrain the elements of the array of integers vs to be pairwise different except for those elements that are assigned the value 0. |
all_disjoint
predicate all_disjoint(array [$X] of var set of int: S)
|
Constrain the array of sets of integers S to be pairwise disjoint. |
all_equal
predicate all_equal(array [$X] of var int: x)
predicate all_equal(array [$X] of var set of int: x)
|
Constrain the elements of the array x to be all equal. |
nvalue
1. predicate nvalue(var int: n, array [$X] of var int: x)
2. predicate nvalue(var int: n, array [$X] of var opt int: x)
3. function var int: nvalue(array [$X] of var int: x)
4. function var int: nvalue(array [$X] of var opt int: x)
|
|
symmetric_all_different
predicate symmetric_all_different(array [int] of var int: x)
|
Requires the array of integers x to be all different, and for all i, x[i]=j \(\rightarrow\) x[j]=i. |