5.61. 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.
- All solutions
FigureΒ 5.61.1 gives all solutions to the following non ground instance of the constraint: , , , , , .
Figure 5.61.1. All solutions corresponding to the non ground example of the constraint (with set to ) of the All solutions slot; each change is shown by a color change between two consecutive values.
- Typical
- Symmetry
One and the same constant can be added to the attribute of all items of .
- Arg. properties
Functional dependency: determined by and .
Contractible wrt. when and .
Contractible wrt. when and .
- 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 L.Β Hellsten inΒ [Hellsten04].
- Reformulation
The constraint can be reformulated with the constraintΒ [PetitBeldiceanuLorca11] that we now introduce. Given a domain variable, a sequence of domain variables, and and two binary constraints, holds if (1)Β is equal to the number of -stretches in the sequence , and (2)Β holds on any pair of consecutive variables in . A -stretch is a generalisation of the notion of stretch introduced by G.Β PesantΒ [Pesant01], where the equality constraint is made explicit by replacing it by a binary constraint , i.e.,Β a -stretch is a maximal length subsequence of for which the binary constraint is satisfied on consecutive variables. can be reformulated as , where is the universal constraint.
- 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 ), Β ( replaced by vector).
- Keywords
characteristic of a constraint: automaton, automaton with counters, non-deterministic automaton.
constraint arguments: pure functional dependency.
constraint network structure: sliding cyclic(1) constraint network(2), Berge-acyclic constraint network.
constraint type: timetabling constraint.
filtering: dynamic programming.
- 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.61.2 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.61.2. Initial and final graph of the constraint
(a) (b)
- Automaton
FigureΒ 5.61.3 depicts a first automaton that only accepts all the solutions to 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.61.3. Automaton (with counter) of the constraint
Figure 5.61.4. 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 to 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 to 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 an accepting 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 accepting 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.61.5 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.61.5. Counter free non deterministic automaton of the constraint assuming , with initial state and accepting state