5.44. balance_cycle

Origin
Constraint

$\mathrm{\pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi ’\pi \pi \pi }\left(\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄},\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }\right)$

Arguments
 $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}$ $\mathrm{\pi \pi \pi \pi }$ $\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }$ $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }\left(\mathrm{\pi \pi \pi \pi \pi ‘}-\mathrm{\pi \pi \pi },\mathrm{\pi \pi \pi \pi }-\mathrm{\pi \pi \pi \pi }\right)$
Restrictions
 $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}\beta ₯0$ $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}\beta €\mathrm{\pi \pi \pi ‘}\left(0,|\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }|-2\right)$ $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$$\left(\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi },\left[\mathrm{\pi \pi \pi \pi \pi ‘},\mathrm{\pi \pi \pi \pi }\right]\right)$ $\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }.\mathrm{\pi \pi \pi \pi \pi ‘}\beta ₯1$ $\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }.\mathrm{\pi \pi \pi \pi \pi ‘}\beta €|\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }|$ $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$$\left(\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi },\mathrm{\pi \pi \pi \pi \pi ‘}\right)$ $\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }.\mathrm{\pi \pi \pi \pi }\beta ₯1$ $\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }.\mathrm{\pi \pi \pi \pi }\beta €|\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }|$
Purpose

Consider a digraph $G$ described by the $\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }$ collection. Partition $G$ into a set of vertex disjoint circuits in such a way that each vertex of $G$ belongs to a single circuit. $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}$ is equal to the difference between the number of vertices of the largest circuit and the number of vertices of the smallest circuit.

Example
 $\left(\begin{array}{c}1,β©\begin{array}{cc}\mathrm{\pi \pi \pi \pi \pi ‘}-1\hfill & \mathrm{\pi \pi \pi \pi }-2,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-2\hfill & \mathrm{\pi \pi \pi \pi }-1,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-3\hfill & \mathrm{\pi \pi \pi \pi }-5,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-4\hfill & \mathrm{\pi \pi \pi \pi }-3,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-5\hfill & \mathrm{\pi \pi \pi \pi }-4\hfill \end{array}βͺ\hfill \end{array}\right)$ $\left(\begin{array}{c}0,β©\begin{array}{cc}\mathrm{\pi \pi \pi \pi \pi ‘}-1\hfill & \mathrm{\pi \pi \pi \pi }-2,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-2\hfill & \mathrm{\pi \pi \pi \pi }-3,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-3\hfill & \mathrm{\pi \pi \pi \pi }-1,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-4\hfill & \mathrm{\pi \pi \pi \pi }-5,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-5\hfill & \mathrm{\pi \pi \pi \pi }-6,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-6\hfill & \mathrm{\pi \pi \pi \pi }-4\hfill \end{array}βͺ\hfill \end{array}\right)$ $\left(\begin{array}{c}4,β©\begin{array}{cc}\mathrm{\pi \pi \pi \pi \pi ‘}-1\hfill & \mathrm{\pi \pi \pi \pi }-2,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-2\hfill & \mathrm{\pi \pi \pi \pi }-3,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-3\hfill & \mathrm{\pi \pi \pi \pi }-4,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-4\hfill & \mathrm{\pi \pi \pi \pi }-5,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-5\hfill & \mathrm{\pi \pi \pi \pi }-1,\hfill \\ \mathrm{\pi \pi \pi \pi \pi ‘}-6\hfill & \mathrm{\pi \pi \pi \pi }-6\hfill \end{array}βͺ\hfill \end{array}\right)$

In the first example we have the following two circuits: $1\beta 2\beta 1$ and $3\beta 5\beta 4\beta 3$. Since $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}=1$ is the difference between the number of vertices of the largest circuit (i.e.,Β 3) and the number of vertices of the smallest circuit (i.e.,Β 2) the corresponding $\mathrm{\pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi ’\pi \pi \pi }$ constraint holds.

All solutions

FigureΒ 5.44.1 gives all solutions to the following non ground instance of the $\mathrm{\pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi ’\pi \pi \pi }$ constraint: $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}\beta \left[0,1\right]$, ${S}_{1}\beta \left[1,2\right]$, ${S}_{2}\beta \left[1,3\right]$, ${S}_{3}\beta \left[3,5\right]$, ${S}_{4}\beta \left[3,4\right]$, ${S}_{5}\beta \left[2,5\right]$, $\mathrm{\pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi ’\pi \pi \pi }$$\left(\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄},\beta ©1{S}_{1},2{S}_{2},3{S}_{3},4{S}_{4},5{S}_{5}\beta ͺ\right)$.

