## 5.208. max_nvalue

Origin
Constraint

$\mathrm{\pi \pi \pi ‘}_\mathrm{\pi \pi \pi \pi \pi \pi }\left(\mathrm{\pi Ό\pi °\pi },\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }\right)$

Arguments
 $\mathrm{\pi Ό\pi °\pi }$ $\mathrm{\pi \pi \pi \pi }$ $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }\left(\mathrm{\pi \pi \pi }-\mathrm{\pi \pi \pi \pi }\right)$
Restrictions
 $\mathrm{\pi Ό\pi °\pi }\beta ₯1$ $\mathrm{\pi Ό\pi °\pi }\beta €|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|$ $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$$\left(\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi },\mathrm{\pi \pi \pi }\right)$
Purpose

$\mathrm{\pi Ό\pi °\pi }$ is the maximum number of times that the same value is taken by the variables of the collection $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$.

Example
$\left(\begin{array}{c}3,β©\begin{array}{c}\mathrm{\pi \pi \pi }-9,\hfill \\ \mathrm{\pi \pi \pi }-1,\hfill \\ \mathrm{\pi \pi \pi }-7,\hfill \\ \mathrm{\pi \pi \pi }-1,\hfill \\ \mathrm{\pi \pi \pi }-1,\hfill \\ \mathrm{\pi \pi \pi }-6,\hfill \\ \mathrm{\pi \pi \pi }-7,\hfill \\ \mathrm{\pi \pi \pi }-7,\hfill \\ \mathrm{\pi \pi \pi }-4,\hfill \\ \mathrm{\pi \pi \pi }-9\hfill \end{array}βͺ\hfill \end{array}\right)$

In the example, values $1,4,6,7,9$ are respectively used $3,1,1,3,2$ times. So the maximum number of time $\mathrm{\pi Ό\pi °\pi }$ that a same value occurs is 3. Consequently the $\mathrm{\pi \pi \pi ‘}_\mathrm{\pi \pi \pi \pi \pi \pi }$ constraint holds.

Symmetries
• Items of $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ are permutable.

• All occurrences of two distinct values of $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }.\mathrm{\pi \pi \pi }$ can be swapped; all occurrences of a value of $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }.\mathrm{\pi \pi \pi }$ can be renamed to any unused value.

Usage

This constraint may be used in order to replace a set of $\mathrm{\pi \pi \pi \pi \pi }$ or $\mathrm{\pi \pi \pi \pi \pi }$ 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 $\mathrm{\pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi ’}$ constraint.

Reformulation

Assume that $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ is not empty. Let $\mathrm{\Xi ±}$ and $\mathrm{\Xi ²}$ respectively denote the smallest and largest possible values that can be assigned to the variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection. Let the variables ${O}_{\mathrm{\Xi ±}},{O}_{\mathrm{\Xi ±}+1},...,{O}_{\mathrm{\Xi ²}}$ respectively correspond to the number of occurrences of values $\mathrm{\Xi ±},\mathrm{\Xi ±}+1,...,\mathrm{\Xi ²}$ within the variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection. The $\mathrm{\pi \pi \pi ‘}_\mathrm{\pi \pi \pi \pi \pi \pi }$ constraint can be expressed as the conjunction of the following two constraints:

Β Β Β $\mathrm{\pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi ’}$ $\left(\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi },$

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β $\beta ©\mathrm{\pi \pi \pi }-\mathrm{\Xi ±}\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }-{O}_{\mathrm{\Xi ±}},$

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β $\mathrm{\pi \pi \pi }-\mathrm{\Xi ±}+1\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }-{O}_{\mathrm{\Xi ±}+1},$

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β $...$

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β $\mathrm{\pi \pi \pi }-\mathrm{\Xi ²}\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }-{O}_{\mathrm{\Xi ²}}\beta ͺ\right)$,

Β Β Β $\mathrm{\pi \pi \pi ‘\pi \pi \pi \pi }$$\left(\mathrm{\pi Ό\pi °\pi },\beta ©{O}_{\mathrm{\Xi ±}},{O}_{\mathrm{\Xi ±}+1},...,{O}_{\mathrm{\Xi ²}}\beta ͺ\right)$.

Keywords
Arc input(s)

$\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$

Arc generator
$\mathrm{\pi Ά\pi Ώ\pi Ό\pi \pi \pi Έ}$$\beta ¦\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }\left(\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi }\mathtt{1},\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi }\mathtt{2}\right)$

Arc arity
Arc constraint(s)
$\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi }\mathtt{1}.\mathrm{\pi \pi \pi }=\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi }\mathtt{2}.\mathrm{\pi \pi \pi }$
Graph property(ies)
$\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi }$$=\mathrm{\pi Ό\pi °\pi }$

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 $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ 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 $\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi }$ graph property, we show the largest strongly connected component of the final graph.

Automaton

FigureΒ 5.208.2 depicts the automaton associated with the $\mathrm{\pi \pi \pi ‘}_\mathrm{\pi \pi \pi \pi \pi \pi }$ constraint. To each item of the collection $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ corresponds a signature variable ${\mathrm{\pi }}_{i}$ that is equal to 0.