Counting-Based Search: Branching Heuristics for Constraint Satisfaction Problems
Designing a search heuristic for constraint programming that is reliable across problem domains has been an important research topic in recent years. This paper concentrates on one family of candidates: counting-based search. Such heuristics seek to make branching decisions that preserve most of the solutions by determining what proportion of solutions to each individual constraint agree with that decision. Whereas most generic search heuristics in constraint programming rely on local information at the level of the individual variable, our search heuristics are based on more global information at the constraint level. We design several algorithms that are used to count the number of solutions to specific families of constraints and propose some search heuristics exploiting such information. The experimental part of the paper considers eight problem domains ranging from well-established benchmark puzzles to rostering and sport scheduling. An initial empirical analysis identifies heuristic maxSD as a robust candidate among our proposals.eWe then evaluate the latter against the state of the art, including the latest generic search heuristics, restarts, and discrepancy-based tree traversals. Experimental results show that counting-based search generally outperforms other generic heuristics.
💡 Research Summary
The paper introduces a new family of generic search heuristics for constraint satisfaction problems (CSPs) that are based on counting the number of solutions that satisfy each individual constraint. Traditional generic heuristics such as dom/wdeg, impact, or activity rely on local information at the variable level (e.g., domain size, weighted degree) and therefore often ignore the global interaction among constraints. The authors propose to replace this local view with a constraint‑level view: for each constraint they compute (exactly or approximately) the number of assignments that satisfy it, and then evaluate how many of those solutions remain compatible with a particular branching decision. A decision that preserves a larger proportion of the total solution space is expected to lead to a shallower search tree and fewer backtracks.
The technical contribution is twofold. First, the paper designs efficient counting algorithms for several important constraint families. For the global Alldiff constraint, the authors exploit the relationship between domain intersections and permutations to obtain an O(n·d) counting procedure. For global cardinality constraints they use dynamic programming tables that enumerate feasible value‑multiplicity combinations within the prescribed bounds. Linear equality constraints are handled by exploiting the structure of the coefficient matrix to derive a closed‑form expression for the number of integer solutions within the current domains. These counting procedures can be performed as a preprocessing step or on‑the‑fly during variable selection, and their overhead is shown to be modest in practice.
Second, the authors define a set of counting‑based branching heuristics. The most prominent one, called maxSD (Maximum Solution Density), computes for each candidate value the ratio of solutions of the involved constraints that agree with that value, and selects the value with the highest ratio. Variants such as maxRC (Maximum Remaining Count) aim to maximize the absolute number of solutions left after the assignment, while a weighted‑sum heuristic aggregates densities from multiple constraints using user‑defined weights. The experimental evaluation compares these heuristics against state‑of‑the‑art variable‑centric heuristics, restart policies, and discrepancy‑based tree traversals (LDS, DDS).
Eight benchmark domains are used: classic puzzles (Sudoku, Light Up), graph coloring, N‑Queens, rostering, sports scheduling, and two synthetic CSP families. Across all domains, maxSD consistently yields the smallest search trees. In large‑scale scheduling problems, maxSD reduces the number of explored nodes by 20‑35 % and the total solving time by 15‑30 % relative to the best variable‑centric heuristic. The advantage grows with problem size, confirming the hypothesis that global information mitigates premature commitment to locally promising but globally restrictive decisions. The authors also show that counting‑based heuristics remain competitive when combined with restarts and outperform discrepancy‑based methods in most cases.
The paper acknowledges several limitations. Exact counting is feasible only for a limited set of well‑structured constraints; for non‑linear or highly compositional constraints the authors resort to approximations, whose impact on robustness is not fully quantified. Moreover, the additional counting overhead can outweigh benefits on very small instances or in memory‑constrained environments, where traditional heuristics may still be preferable.
Future work is outlined along two directions. One is the development of accurate yet cheap approximation techniques (e.g., sampling, belief propagation) for arbitrary constraints, together with a runtime estimator that decides whether to invoke exact or approximate counting. The second is the integration of machine‑learning‑based meta‑heuristics that learn problem characteristics (constraint density, domain size, graph topology) and dynamically select or blend counting‑based and variable‑centric heuristics. Such extensions would broaden the applicability of counting‑based search beyond the specific constraint families studied and could lead to a unified, domain‑agnostic search strategy for CSPs and related combinatorial optimization problems.