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

lex_gt(+Collection1, +Collection2)

Collection1 is lexicographically greater than Collection2
Collection1
Collection of integers or (domain) variables
Collection2
Collection of integers or (domain) variables

Description

Imposes a lexicographic ordering between the two lists. I.e. either is the first element of Collection1 strictly greater than the first element of Collection2, or the first elements are equal and the lexicographic order holds between the two list tails. A non-existing element (i.e. when the end of list is reached)is strictly smaller than any existing element.

This constraint is known as lex_greater 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_GR IntRelType.

Examples

[eclipse 44]: lex_gt([5,2,7,1], [5,2,6,2]).

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

...
Yes (0.00s cpu)
[eclipse 46]: lex_gt([5,2,7,1], [5,2,7,3]).

No (0.00s cpu)

See Also

lex_lt / 2, lex_ge / 2, lex_eq / 2, lex_ne / 2