[ library(ic_global) | The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

# alldifferent(+Vars)

All members of Vars are different

Vars
  A collection (a la collection_to_list/2) of variables or integers

## Description

Constrains all elements of a collection to be pairwise different (and integral). This is an implementation with the same semantics as the standard alldifferent/1 constraint, but with stronger propagation behaviour. It checks for exhaustion of all sub-ranges of possible values.

Any input variables which do not already have finite bounds will be given default bounds of -10000000 to 10000000.

## Examples

        ?- length(Xs,5), Xs::1..4, alldifferent(Xs).
        no (more) solution.

        ?- [X1,X2]::1..2, [X3,X4,X5]::1..5, alldifferent([X1,X2,X3,X4,X5]).

        X1 = X1{[1, 2]}
        X2 = X2{[1, 2]}
        X3 = X3{[3..5]}
        X4 = X4{[3..5]}
        X5 = X5{[3..5]}

        Delayed goals:
            alldifferent([X1{[1, 2]}, X2{[1, 2]}], 1)
            alldifferent([X3{[3..5]}, X4{[3..5]}, X5{[3..5]}], 1)

## See Also

ic_symbolic : alldifferent / 1, fd : alldifferent / 1, ic : alldifferent / 1, sd : alldifferent / 1, fd_global : alldifferent / 1, alldifferent / 2, lists : collection_to_list / 2