A Generic Global Constraint based on MDDs

Peter Tiedemann, Henrik Reif Andersen, Rasmus Pagh

Abstract

Constraint Programming (CP) often faces a trade-off between the generality of constraints and the efficiency of their propagation. This paper introduces a generic global constraint based on Multi-Valued Decision Diagrams (MDDs) to represent complex solution sets compactly. We present a dynamic algorithm for maintaining Generalized Arc Consistency (GAC) that amortizes computational costs over the search process, achieving high efficiency compared to static re-scanning.

Introduction

In Constraint Satisfaction Problems (CSPs), global constraints are essential for pruning the search space by exploiting the specific structure of rules. However, many real-world constraints are "ad-hoc" and do not fit standard global constraints like AllDifferent. Traditionally, these are handled via large tables or decomposition into primitive constraints, both of which have significant drawbacks in memory or performance. This work proposes using MDDs as a versatile "super-constraint" to bridge this gap.

MDD-Based Constraint Representation

An Ordered Multi-Valued Decision Diagram (MDD) is a directed acyclic graph where each path from the root to the terminal node represents a valid assignment of values to variables.

An example of an MDD structure with three layers, showing root, terminal, and intermediate nodes with labeled edges.

As shown in Figure 1, MDDs can represent assignments across multiple layers. The structure allows for "long edges" (e.g., the edge labeled '4' bypassing layer 2) and multiple edges between the same nodes (e.g., edges '1' and '3' between the root and the right node in layer 2), which enables the representation of wildcards and redundant values efficiently.

Dynamic GAC Algorithm

The primary contribution is a dynamic algorithm for maintaining Generalized Arc Consistency (GAC). Instead of re-evaluating the entire MDD at every search node, the algorithm tracks the "death" of edges.

Support Lists and Amortized Complexity

The algorithm maintains support lists for each variable-value assignment. When an edge is pruned—meaning its destination node can no longer reach the terminal—only the affected assignments are processed. Because an edge pruned during backtracking search remains pruned for the duration of that branch, the total work along any search path is proportional to the size of the MDD, $O(|E|)$, rather than being multiplied by the search depth.

Dynamic Reduction and Hashing

To keep the MDD compact, the authors employ dynamic reduction. By merging identical sub-structures using XOR-based vector hashing, the algorithm ensures the MDD remains in a reduced state with $O(1)$ updates to node signatures when edges are removed.

Theoretical Insights

The paper establishes a critical theoretical boundary: while MDDs are powerful, maintaining GAC for the conjunction of an MDD and an AllDifferent constraint is NP-hard. This result underscores the necessity of search-based solvers even when using sophisticated data structures like MDDs.

Conclusion

By leveraging the compression capabilities of MDDs and an efficient amortized GAC algorithm, this approach provides a robust framework for handling generic constraints in CP. Future work includes extending these techniques to AND/OR MDDs and exploring stronger propagation between multiple MDD-based constraints.

Summary updated

BibTeX
@misc{tiedemann2006generic,
  author = {Peter Tiedemann and Henrik Reif Andersen and Rasmus Pagh},
  title = {{A Generic Global Constraint based on MDDs}},
  year = {2006},
  eprint = {cs/0611141},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/cs/0611141},
}
Figure