[ library(gfd) | Reference Manual | Alphabetic Index ]

lex_ne(+Collection1, +Collection2)

Collection1 is lexicographically not equal to Collection2
Collection1
Collection of integers or (domain) variables
Collection2
Collection of integers or (domain) variables

Description

Constrains the two collections to be lexicographically different, i.e. the two collections are either different lengths, or at least one element in one collection is different from its corresponding element in the other collection.

This constraint is known as lex_different in the global constraint catalog, but the catalog's definition requires Collection1 and Collection2 to be the same size. It is implemented using Gecode's rel() constraint (variant that takes two IntVarArgs arguments), with the IRT_NQ IntRelType.

Examples

[eclipse 52]: lex_ne([5,2,7,1], [5,3,7,1]).

...
Yes (0.00s cpu)
[eclipse 53]: lex_ne([5,2,7,1], [5,2,7]).

...
Yes (0.00s cpu)
[eclipse 54]: lex_ne([5,2,7], [5,2,7,1]).

...
Yes (0.00s cpu)
[eclipse 55]: lex_ne([5,2,7,1], [5,2,7,1]).

No (0.00s cpu)

See Also

lex_lt / 2, lex_gt / 2, lex_eq / 2, lex_ge / 2