5.18. alldifferent_modulo
DESCRIPTION | LINKS | GRAPH | AUTOMATON |
- Origin
- Constraint
- Synonyms
, .
- Arguments
- Restrictions
- Purpose
Enforce all variables of the collection to have a distinct rest when divided by .
- Example
-
The equivalence classes associated with values 25, 1, 14 and 3 are respectively equal to , , and . Since they are distinct the constraint holds.
- Typical
- Symmetries
Items of are permutable.
A value of can be renamed to any value such that is congruent to modulo .
Two distinct values and of such that can be swapped.
- Arg. properties
Contractible wrt. .
- Counting
-
Length () 2 3 4 5 6 7 8 Solutions 4 12 48 240 1440 10080 80640 Number of solutions for : domains
Length () 2 3 4 5 6 7 8 Total 4 12 48 240 1440 10080 80640 Parameter value 2 4 - - - - - - 3 - 12 - - - - - 4 - - 48 - - - - 5 - - - 240 - - - 6 - - - - 1440 - - 7 - - - - - 10080 - 8 - - - - - - 80640 Solution count for : domains
- See also
implies: .
specialisation: Β ( replaced by ).
- Keywords
characteristic of a constraint: modulo, all different, sort based reformulation, automaton, automaton with array of counters.
- Arc input(s)
- Arc generator
-
- Arc arity
- Arc constraint(s)
- Graph property(ies)
-
- Graph class
-
- Graph model
Exploit the same model used for the constraint. We replace the binary equality constraint by another equivalence relation depicted by the arc constraint. We generate a clique with a binary equality modulo constraint between each pair of vertices (including a vertex and itself) and state that the size of the largest strongly connected component should not exceed 1.
PartsΒ (A) andΒ (B) of FigureΒ 5.18.1 respectively show the initial and final graph associated with the Example slot. Since we use the graph property we show one of the largest strongly connected components of the final graph.
Figure 5.18.1. Initial and final graph of the constraint
(a) (b)
- Automaton
FigureΒ 5.18.2 depicts the automaton associated with the constraint. To each item of the collection corresponds a signature variable that is equal to 1. The automaton counts for each equivalence class the number of used values and finally imposes that each equivalence class is used at most one time.
Figure 5.18.2. Automaton of the constraint