Decompositions of All Different, Global Cardinality and Related Constraints

Christian Bessiere, George Katsirelos, Nina Narodytska, Claude-Guy Quimper, Toby Walsh

Abstract We show that some common and important global constraints like ALL-DIFFERENT and GCC can be decomposed into simple arithmetic constraints on which we achieve bound or range consistency, and in some cases even greater pruning. These decompositions can be easily added to new solvers. They also provide other constraints with access to the state of the propagator by sharing of variables. Such sharing can be used to improve propagation between constraints. We report experiments with our decomposition in a pseudo-Boolean solver.

Introduction

Global constraints are a cornerstone of Constraint Programming (CP), providing powerful pruning through specialized algorithms like Regin's flow-based propagator for ALL-DIFFERENT. However, these algorithms often act as "black boxes," making them difficult to integrate into general-purpose solvers such as SAT or Integer Linear Programming (ILP) solvers. Furthermore, they do not easily share internal state with other constraints. This paper introduces a method to decompose these complex constraints into simple arithmetic parts without sacrificing their pruning power, bridging the gap between specialized CP techniques and general-purpose reasoning.

Methodology: Hall Interval Decompositions

The core of the proposed approach is a decomposition based on Interval Reasoning and Hall Intervals. A Hall interval is a set of $m$ values that must be assigned to exactly $m$ variables; consequently, no other variable can take a value within that interval.

To implement this in a general solver, the authors introduce auxiliary 0/1 variables, $A_{ilu}$, which indicate whether a variable $X_i$ takes a value in the interval $[l, u]$. The global constraint is then represented by a set of simple summation constraints: $$\sum A_{ilu} \leq u - l + 1$$ This ensures that no interval is "overcrowded." This approach is extended to the Global Cardinality Constraint (GCC), which specifies lower ($l_v$) and upper ($u_v$) bounds on the number of times each value $v$ can be assigned.

Example of a Global Cardinality Constraint (GCC) state with lower ($l_v$) and upper ($u_v$) bounds for values 1 through 5.

The authors prove that enforcing Domain Consistency (DC) on these decomposed arithmetic constraints is mathematically equivalent to achieving Range Consistency (RC) or Bound Consistency (BC) on the original global constraint. The total cost of reasoning with these decompositions over an entire search branch is $O(nd^3)$ or $O(nd^2)$, which is competitive with specialized algorithms.

Experimental Evaluation

The efficacy of the interval-based decomposition (HI) was evaluated against a standard "clique of binary inequalities" (BI) decomposition using MiniSat+, a pseudo-Boolean solver. Two primary benchmarks were used: Pigeon Hole Problems (PHP) and Double-Wheel Graceful Graphs ($DW_n$).

Pigeon Hole Problems

On the PHP benchmark, the HI decomposition demonstrated a massive reduction in search space. For $n=11$, the BI decomposition required 29 seconds and nearly a million backtracks. In contrast, the HI decomposition solved the same instance in just 0.1 seconds with only 10 backtracks.

Graceful Graphs

The results for the Double-Wheel Graceful Graph problem further highlight the efficiency of the approach. As shown in the table below, the HI decomposition consistently outperformed the BI baseline. For the $DW_{10}$ instance, the HI decomposition (specifically $HI_5$) solved the problem in 2.1 seconds, whereas the BI baseline took over 118 seconds.

Experimental results for Double-Wheel Graceful Graphs ($DW_n$), comparing binary inequality (BI) and Hall Interval (HI) decompositions in terms of backtracks (bt) and time (t).

Discussion and Conclusion

The ability to simulate complex global constraints using simple arithmetic is a significant result for the solver community. Beyond performance gains, this decomposition allows for "cross-talk" between constraints through shared auxiliary variables, enabling propagation that monolithic propagators cannot achieve. While achieving full Domain Consistency for ALL-DIFFERENT remains a challenge for polynomial-sized decompositions, the current approach provides a robust "middle ground" that brings high-level CP reasoning to a wider range of solvers.

Summary updated

BibTeX
@inproceedings{bessiere2009decompositions,
  author = {Christian Bessiere and George Katsirelos and Nina Narodytska and Claude-Guy Quimper and Toby Walsh},
  title = {{Decompositions of All Different, Global Cardinality and Related Constraints}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2009},
  url = {https://openreview.net/forum?id=Skb-NrMOZS},
}
Figure