## 5.244. 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(3,β©9,1,7,1,1,6,7,7,4,9βͺ\right)$ $\left(1,β©9,1,7,3,2,6βͺ\right)$ $\left(6,β©5,5,5,5,5,5βͺ\right)$

In the first 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 corresponding $\mathrm{\pi \pi \pi ‘}_\mathrm{\pi \pi \pi \pi \pi \pi }$ constraint holds.

Typical
 $\mathrm{\pi Ό\pi °\pi }>1$ $\mathrm{\pi Ό\pi °\pi }<|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|$ $|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|>1$ $\mathrm{\pi \pi \pi \pi \pi }$$\left(\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }.\mathrm{\pi \pi \pi }\right)>1$
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.

Arg. properties

Functional dependency: $\mathrm{\pi Ό\pi °\pi }$ determined by $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$.

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},\beta ―,{O}_{\mathrm{\Xi ²}}$ respectively correspond to the number of occurrences of values $\mathrm{\Xi ±},\mathrm{\Xi ±}+1,\beta ―,\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},$

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β $\beta ―$

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β $\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},\beta ―,{O}_{\mathrm{\Xi ²}}\beta ͺ\right)$.

Counting
 Length ($n$) 2 3 4 5 6 7 8 Solutions 9 64 625 7776 117649 2097152 43046721

Number of solutions for $\mathrm{\pi \pi \pi ‘}_\mathrm{\pi \pi \pi \pi \pi \pi }$: domains $0..n$

Length ($n$)2345678
Total9646257776117649209715243046721
 Parameter value

1624120720504040320362880
2336420540078750130536024449040
3-48015002982064680015382080
4--51503780960402577960
5---62528232258048
6----739216128
7-----8576
8------9

Solution count for $\mathrm{\pi \pi \pi ‘}_\mathrm{\pi \pi \pi \pi \pi \pi }$: domains $0..n$

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.244.1 respectively show the initial and final graph associated with the first example of 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.244.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 ${S}_{i}$ that is equal to 0.