5.49. change
| DESCRIPTION | LINKS | GRAPH | AUTOMATON |
- Origin
CHIP
- Constraint
- Synonyms
, .
- Arguments
- Restrictions
- Purpose
is the number of times that constraint holds on consecutive variables of the collection .
- Example
-
In the first example the changes are located between values 4 and 3, 3 and 4, 4 and 1. Consequently, the corresponding constraint holds since its first argument is fixed to value 3.
In the second example the unique change occurs between values 4 and 3. Consequently, the corresponding constraint holds since its first argument is fixed to 1.
- Typical
- Symmetry
One and the same constant can be added to the attribute of all items of .
- Usage
This constraint can be used in the context of timetabling problems in order to put an upper limit on the number of changes of job types during a given period.
- Remark
A similar constraint appears inΒ [PachetRoy99] under the name of constraint. The difference consists of replacing the arithmetic constraint by a binary constraint. When is equal to this constraint is called in [Platon03].
- Algorithm
A first incomplete algorithm is described inΒ [BeldiceanuCarlsson01]. The sketch of a filtering algorithm for the conjunction of the and the constraints based on dynamic programming achieving arc -consistency is mentioned by LarsΒ Hellsten inΒ [Hellsten04]. An arc -consistency algorithm in linear time of the sum of domain sizes is described inΒ [BeldiceanuLorcaPetit10].
- Used in
- See also
common keyword: , Β (number of changes in a sequence of with respect to a ), , Β (number of changes), Β (number of changes in a sequence of with respect to a ).
generalisation: Β ( replaced by of ).
- Keywords
characteristic of a constraint: automaton, automaton with counters, non-deterministic automaton.
constraint network structure: sliding cyclic(1) constraint network(2), sliding cyclic(1) constraint network(3), Berge-acyclic constraint network.
constraint type: timetabling constraint.
filtering: dynamic programming, arc-consistency.
- Arc input(s)
- Arc generator
-
- Arc arity
- Arc constraint(s)
- Graph property(ies)
-
- Graph class
-
- Graph model
Since we are only interested by the constraints linking two consecutive items of the collection we use to generate the arcs of the initial graph.
PartsΒ (A) andΒ (B) of FigureΒ 5.49.1 respectively show the initial and final graph of the first example of the Example slot. Since we use the graph property, the arcs of the final graph are stressed in bold.
Figure 5.49.1. Initial and final graph of the constraint


(a) (b)
- Automaton
FigureΒ 5.49.2 depicts a first automaton that only accepts all the solutions of the constraint. This automaton uses a counter in order to record the number of satisfied constraints of the form already encountered. To each pair of consecutive variables of the collection corresponds a 0 -1 signature variable . The following signature constraint links , and : .
Figure 5.49.2. Automaton (with counter) of the constraint

Figure 5.49.3. Hypergraph of the reformulation corresponding to the automaton (with counter) of the constraint

Since the reformulation associated with the previous automaton is not Berge-acyclic, we now describe a second counter free automaton that also only accepts all the solutions of the constraint. Without loss of generality, assume that the collection of variables contains at least two variables (i.e.,Β ). Let and respectively denote the number of variables of the collection , and the union of the domains of the variables of . Clearly, the maximum number of changes (i.e.,Β the number of times the constraint holds) cannot exceed the quantity . The states of the automaton that only accepts all the solutions of the constraint are defined in the following way:
We have an initial state labelled by .
We have intermediate states labelled by . The first subscript of state corresponds to the value currently encountered. The second subscript denotes the number of already encountered satisfied constraints of the form from the initial state to the state .
We have a final state labelled by .
Four classes of transitions are respectively defined in the following way:
There is a transition, labelled by from the initial state to the state , .
There is a transition, labelled by , from every state , , to the final state .
there is a transition labelled by from to (i.e.,Β the counter does not change for values such that constraint does not hold).
there is a transition labelled by from to (i.e.,Β the counter is incremented by for values such that constraint holds).
We have transitions of typeΒ 1, transitions of typeΒ 2, and at least transitions of typesΒ 3 and 4. Since the maximum value of is equal to , in the worst case we have at least transitions. This leads to a worst case time complexity of if we use Pesant's algorithm for filtering the constraintΒ [Pesant04].
FigureΒ 5.49.4 depicts the corresponding counter free non deterministic automaton associated with the constraint under the hypothesis that (1)Β all variables of are assigned a value in , (2)Β is equal to 4, and (3)Β is equal to .
Figure 5.49.4. Counter free non deterministic automaton of the constraint assuming , with initial state and final state
