5.215. length_first_sequence
DESCRIPTION | LINKS | AUTOMATON |
- Origin
- Constraint
- Arguments
- Restrictions
- Purpose
is the length of the maximum sequence of variables that take the same value that contains the first variable of the collection (or 0 if the collection is empty).
- Example
-
The first constraint holds since the sequence associated with the first value of the collection spans over three consecutive variables.
- Typical
- Symmetry
All occurrences of two distinct values of can be swapped; all occurrences of a value of can be renamed to any unused value.
- Arg. properties
Functional dependency: determined by .
- Reformulation
Without loss of generality let assume that the collection has more than one variable. By introducing 0-1 variables, the constraint can be expressed in term of reified constraints and one arithmetic constraint (i.e.,Β a constraint). We first introduce variables that are respectively set to 1 if and only if two given consecutive variables of the collection are equal:
Β Β Β ,
Β Β Β ,
Β Β Β
Β Β Β .
We then introduce variables that are respectively associated to the different sliding sequences starting on the first variable of the sequence . Variable is set to 1 if and only if :
Β Β Β ,
Β Β Β
Β Β Β
Β Β Β
Β Β Β .
Finally we state the following arithmetic constraint:
Β Β Β .
- Counting
-
Length () 2 3 4 5 6 7 8 Solutions 9 64 625 7776 117649 2097152 43046721 Number of solutions for : domains
Length () 2 3 4 5 6 7 8 Total 9 64 625 7776 117649 2097152 43046721 Parameter value 1 6 48 500 6480 100842 1835008 38263752 2 3 12 100 1080 14406 229376 4251528 3 - 4 20 180 2058 28672 472392 4 - - 5 30 294 3584 52488 5 - - - 6 42 448 5832 6 - - - - 7 56 648 7 - - - - - 8 72 8 - - - - - - 9 Solution count for : domains
- See also
- Keywords
characteristic of a constraint: automaton, automaton with counters.
combinatorial object: sequence.
constraint arguments: reverse of a constraint, pure functional dependency.
constraint network structure: sliding cyclic(1) constraint network(2).
- Automaton
FigureΒ 5.215.1 depicts the automaton associated with the constraint. To each pair of consecutive variables of the collection corresponds a signature variable . The following signature constraint links , and : .
Figure 5.215.1. Automaton of the constraint when
Figure 5.215.2. Hypergraph of the reformulation corresponding to the automaton of the constraint
Figure 5.215.3. Automaton of the reverse of the constraint (i.e.,Β the constraint) when and corresponding glue matrix between and its reverse