where lexicographic_ordering_constraint is specified in the following form:
((variable-list-1) order_type (variable-list-2))
where variable-list-1 and variable-list-2 are variable lists of equal length. The keyword order_type signifies the type of ordering and can be one of two values: LEX_LE, which indicates lexicographically less than or equal to (), or LEX_LT, which indicates lexicographically less than ().
The LEXICO statement specifies one or more lexicographic constraints. The lexicographic constraint and the strict lexicographic constraint are defined as follows. Given two n-tuples and , the n-tuple x is lexicographically less than or equal to y () if and only if
The n-tuple x is lexicographically less than y () if and only if and . Equivalently, if and only if
Informally you can think of the lexicographic constraint as sorting the n-tuples in alphabetical order. Mathematically, is a partial order on a given subset of n-tuples, and is a strict partial order on a given subset of n-tuples (Brualdi, 2010).
For example, you can express the lexicographic constraint by using a LEXICO statement as follows:
lexico( (x1-x6) lex_le (y1-y6) );
The assignment , , , , , , , , , , , and satisfies this constraint because for and . The fact that is irrelevant in this ordering.
Lexicographic ordering constraints can be useful for breaking a certain kind of symmetry that arises in CSPs with matrices of decision variables. Frisch et al. (2002) introduce an optimal algorithm to establish GAC (generalized arc consistency) for the constraint between two vectors of variables.