5.395. symmetric_alldifferent
DESCRIPTION | LINKS | GRAPH |
- Origin
- Constraint
- Synonyms
, , , , , , .
- Argument
- Restrictions
- Purpose
All variables associated with the attribute of the collection should be pairwise distinct. In addition enforce the following condition: if variable takes value with then variable takes value . This can be interpreted as a graph-covering problem where one has to cover a digraph with circuits of length two in such a way that each vertex of belongs to a single circuit.
- Example
-
The constraint holds since:
,
.
- All solutions
Figureย 5.395.1 gives all solutions to the following non ground instance of the constraint: , , , , .
Figure 5.395.1. All solutions corresponding to the non ground example of the constraint of the All solutions slot (the attribute is displayed as indices of the attribute)
- Typical
- Symmetry
Items of are permutable.
- Usage
As it was reported inย [Regin99], this constraint is useful to express matches between persons or between teams. The constraint also appears implicitly in the cycle cover problem and corresponds to the four conditions given in section 1 Modeling the Cycle Cover Problem ofย [PesantSoriano98].
- Remark
This constraint is referenced under the name inย [HenzMullerThiel02] as well as inย [Trick02]. From a modelling point of view this constraint can be expressed with the constraintย [BeldiceanuContejean94] where one imposes the additional condition that each cycle has only two nodes.
- Algorithm
A filtering algorithm for the constraint was proposed by J.-C.ย Rรฉgin inย [Regin99]. It achieves arc-consistency and its running time is dominated by the complexity of finding all edges that do not belong to any maximum cardinality matching in an undirected -vertex, -edge graph, i.e.,ย .
For the soft case of the constraint where the cost is the minimum number of variables to assign differently in order to get back to a solution, a filtering algorithm achieving arc-consistency is described inย [Cymer13], [CymerPhD13]. It has a complexity of , where is the number of maximal extreme sets in the value graph associated with the constraint and is the number of edges. It iterates over extreme sets and not over vertices as in the algorithm due to J.-C.ย Rรฉgin.
- Reformulation
The constraint can be expressed in term of a conjunction of reified constraints of the form . The constraint can also be reformulated as an constraint as shown below:
- Counting
-
Length () 2 3 4 5 6 7 8 9 10 Solutions 1 0 3 0 15 0 105 0 945 Number of solutions for : domains
- See also
common keyword: , , ย (permutation).
implies: , , .
implies (items to collection): , .
related: .
- Keywords
application area: sport timetabling.
characteristic of a constraint: all different, disequality.
combinatorial object: permutation, involution, matching.
constraint type: graph constraint, timetabling constraint, graph partitioning constraint.
- Cond. implications
- Arc input(s)
- Arc generator
-
- Arc arity
- Arc constraint(s)
-
- Graph property(ies)
-
- Graph model
In order to express the binary constraint that links two vertices one has to make explicit the identifier of the vertices.
Partsย (A) andย (B) of Figureย 5.395.2 respectively show the initial and final graph associated with the Example slot. Since we use the graph property, the arcs of the final graph are stressed in bold.
Figure 5.395.2. Initial and final graph of the constraint
(a) (b) - Signature
Since all the attributes of the collection are distinct, and because of the first condition of the arc constraint, each vertex of the final graph has at most one successor. Therefore the maximum number of arcs of the final graph is equal to the maximum number of vertices of the final graph. So we can rewrite to and simplify to .