## 5.398. symmetric_cardinality

Origin

Derived from $\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ by W. Kocjan.

Constraint

$\mathrm{𝚜𝚢𝚖𝚖𝚎𝚝𝚛𝚒𝚌}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}\left(\mathrm{𝚅𝙰𝚁𝚂},\mathrm{𝚅𝙰𝙻𝚂}\right)$

Arguments
 $\mathrm{𝚅𝙰𝚁𝚂}$ $\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚒𝚍𝚟𝚊𝚛}-\mathrm{𝚒𝚗𝚝},\mathrm{𝚟𝚊𝚛}-\mathrm{𝚜𝚟𝚊𝚛},𝚕-\mathrm{𝚒𝚗𝚝},𝚞-\mathrm{𝚒𝚗𝚝}\right)$ $\mathrm{𝚅𝙰𝙻𝚂}$ $\mathrm{𝚌𝚘𝚕𝚕𝚎𝚌𝚝𝚒𝚘𝚗}\left(\mathrm{𝚒𝚍𝚟𝚊𝚕}-\mathrm{𝚒𝚗𝚝},\mathrm{𝚟𝚊𝚕}-\mathrm{𝚜𝚟𝚊𝚛},𝚕-\mathrm{𝚒𝚗𝚝},𝚞-\mathrm{𝚒𝚗𝚝}\right)$
Restrictions
 $\mathrm{𝚛𝚎𝚚𝚞𝚒𝚛𝚎𝚍}$$\left(\mathrm{𝚅𝙰𝚁𝚂},\left[\mathrm{𝚒𝚍𝚟𝚊𝚛},\mathrm{𝚟𝚊𝚛},𝚕,𝚞\right]\right)$ $|\mathrm{𝚅𝙰𝚁𝚂}|\ge 1$ $\mathrm{𝚅𝙰𝚁𝚂}.\mathrm{𝚒𝚍𝚟𝚊𝚛}\ge 1$ $\mathrm{𝚅𝙰𝚁𝚂}.\mathrm{𝚒𝚍𝚟𝚊𝚛}\le |\mathrm{𝚅𝙰𝚁𝚂}|$ $\mathrm{𝚍𝚒𝚜𝚝𝚒𝚗𝚌𝚝}$$\left(\mathrm{𝚅𝙰𝚁𝚂},\mathrm{𝚒𝚍𝚟𝚊𝚛}\right)$ $\mathrm{𝚅𝙰𝚁𝚂}.𝚕\ge 0$ $\mathrm{𝚅𝙰𝚁𝚂}.𝚕\le \mathrm{𝚅𝙰𝚁𝚂}.𝚞$ $\mathrm{𝚅𝙰𝚁𝚂}.𝚞\le |\mathrm{𝚅𝙰𝙻𝚂}|$ $\mathrm{𝚛𝚎𝚚𝚞𝚒𝚛𝚎𝚍}$$\left(\mathrm{𝚅𝙰𝙻𝚂},\left[\mathrm{𝚒𝚍𝚟𝚊𝚕},\mathrm{𝚟𝚊𝚕},𝚕,𝚞\right]\right)$ $|\mathrm{𝚅𝙰𝙻𝚂}|\ge 1$ $\mathrm{𝚅𝙰𝙻𝚂}.\mathrm{𝚒𝚍𝚟𝚊𝚕}\ge 1$ $\mathrm{𝚅𝙰𝙻𝚂}.\mathrm{𝚒𝚍𝚟𝚊𝚕}\le |\mathrm{𝚅𝙰𝙻𝚂}|$ $\mathrm{𝚍𝚒𝚜𝚝𝚒𝚗𝚌𝚝}$$\left(\mathrm{𝚅𝙰𝙻𝚂},\mathrm{𝚒𝚍𝚟𝚊𝚕}\right)$ $\mathrm{𝚅𝙰𝙻𝚂}.𝚕\ge 0$ $\mathrm{𝚅𝙰𝙻𝚂}.𝚕\le \mathrm{𝚅𝙰𝙻𝚂}.𝚞$ $\mathrm{𝚅𝙰𝙻𝚂}.𝚞\le |\mathrm{𝚅𝙰𝚁𝚂}|$
Purpose

Put in relation two sets: for each element of one set gives the corresponding elements of the other set to which it is associated. In addition, it constraints the number of elements associated with each element to be in a given interval.

