## 5.45. balance_interval

Origin
Constraint

$\mathrm{๐๐๐๐๐๐๐}_\mathrm{๐๐๐๐๐๐๐๐}\left(\mathrm{๐ฑ๐ฐ๐ป๐ฐ๐ฝ๐ฒ๐ด},\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐},\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}\right)$

Arguments
 $\mathrm{๐ฑ๐ฐ๐ป๐ฐ๐ฝ๐ฒ๐ด}$ $\mathrm{๐๐๐๐}$ $\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}$ $\mathrm{๐๐๐๐๐๐๐๐๐๐}\left(\mathrm{๐๐๐}-\mathrm{๐๐๐๐}\right)$ $\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}$ $\mathrm{๐๐๐}$
Restrictions
 $\mathrm{๐ฑ๐ฐ๐ป๐ฐ๐ฝ๐ฒ๐ด}โฅ0$ $\mathrm{๐ฑ๐ฐ๐ป๐ฐ๐ฝ๐ฒ๐ด}โค\mathrm{๐๐๐ก}\left(0,|\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}|-2\right)$ $\mathrm{๐๐๐๐๐๐๐๐}$$\left(\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐},\mathrm{๐๐๐}\right)$ $\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}>0$
Purpose

Consider the largest set ${\mathrm{๐ฎ}}_{1}$ (respectively the smallest set ${\mathrm{๐ฎ}}_{2}$) of variables of the collection $\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}$ that take their value in a same interval $\left[\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}ยทk,\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}ยทk+\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}-1\right]$, where $k$ is an integer. $\mathrm{๐ฑ๐ฐ๐ป๐ฐ๐ฝ๐ฒ๐ด}$ is equal to the difference between the cardinality of ${\mathrm{๐ฎ}}_{2}$ and the cardinality of ${\mathrm{๐ฎ}}_{1}$.

Example
$\left(3,โฉ6,4,3,3,4โช,3\right)$

In the example, the third argument $\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}=3$ defines the following family of intervals $\left[3ยทk,3ยทk+2\right]$, where $k$ is an integer. Values 6,4,3,3 and 4 are respectively located within intervals $\left[6,8\right]$, $\left[3,5\right]$, $\left[3,5\right]$, $\left[3,5\right]$ and $\left[3,5\right]$. Therefore intervals $\left[6,8\right]$ and $\left[3,5\right]$ are respectively used 1 and 4 times. The $\mathrm{๐๐๐๐๐๐๐}_\mathrm{๐๐๐๐๐๐๐๐}$ constraint holds since its first argument $\mathrm{๐ฑ๐ฐ๐ป๐ฐ๐ฝ๐ฒ๐ด}$ is assigned to the difference between the maximum and minimum number of the previous occurrences (i.e.,ย $4-1$).

Typical
 $|\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}|>2$ $\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}>1$ $\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}<$$\mathrm{๐๐๐๐๐}$$\left(\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}.\mathrm{๐๐๐}\right)$
Symmetries
• Items of $\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}$ are permutable.

• An occurrence of a value of $\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}.\mathrm{๐๐๐}$ that belongs to the $k$-th interval, of size $\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}$, can be replaced by any other value of the same interval.

Arg. properties

Functional dependency: $\mathrm{๐ฑ๐ฐ๐ป๐ฐ๐ฝ๐ฒ๐ด}$ determined by $\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}$ and $\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}$.

Usage

An application of the $\mathrm{๐๐๐๐๐๐๐}_\mathrm{๐๐๐๐๐๐๐๐}$ constraint is to enforce a balanced assignment of interval of values, no matter how many distinct interval of values will be used. In this case one will push down the maximum value of the first argument of the $\mathrm{๐๐๐๐๐๐๐}_\mathrm{๐๐๐๐๐๐๐๐}$ constraint.

specialisation: $\mathrm{๐๐๐๐๐๐๐}$ย ($\mathrm{๐๐๐๐๐๐๐๐}/\mathrm{๐๐๐๐๐๐๐๐}$ replaced by $\mathrm{๐๐๐๐๐๐๐๐}$).

Keywords
Arc input(s)

$\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}$

Arc generator
$\mathrm{๐ถ๐ฟ๐ผ๐๐๐ธ}$$โฆ\mathrm{๐๐๐๐๐๐๐๐๐๐}\left(\mathrm{๐๐๐๐๐๐๐๐๐}\mathtt{1},\mathrm{๐๐๐๐๐๐๐๐๐}\mathtt{2}\right)$

Arc arity
Arc constraint(s)
$\begin{array}{c}\mathrm{๐๐๐๐๐๐๐๐๐}\mathtt{1}.\mathrm{๐๐๐}/\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}=\hfill \\ \mathrm{๐๐๐๐๐๐๐๐๐}\mathtt{2}.\mathrm{๐๐๐}/\mathrm{๐๐ธ๐๐ด}_\mathrm{๐ธ๐ฝ๐๐ด๐๐ ๐ฐ๐ป}\hfill \end{array}$
Graph property(ies)
$\mathrm{๐๐๐๐๐}_\mathrm{๐๐๐๐}$$=\mathrm{๐ฑ๐ฐ๐ป๐ฐ๐ฝ๐ฒ๐ด}$

Graph class
$\mathrm{๐ด๐๐๐ธ๐ ๐ฐ๐ป๐ด๐ฝ๐ฒ๐ด}$

Graph model

The graph property $\mathrm{๐๐๐๐๐}_\mathrm{๐๐๐๐}$ constraints the difference between the sizes of the largest and smallest strongly connected components.

Partsย (A) andย (B) of Figureย 5.45.1 respectively show the initial and final graph associated with the Example slot. Since we use the $\mathrm{๐๐๐๐๐}_\mathrm{๐๐๐๐}$ graph property, we show the largest and smallest strongly connected components of the final graph.

Automaton

Figureย 5.45.2 depicts the automaton associated with the $\mathrm{๐๐๐๐๐๐๐}_\mathrm{๐๐๐๐๐๐๐๐}$ constraint. To each item of the collection $\mathrm{๐ ๐ฐ๐๐ธ๐ฐ๐ฑ๐ป๐ด๐}$ corresponds a signature variable ${S}_{i}$ that is equal to 1.