## 5.207. max_n

Origin
Constraint

$\mathrm{\pi \pi \pi ‘}_\mathrm{\pi }\left(\mathrm{\pi Ό\pi °\pi },\mathrm{\pi \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 Ί}$ $\mathrm{\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 \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|>0$ $\mathrm{\pi \pi °\pi ½\pi Ί}\beta ₯0$ $\mathrm{\pi \pi °\pi ½\pi Ί}<|\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 value of rank $\mathrm{\pi \pi °\pi ½\pi Ί}$ (i.e.,Β the ${\mathrm{\pi \pi °\pi ½\pi Ί}}^{th}$ largest distinct value) of the collection of domain variables $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$. Sinks have a rank of 0.

Example
$\left(6,1,β©3,1,7,1,6βͺ\right)$

The $\mathrm{\pi \pi \pi ‘}_\mathrm{\pi }$ constraint holds since its first argument $\mathrm{\pi Ό\pi °\pi }=6$ is fixed to the second (i.e.,Β $\mathrm{\pi \pi °\pi ½\pi Ί}+1$) largest distinct value of the collection $\beta ©3,1,7,1,6\beta ͺ$.

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

• One and the same constant can be added to $\mathrm{\pi Ό\pi °\pi }$ as well as to the $\mathrm{\pi \pi \pi }$ attribute of all items of $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$.

Algorithm
Reformulation

By associating to each variable ${V}_{i}$ $\left(i\beta \left[1,|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|\right]\right)$ of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection a rank variable ${R}_{i}$ with the reified constraint ${R}_{i}=\mathrm{\pi \pi °\pi ½\pi Ί}\beta {V}_{i}=\mathrm{\pi Ό\pi °\pi }$, and by creating for each pair of variables ${V}_{i},{V}_{j}$ $\left(i,j the reified constraints

Β Β Β ${V}_{i}>{V}_{j}\beta {R}_{i}<{R}_{j}$,

Β Β Β ${V}_{i}={V}_{j}\beta {R}_{i}={R}_{j}$,

Β Β Β ${V}_{i}<{V}_{j}\beta {R}_{i}>{R}_{j}$,

one can reformulate the $\mathrm{\pi \pi \pi ‘}_\mathrm{\pi }$ constraint in term of $3Β·\frac{|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|Β·\left(|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-1\right)}{2}+1$ reified constraints.

generalisation: $\mathrm{\pi \pi \pi ‘\pi \pi \pi \pi }$Β (absolute maximum replaced by maximum or order $\mathrm{\pi }$).

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)
$\beta \left(\begin{array}{c}\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 ’},\hfill \\ \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 }\hfill \end{array}\right)$
Graph property(ies)
$\mathrm{\pi \pi \pi \pi \pi }$$\left(\mathrm{\pi \pi °\pi ½\pi Ί},\mathrm{\pi Ό\pi Έ\pi ½\pi Έ\pi ½\pi },\mathrm{\pi \pi \pi }\right)=\mathrm{\pi Ό\pi °\pi }$

Graph model

PartsΒ (A) andΒ (B) of FigureΒ 5.207.1 respectively show the initial and final graph associated with the Example slot. Since we use the $\mathrm{\pi \pi \pi \pi \pi }$ graph property, the vertex of rank 1 (without considering the loops) of the final graph is outlined with a thick circle.