Example
$\left(\begin{array}{c}〈\begin{array}{cccc}\mathrm{𝚒𝚍𝚟𝚊𝚛}-1\hfill & \mathrm{𝚟𝚊𝚛}-\left\{3\right\}\hfill & 𝚕-0\hfill & 𝚞-1,\hfill \\ \mathrm{𝚒𝚍𝚟𝚊𝚛}-2\hfill & \mathrm{𝚟𝚊𝚛}-\left\{1\right\}\hfill & 𝚕-1\hfill & 𝚞-2,\hfill \\ \mathrm{𝚒𝚍𝚟𝚊𝚛}-3\hfill & \mathrm{𝚟𝚊𝚛}-\left\{1,2\right\}\hfill & 𝚕-1\hfill & 𝚞-2,\hfill \\ \mathrm{𝚒𝚍𝚟𝚊𝚛}-4\hfill & \mathrm{𝚟𝚊𝚛}-\left\{1,3\right\}\hfill & 𝚕-2\hfill & 𝚞-3\hfill \end{array}〉,\hfill \\ 〈\begin{array}{cccc}\mathrm{𝚒𝚍𝚟𝚊𝚕}-1\hfill & \mathrm{𝚟𝚊𝚕}-\left\{2,3,4\right\}\hfill & 𝚕-3\hfill & 𝚞-4,\hfill \\ \mathrm{𝚒𝚍𝚟𝚊𝚕}-2\hfill & \mathrm{𝚟𝚊𝚕}-\left\{3\right\}\hfill & 𝚕-1\hfill & 𝚞-1,\hfill \\ \mathrm{𝚒𝚍𝚟𝚊𝚕}-3\hfill & \mathrm{𝚟𝚊𝚕}-\left\{1,4\right\}\hfill & 𝚕-1\hfill & 𝚞-2,\hfill \\ \mathrm{𝚒𝚍𝚟𝚊𝚕}-4\hfill & \mathrm{𝚟𝚊𝚕}-\varnothing \hfill & 𝚕-0\hfill & 𝚞-1\hfill \end{array}〉\hfill \end{array}\right)$

The $\mathrm{𝚜𝚢𝚖𝚖𝚎𝚝𝚛𝚒𝚌}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ constraint holds since:

• $3\in \mathrm{𝚅𝙰𝚁𝚂}\left[1\right].\mathrm{𝚟𝚊𝚛}⇔1\in \mathrm{𝚅𝙰𝙻𝚂}\left[3\right].\mathrm{𝚟𝚊𝚕}$,

• $1\in \mathrm{𝚅𝙰𝚁𝚂}\left[2\right].\mathrm{𝚟𝚊𝚛}⇔2\in \mathrm{𝚅𝙰𝙻𝚂}\left[1\right].\mathrm{𝚟𝚊𝚕}$,

• $1\in \mathrm{𝚅𝙰𝚁𝚂}\left[3\right].\mathrm{𝚟𝚊𝚛}⇔3\in \mathrm{𝚅𝙰𝙻𝚂}\left[1\right].\mathrm{𝚟𝚊𝚕}$,

• $2\in \mathrm{𝚅𝙰𝚁𝚂}\left[3\right].\mathrm{𝚟𝚊𝚛}⇔3\in \mathrm{𝚅𝙰𝙻𝚂}\left[2\right].\mathrm{𝚟𝚊𝚕}$,

• $1\in \mathrm{𝚅𝙰𝚁𝚂}\left[4\right].\mathrm{𝚟𝚊𝚛}⇔4\in \mathrm{𝚅𝙰𝙻𝚂}\left[1\right].\mathrm{𝚟𝚊𝚕}$,

• $3\in \mathrm{𝚅𝙰𝚁𝚂}\left[4\right].\mathrm{𝚟𝚊𝚛}⇔4\in \mathrm{𝚅𝙰𝙻𝚂}\left[3\right].\mathrm{𝚟𝚊𝚕}$,

• The number of elements of $\mathrm{𝚅𝙰𝚁𝚂}\left[1\right].\mathrm{𝚟𝚊𝚛}=\left\{3\right\}$ belongs to interval $\left[0,1\right]$,

