## 5.91. count

Origin
Constraint

$\mathrm{\pi \pi \pi \pi \pi }\left(\mathrm{\pi  \pi °\pi »\pi \pi ΄},\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi },\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ},\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }\right)$

Synonyms

$\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi ‘}$, $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }$, $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }$.

Arguments
 $\mathrm{\pi  \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)$ $\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}$ $\mathrm{\pi \pi \pi \pi }$ $\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }$ $\mathrm{\pi \pi \pi \pi }$
Restrictions
 $\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

Let $N$ be the number of variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection assigned to value $\mathrm{\pi  \pi °\pi »\pi \pi ΄}$; Enforce condition $N\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }$ to hold.

Example
$\left(5,β©4,5,5,4,5βͺ,\beta ₯,2\right)$

The $\mathrm{\pi \pi \pi \pi \pi }$ constraint holds since value $\mathrm{\pi  \pi °\pi »\pi \pi ΄}=5$ occurs 3 times within the items of the collection $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }=\beta ©4,5,5,4,5\beta ͺ$, which is greater than or equal to ($\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}$ is set to $\beta ₯$) $\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }=2$.

Typical
 $|\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$ $\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}\beta \left[=,<,\beta ₯,>,\beta €\right]$ $\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }>0$ $\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }<|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\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 is different from $\mathrm{\pi  \pi °\pi »\pi \pi ΄}$ can be replaced by any other value that is also different from $\mathrm{\pi  \pi °\pi »\pi \pi ΄}$.

Arg. properties
• Contractible wrt. $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ when $\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}\beta \left[<,\beta €\right]$.

• Extensible wrt. $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ when $\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}\beta \left[\beta ₯,>\right]$.

• Aggregate: $\mathrm{\pi  \pi °\pi »\pi \pi ΄}\left(\mathrm{\pi \pi }\right)$, $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }\left(\mathrm{\pi \pi \pi \pi \pi }\right)$, $\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}\left(\mathrm{\pi \pi }\right)$, $\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }\left(+\right)$ when $\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}\beta \left[<,\beta €,\beta ₯,>\right]$.

Remark

Similar to the $\mathrm{\pi \pi \pi \pi \pi }$ constraint. Both, in JaCoP (http://www.jacop.eu/) and in MiniZinc (http://www.minizinc.org/) $\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}$ is implicitly set to $=$.

Reformulation

The $\mathrm{\pi \pi \pi \pi \pi }$$\left(\mathrm{\pi  \pi °\pi »\pi \pi ΄},\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi },\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ},\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }\right)$ constraint can be expressed in term of the conjunction $\mathrm{\pi \pi \pi \pi \pi }$$\left(N,\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi },\beta ©\mathrm{\pi  \pi °\pi »\pi \pi ΄}\beta ͺ\right)\beta §N\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }$.

Systems

occurence in Choco, count in Gecode, count in JaCoP, count in MiniZinc, count in SICStus.

assignment dimension added: $\mathrm{\pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi }$Β ($\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$=$\mathrm{\pi  \pi °\pi »\pi \pi ΄}$ replaced by $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }\beta \mathrm{\pi  \pi °\pi »\pi \pi ΄\pi }$ and assignment dimension introduced).

generalisation: $\mathrm{\pi \pi \pi \pi \pi \pi }$Β ($\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$=$\mathrm{\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)
$\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi }.\mathrm{\pi \pi \pi }=\mathrm{\pi  \pi °\pi »\pi \pi ΄}$
Graph property(ies)
$\mathrm{\pi \pi \pi \pi }$$\mathrm{\pi \pi ΄\pi »\pi Ύ\pi Ώ}\mathrm{\pi »\pi Έ\pi Ό\pi Έ\pi }$

Graph model

PartsΒ (A) andΒ (B) of FigureΒ 5.91.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.91.2 depicts the automaton associated with the $\mathrm{\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 ${S}_{i}$. The following signature constraint links ${\mathrm{\pi  \pi °\pi }}_{i}$ and ${S}_{i}$: ${\mathrm{\pi  \pi °\pi }}_{i}=\mathrm{\pi  \pi °\pi »\pi \pi ΄}\beta {S}_{i}$.