LEXICO (variable-list relational-operator variable-list)
The LEXICO predicate defines a lexicographic ordering constraint, which compares two arrays of the same size from left to right. For example, a standings table in a sports competition is usually ordered lexicographically, with certain attributes (such as wins or points) to the left of others (such as goal difference).
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 subset of n-tuples, and is a strict partial order on a subset of n-tuples (Brualdi, 2010).
For example, you can express the lexicographic constraint by using a LEXICO predicate as follows:
con Mycon: lexico({j in 1..6} X[j] <= {j in 1..6} Y[j]);
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 type of symmetry that arises in CSPs and involves matrices of decision variables. Frisch et al. (2002) introduce an optimal algorithm to establish generalized arc consistency (GAC) for the constraint between two vectors of variables.