5.208. max_nvalue
| DESCRIPTION | LINKS | GRAPH | AUTOMATON |
- Origin
- Constraint
- Arguments
- Restrictions
- Purpose
is the maximum number of times that the same value is taken by the variables of the collection .
- Example
-
In the example, values are respectively used times. So the maximum number of time that a same value occurs is 3. Consequently the constraint holds.
- Symmetries
Items of are permutable.
All occurrences of two distinct values of can be swapped; all occurrences of a value of can be renamed to any unused value.
- Usage
This constraint may be used in order to replace a set of or constraints were one would have to generate explicitly one constraint for each potential value. Also useful for constraining the number of occurrences of the mostly used value without knowing this value in advance and without giving explicitly an upper limit on the number of occurrences of each value as it is done in the constraint.
- Reformulation
Assume that is not empty. Let and respectively denote the smallest and largest possible values that can be assigned to the variables of the collection. Let the variables respectively correspond to the number of occurrences of values within the variables of the collection. The constraint can be expressed as the conjunction of the following two constraints:
Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β
Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β
Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β
Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β ,
- See also
common keyword: Β (counting constraint), , Β (value constraint,counting constraint), , Β (counting constraint).
- Keywords
-
characteristic of a constraint: maximum, automaton, automaton with array of counters.
constraint type: value constraint, counting constraint.
- Arc input(s)
- Arc generator
-
- Arc arity
- Arc constraint(s)
- Graph property(ies)
-
- Graph model
Because of the arc constraint, each strongly connected component of the final graph corresponds to a distinct value that is assigned to a subset of variables of the collection. Therefore the number of vertices of the largest strongly connected component is equal to the mostly used value.
PartsΒ (A) andΒ (B) of FigureΒ 5.208.1 respectively show the initial and final graph associated with the Example slot. Since we use the graph property, we show the largest strongly connected component of the final graph.
Figure 5.208.1. Initial and final graph of the constraint

(a) 
(b)
- Automaton
FigureΒ 5.208.2 depicts the automaton associated with the constraint. To each item of the collection corresponds a signature variable that is equal to 0.
Figure 5.208.2. Automaton of the constraint