• The number of elements of $\mathrm{𝚅𝙰𝚁𝚂}\left[2\right].\mathrm{𝚟𝚊𝚛}=\left\{1\right\}$ belongs to interval $\left[1,2\right]$,

• The number of elements of $\mathrm{𝚅𝙰𝚁𝚂}\left[3\right].\mathrm{𝚟𝚊𝚛}=\left\{1,2\right\}$ belongs to interval $\left[1,2\right]$,

• The number of elements of $\mathrm{𝚅𝙰𝚁𝚂}\left[4\right].\mathrm{𝚟𝚊𝚛}=\left\{1,3\right\}$ belongs to interval $\left[2,3\right]$,

• The number of elements of $\mathrm{𝚅𝙰𝙻𝚂}\left[1\right].\mathrm{𝚟𝚊𝚕}=\left\{2,3,4\right\}$ belongs to interval $\left[3,4\right]$,

• The number of elements of $\mathrm{𝚅𝙰𝙻𝚂}\left[2\right].\mathrm{𝚟𝚊𝚕}=\left\{3\right\}$ belongs to interval $\left[1,1\right]$,

• The number of elements of $\mathrm{𝚅𝙰𝙻𝚂}\left[3\right].\mathrm{𝚟𝚊𝚕}=\left\{1,4\right\}$ belongs to interval $\left[1,2\right]$,

• The number of elements of $\mathrm{𝚅𝙰𝙻𝚂}\left[4\right].\mathrm{𝚟𝚊𝚕}=\varnothing$ belongs to interval $\left[0,1\right]$.

Typical
 $|\mathrm{𝚅𝙰𝚁𝚂}|>1$ $|\mathrm{𝚅𝙰𝙻𝚂}|>1$
Symmetries
• Items of $\mathrm{𝚅𝙰𝚁𝚂}$ are permutable.

• Items of $\mathrm{𝚅𝙰𝙻𝚂}$ are permutable.

Usage

The most simple example of applying $\mathrm{𝚜𝚢𝚖𝚖𝚎𝚝𝚛𝚒𝚌}_\mathrm{𝚐𝚌𝚌}$ is a variant of personnel assignment problem, where one person can be assigned to perform between $n$ and $m$ $\left(n\le m\right)$ jobs, and every job requires between $p$ and $q$ $\left(p\le q\right)$ persons. In addition every job requires different kind of skills. The previous problem can be modelled as follows:

• For each person we create an item of the $\mathrm{𝚅𝙰𝚁𝚂}$ collection,

• For each job we create an item of the $\mathrm{𝚅𝙰𝙻𝚂}$ collection,

• There is an arc between a person and the particular job if this person is qualified to perform it.

Remark

The $\mathrm{𝚜𝚢𝚖𝚖𝚎𝚝𝚛𝚒𝚌}_\mathrm{𝚐𝚌𝚌}$ constraint generalises the $\mathrm{𝚐𝚕𝚘𝚋𝚊𝚕}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ constraint by allowing a variable to take more than one value.

Algorithm

A first flow-based arc-consistency algorithm for the $\mathrm{𝚜𝚢𝚖𝚖𝚎𝚝𝚛𝚒𝚌}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ constraint is described in [KocjanKreuger04]. A second arc-consistency filtering algorithm exploiting matching theory [DulmageMendelsohn58] is described in [Cymer12], [CymerPhD13].

generalisation: $\mathrm{𝚜𝚢𝚖𝚖𝚎𝚝𝚛𝚒𝚌}_\mathrm{𝚐𝚌𝚌}$ ($\mathrm{𝚏𝚒𝚡𝚎𝚍}$ $\mathrm{𝚒𝚗𝚝𝚎𝚛𝚟𝚊𝚕}$ replaced by $\mathrm{𝚟𝚊𝚛𝚒𝚊𝚋𝚕𝚎}$).

Keywords
Arc input(s)

$\mathrm{𝚅𝙰𝚁𝚂}$ $\mathrm{𝚅𝙰𝙻𝚂}$

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

