5.358. soft_all_equal_min_var

 DESCRIPTION LINKS GRAPH
Origin
Constraint

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

Arguments
 $\mathrm{\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 ½}\beta ₯0$ $\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 $M$ be the number of occurrences of the most often assigned value to the variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection. $\mathrm{\pi ½}$ is greater than or equal to the total number of variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection minus $M$ (i.e.,Β $\mathrm{\pi ½}$ is greater than or equal to the minimum number of variables that need to be reassigned in order to obtain a solution where all variables are assigned a same value).

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

Within the collection $\beta ©5,1,5,5\beta ͺ$, 3 is the number of occurrences of the most assigned value. Consequently, the $\mathrm{\pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi }$ constraint holds since the argument $\mathrm{\pi ½}=1$ is greater than or equal to the total number of variables 4 minus 3.

Typical
 $\mathrm{\pi ½}>0$ $\mathrm{\pi ½}<|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|$ $\mathrm{\pi ½}<|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|/10+2$ $|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|>1$
Symmetries
• $\mathrm{\pi ½}$ can be increased.

• 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.

Algorithm

Let $m$ denote the total number of potential values that can be assigned to the variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection. InΒ [HebrardMarxSullivanRazgon09], E.Β Hebrard et al. provides an $O\left(m\right)$ filtering algorithm achieving arc-consistency on the $\mathrm{\pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi }$ constraint. The same paper also provides an algorithm with a lower complexity for achieving range consistency. Both algorithms are based on the following ideas:

• In a first phase, they both compute an envelope of the union $\mathrm{\pi }$ of the domains of the variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection, i.e.,Β an array $A$ that indicates for each potential value $v$ of $\mathrm{\pi }$, the maximum number of variables that could possibly be assigned value $v$. Let $\mathrm{\pi \pi \pi ₯}_\mathrm{\pi \pi \pi }$ denote the maximum value over the entries of array $A$, and let ${\mathrm{\pi ±}}_{\mathrm{\pi \pi \pi ₯}}_\mathrm{\pi \pi \pi }$ denote the set of values which all occur in $\mathrm{\pi \pi \pi ₯}_\mathrm{\pi \pi \pi }$ variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection. The quantity $|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\mathrm{\pi \pi \pi ₯}_\mathrm{\pi \pi \pi }$ is a lower bound of $\mathrm{\pi ½}$.

• In a second phase, depending on the relative ordering between $\mathrm{\pi \pi \pi ₯}_\mathrm{\pi \pi \pi }$ and the minimum value of $|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\mathrm{\pi ½}$, i.e.,Β $|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\stackrel{Β―}{\mathrm{\pi ½}}$, we have the three following cases:

1. When $\mathrm{\pi \pi \pi ₯}_\mathrm{\pi \pi \pi }<|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\stackrel{Β―}{\mathrm{\pi ½}}$, the constraint $\mathrm{\pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi }$ simply fails since not enough variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection can be assigned the same value.

2. When $\mathrm{\pi \pi \pi ₯}_\mathrm{\pi \pi \pi }=|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\stackrel{Β―}{\mathrm{\pi ½}}$, the constraint $\mathrm{\pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi }$ can be satisfied. In this context, a value $v$ can be removed from the domain of a variable $V$ of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection if and only if:

1. value $v$ does not belong to ${\mathrm{\pi ±}}_{\mathrm{\pi \pi \pi ₯}}_\mathrm{\pi \pi \pi }$,

2. the domain of variable $V$ contains all values of ${\mathrm{\pi ±}}_{\mathrm{\pi \pi \pi ₯}}_\mathrm{\pi \pi \pi }$.

On the one hand, the first condition can be understand as the fact that value $v$ is not a value that allows to have at least $|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\stackrel{Β―}{\mathrm{\pi ½}}$ variables assigned the same value. On the other hand, the second condition can be interpreted as the fact that variable $V$ is absolutely required in order to have at least $|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\stackrel{Β―}{\mathrm{\pi ½}}$ variables assigned the same value.

3. When $\mathrm{\pi \pi \pi ₯}_\mathrm{\pi \pi \pi }>|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\stackrel{Β―}{\mathrm{\pi ½}}$, the constraint $\mathrm{\pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi }$ can be satisfied, but no value can be pruned.

