## 5.18. among_interval

Origin
Constraint

$\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }\left(\mathrm{\pi ½\pi  \pi °\pi },\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi },\mathrm{\pi »\pi Ύ\pi },\mathrm{\pi \pi Ώ}\right)$

Arguments
 $\mathrm{\pi ½\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)$ $\mathrm{\pi »\pi Ύ\pi }$ $\mathrm{\pi \pi \pi }$ $\mathrm{\pi \pi Ώ}$ $\mathrm{\pi \pi \pi }$
Restrictions
 $\mathrm{\pi ½\pi  \pi °\pi }\beta ₯0$ $\mathrm{\pi ½\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)$ $\mathrm{\pi »\pi Ύ\pi }\beta €\mathrm{\pi \pi Ώ}$
Purpose

$\mathrm{\pi ½\pi  \pi °\pi }$ is the number of variables of the collection $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ taking a value that is located within interval $\left[\mathrm{\pi »\pi Ύ\pi },\mathrm{\pi \pi Ώ}$].

Example
$\left(3,β©4,5,8,4,1βͺ,3,5\right)$

The $\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$ constraint holds since we have 3 values, namely $4,5$ and 4 that are situated within interval $\left[3,5\right]$.

Typical
 $\mathrm{\pi ½\pi  \pi °\pi }>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 ΄\pi }|>1$ $\mathrm{\pi »\pi Ύ\pi }<\mathrm{\pi \pi Ώ}$
Symmetries
• Items of $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ are permutable.

• An occurrence of a value of $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }.\mathrm{\pi \pi \pi }$ that belongs to $\left[\mathrm{\pi »\pi Ύ\pi },\mathrm{\pi \pi Ώ}\right]$ (resp. does not belong to $\left[\mathrm{\pi »\pi Ύ\pi },\mathrm{\pi \pi Ώ}\right]$) can be replaced by any other value in $\left[\mathrm{\pi »\pi Ύ\pi },\mathrm{\pi \pi Ώ}\right]$) (resp. not in $\left[\mathrm{\pi »\pi Ύ\pi },\mathrm{\pi \pi Ώ}\right]$).

Remark

By giving explicitly all values of the interval $\left[\mathrm{\pi »\pi Ύ\pi },\mathrm{\pi \pi Ώ}\right]$ the $\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$ constraint can be modelled with the $\mathrm{\pi \pi \pi \pi \pi }$ constraint. However when $\mathrm{\pi »\pi Ύ\pi }-\mathrm{\pi \pi Ώ}+1$ is a large quantity the $\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$ constraint provides a more compact form.

generalisation: $\mathrm{\pi \pi \pi \pi \pi }$Β ($\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$ in $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$ replaced by $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }\beta \mathrm{\pi \pi \pi \pi \pi \pi }$).

Keywords
Arc input(s)

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

Arc generator
$\mathrm{\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 }\right)$

Arc arity
Arc constraint(s)
 $\beta ’\mathrm{\pi »\pi Ύ\pi }\beta €\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi }.\mathrm{\pi \pi \pi }$ $\beta ’\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi }.\mathrm{\pi \pi \pi }\beta €\mathrm{\pi \pi Ώ}$
Graph property(ies)
$\mathrm{\pi \pi \pi \pi }$$=\mathrm{\pi ½\pi  \pi °\pi }$

Graph model

The arc constraint corresponds to a unary constraint. For this reason we employ the $\mathrm{\pi \pi Έ\pi Ώ\pi Ή}$ arc generator in order to produce a graph with a single loop on each vertex.

PartsΒ (A) andΒ (B) of FigureΒ 5.18.1 respectively show the initial and final graph associated with the Example slot. Since we use the $\mathrm{\pi \pi \pi \pi }$ graph property, the loops of the final graph are stressed in bold.

Automaton

FigureΒ 5.18.2 depicts the automaton associated with the $\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$ constraint. To each variable ${\mathrm{\pi  \pi °\pi }}_{i}$ of the collection $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ corresponds a 0-1 signature variable ${\mathrm{\pi }}_{i}$. The following signature constraint links ${\mathrm{\pi  \pi °\pi }}_{i}$ and ${\mathrm{\pi }}_{i}$: $\mathrm{\pi »\pi Ύ\pi }\beta €{\mathrm{\pi  \pi °\pi }}_{i}\beta §{\mathrm{\pi  \pi °\pi }}_{i}\beta €\mathrm{\pi \pi Ώ}\beta {\mathrm{\pi }}_{i}$. The automaton counts the number of variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection that take their value in $\left[\mathrm{\pi »\pi Ύ\pi },\mathrm{\pi \pi Ώ}$] and finally assigns this number to $\mathrm{\pi ½\pi  \pi °\pi }$.