Arc arity
Arc constraint(s)
 $•$$\mathrm{𝚒𝚗}_\mathrm{𝚜𝚎𝚝}$$\left(\mathrm{𝚟𝚊𝚛𝚜}.\mathrm{𝚒𝚍𝚟𝚊𝚛},\mathrm{𝚟𝚊𝚕𝚜}.\mathrm{𝚟𝚊𝚕}\right)⇔$$\mathrm{𝚒𝚗}_\mathrm{𝚜𝚎𝚝}$$\left(\mathrm{𝚟𝚊𝚕𝚜}.\mathrm{𝚒𝚍𝚟𝚊𝚕},\mathrm{𝚟𝚊𝚛𝚜}.\mathrm{𝚟𝚊𝚛}\right)$ $•\mathrm{𝚟𝚊𝚛𝚜}.𝚕\le \mathrm{𝚌𝚊𝚛𝚍}_\mathrm{𝚜𝚎𝚝}\left(\mathrm{𝚟𝚊𝚛𝚜}.\mathrm{𝚟𝚊𝚛}\right)$ $•\mathrm{𝚟𝚊𝚛𝚜}.𝚞\ge \mathrm{𝚌𝚊𝚛𝚍}_\mathrm{𝚜𝚎𝚝}\left(\mathrm{𝚟𝚊𝚛𝚜}.\mathrm{𝚟𝚊𝚛}\right)$ $•\mathrm{𝚟𝚊𝚕𝚜}.𝚕\le \mathrm{𝚌𝚊𝚛𝚍}_\mathrm{𝚜𝚎𝚝}\left(\mathrm{𝚟𝚊𝚕𝚜}.\mathrm{𝚟𝚊𝚕}\right)$ $•\mathrm{𝚟𝚊𝚕𝚜}.𝚞\ge \mathrm{𝚌𝚊𝚛𝚍}_\mathrm{𝚜𝚎𝚝}\left(\mathrm{𝚟𝚊𝚕𝚜}.\mathrm{𝚟𝚊𝚕}\right)$
Graph property(ies)
$\mathrm{𝐍𝐀𝐑𝐂}$$=|\mathrm{𝚅𝙰𝚁𝚂}|*|\mathrm{𝚅𝙰𝙻𝚂}|$

Graph model

The graph model used for the $\mathrm{𝚜𝚢𝚖𝚖𝚎𝚝𝚛𝚒𝚌}_\mathrm{𝚌𝚊𝚛𝚍𝚒𝚗𝚊𝚕𝚒𝚝𝚢}$ is similar to the one used in the $\mathrm{𝚍𝚘𝚖𝚊𝚒𝚗}_\mathrm{𝚌𝚘𝚗𝚜𝚝𝚛𝚊𝚒𝚗𝚝}$ or in the $\mathrm{𝚕𝚒𝚗𝚔}_\mathrm{𝚜𝚎𝚝}_\mathrm{𝚝𝚘}_\mathrm{𝚋𝚘𝚘𝚕𝚎𝚊𝚗𝚜}$ constraints: we use an equivalence in the arc constraint and ask all arc constraints to hold.

Parts (A) and (B) of Figure 5.398.1 respectively show the initial and final graph associated with the Example slot. Since we use the $\mathrm{𝐍𝐀𝐑𝐂}$ graph property, all the arcs of the final graph are stressed in bold.

Signature

Since we use the $\mathrm{𝑃𝑅𝑂𝐷𝑈𝐶𝑇}$ arc generator on the collections $\mathrm{𝚅𝙰𝚁𝚂}$ and $\mathrm{𝚅𝙰𝙻𝚂}$, the number of arcs of the initial graph is equal to $|\mathrm{𝚅𝙰𝚁𝚂}|·|\mathrm{𝚅𝙰𝙻𝚂}|$. Therefore the maximum number of arcs of the final graph is also equal to $|\mathrm{𝚅𝙰𝚁𝚂}|·|\mathrm{𝚅𝙰𝙻𝚂}|$ and we can rewrite $\mathrm{𝐍𝐀𝐑𝐂}=|\mathrm{𝚅𝙰𝚁𝚂}|·|\mathrm{𝚅𝙰𝙻𝚂}|$ to $\mathrm{𝐍𝐀𝐑𝐂}\ge |\mathrm{𝚅𝙰𝚁𝚂}|·|\mathrm{𝚅𝙰𝙻𝚂}|$. So we can simplify $\underline{\overline{\mathrm{𝐍𝐀𝐑𝐂}}}$ to $\overline{\mathrm{𝐍𝐀𝐑𝐂}}$.