Let be the total number of variables of the collection . A maximum non-zero set of consecutive variables is defined in the following way:
All variables take a non-zero value,
or is equal to 0,
or is equal to 0.
Enforces that each maximum non -zero set of consecutive variables of the collection contains at least and at most values from the collection of values .
The constraint holds since the two maximum non -zero set of consecutive values and of its third argument take both 2 () values within the set of values .
This constraint is useful in timetabling problems where the variables are interpreted as the type of job that a person does on consecutive days. Value 0 represents a rest day and one imposes a cardinality constraint on periods that are located between rest periods.
One cannot initially state a constraint since the rest days are not yet allocated. One can also not use an constraint since it does not hold for the sequences of consecutive variables that contains at least one rest day.
- See also
specialisation: (maximal sequences replaced by the full sequence).
- Arc input(s)
- Arc generator
- Arc arity
- Arc constraint(s)
- Constraint(s) on sets
- Graph model
Note that the arc constraint will produce the different sequences of consecutive variables that do not contain any 0. The set generator produces all the connected components of the final graph.
Parts (A) and (B) of Figure 5.292.1 respectively show the initial and final graph associated with the Example slot. Since we use the set generator we show the two connected components of the final graph. Since these two connected components both contains between 2 and 3 variables that take their values in the constraint holds.
Figure 5.292.1. Initial and final graph of the constraint
Figure 5.292.2 depicts the automaton associated with the constraint. To each variable of the collection corresponds a signature variable . The following signature constraint links and :
Figure 5.292.2. Automaton of the constraint
Figure 5.292.3. Hypergraph of the reformulation corresponding to the automaton of the constraint