## 5.412. used_by

Origin

N. Beldiceanu

Constraint

$\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1},\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}\right)$

Arguments
 $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ $\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚟𝚊𝚛}-\mathrm{𝚍𝚟𝚊𝚛}\right)$ $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ $\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚟𝚊𝚛}-\mathrm{𝚍𝚟𝚊𝚛}\right)$
Restrictions
 $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|\ge |\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$ $\mathrm{𝚛𝚎𝚚𝚞𝚒𝚛𝚎𝚍}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1},\mathrm{𝚟𝚊𝚛}\right)$ $\mathrm{𝚛𝚎𝚚𝚞𝚒𝚛𝚎𝚍}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2},\mathrm{𝚟𝚊𝚛}\right)$
Purpose

All the values of the variables of collection $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ are used by the variables of collection $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$.

Example
$\left(〈1,9,1,5,2,1〉,〈1,1,2,5〉\right)$

The $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$ constraint holds since, for each value occurring within the collection $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}=〈1,1,2,5〉$, its number of occurrences within $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}=〈1,9,1,5,2,1〉$ is greater than or equal to its number of occurrences within $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$:

• Value 1 occurs 3 times within $〈1,9,1,5,2,1〉$ and 2 times within $〈1,1,2,5〉$.

• Value 2 occurs 1 times within $〈1,9,1,5,2,1〉$ and 1 times within $〈1,1,2,5〉$.

• Value 5 occurs 1 times within $〈1,9,1,5,2,1〉$ and 1 times within $〈1,1,2,5〉$.

All solutions

Figure 5.412.1 gives all solutions to the following non ground instance of the $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$ constraint: ${U}_{1}\in \left\{1,5\right\}$, ${U}_{2}\in \left[1,2\right]$, ${U}_{3}\in \left[1,2\right]$, ${V}_{1}\in \left[0,2\right]$, ${V}_{2}\in \left[2,4\right]$, $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$$\left(〈{U}_{1},{U}_{2},{U}_{3}〉,〈{V}_{1},{V}_{2}〉\right)$.

##### Figure 5.412.1. All solutions corresponding to the non ground example of the $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$ constraint of the All solutions slot where identical values are coloured in the same way in both collections Typical
 $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|>1$ $\mathrm{𝚛𝚊𝚗𝚐𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}.\mathrm{𝚟𝚊𝚛}\right)>1$ $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|>1$ $\mathrm{𝚛𝚊𝚗𝚐𝚎}$$\left(\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}.\mathrm{𝚟𝚊𝚛}\right)>1$
Symmetries
• Items of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ are permutable.

• Items of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ are permutable.

• All occurrences of two distinct values in $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}.\mathrm{𝚟𝚊𝚛}$ or $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}.\mathrm{𝚟𝚊𝚛}$ can be swapped; all occurrences of a value in $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}.\mathrm{𝚟𝚊𝚛}$ or $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}.\mathrm{𝚟𝚊𝚛}$ can be renamed to any unused value.

Arg. properties
• Contractible wrt. $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$.

• Extensible wrt. $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$.

• Aggregate: $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}\left(\mathrm{𝚞𝚗𝚒𝚘𝚗}\right)$, $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}\left(\mathrm{𝚞𝚗𝚒𝚘𝚗}\right)$.

Algorithm

As described in [BeldiceanuKatrielThiel04a] we can pad $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ with dummy variables such that its cardinality will be equal to that cardinality of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$. The domain of a dummy variable contains all of the values. Then, we have a $\mathrm{𝚜𝚊𝚖𝚎}$ constraint between the two sets. Direct arc-consistency and bound-consistency algorithms based on a flow model are also proposed in [BeldiceanuKatrielThiel04a], [BeldiceanuKatrielThiel05], [Katriel05]. The leftmost part of Figure 3.7.30 illustrates this flow model.

More recently [Cymer12], [CymerPhD13] presents a second filtering algorithm also achieving arc-consistency based on a mapping of the solutions to the $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$ constraint to var-perfect matchingsA var-perfect matching is a maximum matching covering all vertices corresponding to the variables of $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$. in a bipartite intersection graph derived from the domain of the variables of the constraint in the following way. To each variable of the $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ and $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ collection corresponds a vertex of the intersection graph. There is an edge between a vertex associated with a variable of the $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ collection and a vertex associated with a variable of the $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ collection if and only if the corresponding variables have at least one value in common in their domains.

Reformulation