Note that, in the context of range consistency, the first phase of the filtering algorithm can be interpreted as a sweep algorithm were:

• On the one hand, the sweep status corresponds to the maximum number of occurrence of variables that can be assigned a given value.

• On the other hand, the event point series correspond to the minimum values of the variables of the $\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }$ collection as well as to the maximum valuesΒ ($+1$) of the same variables.

FigureΒ 5.358.1 illustrates the previous filtering algorithm on an example where $\mathrm{\pi ½}$ is equal to 1, and where we have four variables ${V}_{1}$, ${V}_{2}$, ${V}_{3}$ and ${V}_{4}$ respectively taking their values within intervals $\left[1,3\right]$, $\left[3,7\right]$, $\left[0,8\right]$ and $\left[5,6\right]$ (see PartΒ (A) of FigureΒ 5.358.1, where the values of each variable are assigned a same colour that we retrieve in the other parts of FigureΒ 5.358.1).

PartΒ (B) of FigureΒ 5.358.1 illustrates the first phase of the filtering algorithm, namely the computation of the envelope of the domains of variables ${V}_{1}$, ${V}_{2}$, ${V}_{3}$ and ${V}_{4}$. The start events ${s}_{1}$, ${s}_{2}$, ${s}_{3}$, ${s}_{4}$ (i.e.,Β the events respectively associated with the minimum value of variables ${V}_{1}$, ${V}_{2}$, ${V}_{3}$, ${V}_{4}$) where the envelope is increased by 1 are represented by the character $\beta $. Similarly, the end events (i.e.,Β the events ${e}_{1}$, ${e}_{2}$, ${e}_{3}$, ${e}_{4}$ respectively associated with the maximum valueΒ ($+1$) of ${V}_{1}$, ${V}_{2}$, ${V}_{3}$, ${V}_{4}$ are represented by the character $\beta $). Since the highest peak of the envelope is equal to 3 we have that $\mathrm{\pi \pi \pi ₯}_\mathrm{\pi \pi \pi }$ is equal to 3. The values that allow to reach this highest peak are equal to ${\mathrm{\pi ±}}_{\mathrm{\pi \pi \pi ₯}}_\mathrm{\pi \pi \pi }=\left\{3,5,6\right\}$ (i.e.,Β shown in red in PartΒ (B) of FigureΒ 5.358.1).

Finally, PartΒ (C) of FigureΒ 5.358.1 illustrates the second phase of the filtering algorithm. Since $\mathrm{\pi \pi \pi ₯}_\mathrm{\pi \pi \pi }=3$ is equal to $|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\stackrel{Β―}{\mathrm{\pi ½}}=4-1$ we remove from the variables whose domains contain ${\mathrm{\pi ±}}_{\mathrm{\pi \pi \pi ₯}}_\mathrm{\pi \pi \pi }=\left\{3,5,6\right\}$ (i.e.,Β variables ${V}_{2}$ and ${V}_{3}$) all values not in ${\mathrm{\pi ±}}_{\mathrm{\pi \pi \pi ₯}}_\mathrm{\pi \pi \pi }=\left\{3,5,6\right\}$ (i.e.,Β values 4, 7 for variable ${V}_{2}$ and values 0, 1, 2, 4, 7, 8 for variable ${V}_{3}$).

Counting
 Length ($n$) 2 3 4 5 6 7 8 Solutions 21 172 1845 24426 386071 7116320 150156873

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

Length ($n$)2345678
Total211721845244263860717116320150156873
 Parameter value

03456789
194085156259400585
296450516564039863216713
3-64625705633859104672274761
4--62577761126097514722852721
5---7776117649205683218234801
6----117649209715242683841
7-----209715243046721
8------43046721

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

See also
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 }$$\beta ₯|\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }|-\mathrm{\pi ½}$

Graph model

We generate an initial graph with binary equalities constraints between each vertex and its successors. The graph property states that $\mathrm{\pi ½}$ is greater than or equal to the difference between the total number of vertices of the initial graph and the number of vertices of the largest strongly connected component of the final graph.

PartsΒ (A) andΒ (B) of FigureΒ 5.358.2 respectively show the initial and final graph associated with the Example slot. Since we use the $\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi }$ graph property we show one of the largest strongly connected components of the final graph.