[ library(gfd) | Reference Manual | Alphabetic Index ]
lex_eq(+Collection1, +Collection2)
Collection1 is lexicographically 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 equal, i.e.
the two collections are the same length, and each
element is identical to its corresponding element in the
other collection.
This constraint is known as lex_equal 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_EQ IntRelType.
Examples
[eclipse 48]: lex_eq([1,9,1,5], [1,9,1,5]).
...
Yes (0.00s cpu)
[eclipse 49]: lex_eq([1,9,1,5], [1,9,2,5]).
No (0.00s cpu)
[eclipse 50]: lex_eq([1,9,1,5], [1,9,0,5]).
No (0.00s cpu)
[eclipse 51]: lex_eq([1,9,1], [1,9,1,5]).
No (0.00s cpu)
See Also
lex_lt / 2, lex_gt / 2, lex_ge / 2, lex_ne / 2