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

lex_lt(+Collection1, +Collection2)

Collection1 is lexicographically less 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 smaller 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_less 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_LE IntRelType.

Examples

[eclipse 36]: lex_lt([5,2,3,9], [5,2,6,2]).

 ...
Yes (0.00s cpu)
[eclipse 37]: lex_lt([5,2,3,9], [5,2,6]).

 ...
Yes (0.00s cpu)
[eclipse 38]: lex_lt([5,2,3], [5,2,3,9]).

 ...
Yes (0.00s cpu)
[eclipse 39]: lex_lt([5,2,3,4], [5,2,3,4]).

No (0.00s cpu)

See Also

lex_le / 2, lex_gt / 2, lex_ge / 2, lex_eq / 2, lex_ne / 2, fd_global : lex_lt / 2, ic_global : lex_lt / 2, fd_global_gac : lex_lt / 2, ic_global_gac : lex_lt / 2