Typical
$|\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }|>2$
Symmetry

Items of $\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }$ are permutable.

Arg. properties

Functional dependency: $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}$ determined by $\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }$.

Counting
 Length ($n$) 2 3 4 5 6 7 8 9 10 Solutions 2 6 24 120 720 5040 40320 362880 3628800

Number of solutions for $\mathrm{\pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi ’\pi \pi \pi }$: domains $0..n$

Length ($n$)2345678910
Total26241207205040403203628803628800
 Parameter value

0231025176721640642561436402
1-36456086117782328384150
2--820250770798038808363680
3---30901344630075348456120
4----144504873645360708048
5-----840336066240378000
6------576025920572400
7-------45360226800
8--------403200

Solution count for $\mathrm{\pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi ’\pi \pi \pi }$: domains $0..n$

related: $\mathrm{\pi \pi \pi \pi \pi \pi \pi }$Β (equivalence classes correspond to vertices in same cycle rather than variables assigned to the same value), $\mathrm{\pi \pi ’\pi \pi \pi }$Β (do not care how many cycles but how balanced the cycles are).

Keywords
Cond. implications

$\beta ’$ $\mathrm{\pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi ’\pi \pi \pi }\left(\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄},\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }\right)$

Β Β Β  withΒ  $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}>0$

Β Β Β  andΒ Β  $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}\beta €2$

Β Β implies $\mathrm{\pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi }_\mathrm{\pi \pi }_\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi }_\mathrm{\pi \pi \pi }$$\left(\mathrm{\pi Ί}:\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄},\mathrm{\pi  \pi ΄\pi ²\pi \pi Ύ\pi \pi }:\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }\right)$.

$\beta ’$ $\mathrm{\pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi ’\pi \pi \pi }\left(\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄},\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }\right)$

Β Β implies $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }$$\left(\mathrm{\pi  \pi °\pi \pi Έ\pi °\pi ±\pi »\pi ΄\pi }:\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }\right)$.

Arc input(s)

$\mathrm{\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 }\mathtt{1},\mathrm{\pi \pi \pi \pi \pi }\mathtt{2}\right)$

Arc arity
Arc constraint(s)
$\mathrm{\pi \pi \pi \pi \pi }\mathtt{1}.\mathrm{\pi \pi \pi \pi }=\mathrm{\pi \pi \pi \pi \pi }\mathtt{2}.\mathrm{\pi \pi \pi \pi \pi ‘}$
Graph property(ies)
 $\beta ’$$\mathrm{\pi \pi \pi \pi \pi }$$=0$ $\beta ’$$\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi }$$=\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}$

Graph class
$\mathrm{\pi Ύ\pi ½\pi ΄}_\mathrm{\pi \pi \pi ²\pi ²}$

Graph model

From the restrictions and from the arc constraint, we deduce that we have a bijection from the successor variables to the values of interval $\left[1,|\mathrm{\pi ½\pi Ύ\pi ³\pi ΄\pi }|\right]$. With no explicit restrictions it would have been impossible to derive this property.

In order to express the binary constraint that links two vertices one has to make explicit the identifier of the vertices. This is why the $\mathrm{\pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi ’\pi \pi \pi }$ constraint considers objects that have two attributes:

• One fixed attribute $\mathrm{\pi \pi \pi \pi \pi ‘}$ that is the identifier of the vertex,

• One variable attribute $\mathrm{\pi \pi \pi \pi }$ that is the successor of the vertex.

The graph property $\mathrm{\pi \pi \pi \pi \pi }$ $=$ 0 is used in order to avoid having vertices that both do not belong to a circuit and have at least one successor located on a circuit. This concretely means that all vertices of the final graph should belong to a circuit.

PartsΒ (A) andΒ (B) of FigureΒ 5.44.2 respectively show the initial and final graph associated with the first example of the Example slot. Since we use the $\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi }$ graph property, we show the connected components of the final graph. The constraint holds since all the vertices belong to a circuit (i.e.,Β $\mathrm{\pi \pi \pi \pi \pi }$ $=$ 0) and since $\mathrm{\pi ±\pi °\pi »\pi °\pi ½\pi ²\pi ΄}$ $=$ $\mathrm{\pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi }$ $=$ 1.