5.313. sort
| DESCRIPTION | LINKS | GRAPH |
- Origin
- Constraint
- Synonyms
, , .
- Arguments
- Restrictions
- Purpose
The variables of the collection correspond to the variables of according to a permutation. The variables of are also sorted in increasing order.
- Example
-
The constraint holds since:
Values 1, 2, 5 and 9 have the same number of occurrences within both collections and . FigureΒ 5.313.1 illustrates this correspondence.
The items of collection are sorted in increasing order.
Figure 5.313.1. Correspondence between collection and collection

- Symmetries
Items of are permutable.
One and the same constant can be added to the attributes of all items of and .
- Remark
A variant of this constraint was introduced inΒ [Zhou97]. In this variant an additional list of domain variables represents the permutation that allows to go from to .
- Algorithm
- Systems
- See also
generalisation: Β ( parameter added).
implies: .
- Keywords
characteristic of a constraint: sort.
combinatorial object: permutation.
constraint arguments: constraint between two collections of variables.
- Arc input(s)
- Arc generator
-
- Arc arity
- Arc constraint(s)
- Graph property(ies)
-
- Arc input(s)
- Arc generator
-
- Arc arity
- Arc constraint(s)
- Graph property(ies)
-
- Graph model
PartsΒ (A) andΒ (B) of FigureΒ 5.313.2 respectively show the initial and final graph associated with the first graph constraint of the Example slot. Since it uses the and graph properties, the source and sink vertices of this final graph are stressed with a double circle. Since there is a constraint on each connected component of the final graph we also show the different connected components. The constraint holds since:
Each connected component of the final graph of the first graph constraint has the same number of sources and of sinks.
The number of sources of the final graph of the first graph constraint is equal to .
The number of sinks of the final graph of the first graph constraint is equal to .
Finally the second graph constraint holds also since its corresponding final graph contains exactly arcs: all the inequalities constraints between consecutive variables of holds.
Figure 5.313.2. Initial and final graph of the constraint

(a) 
(b) - Signature
Consider the first graph constraint. Since the initial graph contains only sources and sinks, and since isolated vertices are eliminated from the final graph, we make the following observations:
Sources of the initial graph cannot become sinks of the final graph,
Sinks of the initial graph cannot become sources of the final graph.
From the previous observations and since we use the arc generator on the collections and , we have that the maximum number of sources and sinks of the final graph is respectively equal to and . Therefore we can rewrite to and simplify to . In a similar way, we can rewrite to and simplify to .
Consider now the second graph constraint. Since we use the arc generator with an arity of 2 on the collection, the maximum number of arcs of the final graph is equal to . Therefore we can rewrite the graph property to and simplify to .