The $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$$\left(〈\mathrm{𝚟𝚊𝚛}-{U}_{1}\mathrm{𝚟𝚊𝚛}-{U}_{2},\cdots ,\mathrm{𝚟𝚊𝚛}-{U}_{|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|}〉,〈\mathrm{𝚟𝚊𝚛}-{V}_{1}\mathrm{𝚟𝚊𝚛}-{V}_{2},\cdots ,\mathrm{𝚟𝚊𝚛}-{V}_{|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|}〉\right)$ constraint can be expressed in term of a conjunction of $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$ reified constraints of the form:

${\sum }_{1\le j\le |\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|}\left({V}_{i}={U}_{j}\right)\ge {\sum }_{1\le j\le |\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|}\left({V}_{i}={V}_{j}\right)$ $\left(i\in \left[1,|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|\right]\right)$.

Used in

generalisation: $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}_\mathrm{𝚒𝚗𝚝𝚎𝚛𝚟𝚊𝚕}$ ($\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}$ replaced by $\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}/\mathrm{𝚌𝚘𝚗𝚜𝚝𝚊𝚗𝚝}$), $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}_\mathrm{𝚖𝚘𝚍𝚞𝚕𝚘}$ ($\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}$ replaced by $\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}\mathrm{mod}\mathrm{𝚌𝚘𝚗𝚜𝚝𝚊𝚗𝚝}$), $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}_\mathrm{𝚙𝚊𝚛𝚝𝚒𝚝𝚒𝚘𝚗}$ ($\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}$ replaced by $\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}\in \mathrm{𝚙𝚊𝚛𝚝𝚒𝚝𝚒𝚘𝚗}$).

Keywords
Arc input(s)

$\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$

Arc generator
$\mathrm{𝑃𝑅𝑂𝐷𝑈𝐶𝑇}$$↦\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎𝚜}\mathtt{1},\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎𝚜}\mathtt{2}\right)$

Arc arity
Arc constraint(s)
$\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎𝚜}\mathtt{1}.\mathrm{𝚟𝚊𝚛}=\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎𝚜}\mathtt{2}.\mathrm{𝚟𝚊𝚛}$
Graph property(ies)
 $•\text{for}\text{all}\text{connected}\text{components:}$$\mathrm{𝐍𝐒𝐎𝐔𝐑𝐂𝐄}$$\ge$$\mathrm{𝐍𝐒𝐈𝐍𝐊}$ $•$$\mathrm{𝐍𝐒𝐈𝐍𝐊}$$=|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$

Graph model

Parts (A) and (B) of Figure 5.412.2 respectively show the initial and final graph associated with the Example slot. Since we use the $\mathrm{𝐍𝐒𝐎𝐔𝐑𝐂𝐄}$ and $\mathrm{𝐍𝐒𝐈𝐍𝐊}$ graph properties, the source and sink vertices of the final graph are stressed with a double circle. Since there is a constraint on each connected component of the final graph we also show the different connected components. Each of them corresponds to an equivalence class according to the arc constraint. Note that the vertex corresponding to the variable assigned to value 9 was removed from the final graph since there is no arc for which the associated equality constraint holds. The $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$ constraint holds since:

• For each connected component of the final graph the number of sources is greater than or equal to the number of sinks.

• The number of sinks of the final graph is equal to $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}|$.

##### Figure 5.412.2. Initial and final graph of the $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$ constraint (a) (b)
Signature

Since the initial graph contains only sources and sinks, and since sources of the initial graph cannot become sinks of the final graph, we have that the maximum number of sinks of the final graph is equal to $|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}2|$. Therefore we can rewrite $\mathrm{𝐍𝐒𝐈𝐍𝐊}=|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}2|$ to $\mathrm{𝐍𝐒𝐈𝐍𝐊}\ge |\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}2|$ and simplify $\underline{\overline{\mathrm{𝐍𝐒𝐈𝐍𝐊}}}$ to $\overline{\mathrm{𝐍𝐒𝐈𝐍𝐊}}$.

Automaton

Figure 5.412.3 depicts the automaton associated with the $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$ constraint. To each item of the collection $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}$ corresponds a signature variable ${S}_{i}$ that is equal to 0. To each item of the collection $\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{2}$ corresponds a signature variable ${S}_{i+|\mathrm{𝚅𝙰𝚁𝙸𝙰𝙱𝙻𝙴𝚂}\mathtt{1}|}$ that is equal to 1.

##### Figure 5.412.3. Automaton of the $\mathrm{𝚞𝚜𝚎𝚍}_\mathrm{𝚋𝚢}$ constraint 