Abstract
Model counting (#SAT) is a fundamental problem in computer science with applications ranging from probabilistic inference to hardware verification. However, its #P-complete nature makes exact counting intractable for large-scale industrial formulas. This paper introduces two novel approximate counting techniques: BPCount, which employs Belief Propagation (BP) to derive probabilistic lower bounds, and MiniCount, which utilizes the statistical distribution of backtrack search depths to establish scalable upper bounds. Experimental results demonstrate that these methods can handle massive formulas that were previously unsolvable, providing tight bounds in a fraction of the time required by traditional tools.
Introduction
While the Boolean Satisfiability (SAT) problem asks whether a solution exists, model counting (#SAT) seeks to determine the total number of satisfying assignments. This task is significantly more complex, falling into the #P-complete complexity class. Exact counters, such as Cachet or Relsat, often encounter an "exponential wall" when faced with structured, real-world instances. Existing approximate methods typically rely on solution sampling, which can be prohibitively slow for complex formulas. To address this, we propose BPCount and MiniCount, two algorithms designed to provide high-quality lower and upper bounds efficiently.
BPCount: Probabilistic Lower Bounds via Belief Propagation
BPCount builds upon the SampleCount framework, which estimates the "marginal" probability of a variable being TRUE across all solutions. While SampleCount relies on computationally expensive local search sampling, BPCount replaces this with Belief Propagation (BP), a message-passing algorithm.
To ensure robustness on the "loopy" graphs typical of industrial formulas, BPCount implements a "message damping" variant of BP. Furthermore, it incorporates "safety checks" using a SAT solver to prevent the algorithm from branching into unsatisfiable subspaces. By using BP-estimated marginals to bias branching decisions rather than uniform random choices, BPCount significantly reduces the variance of its estimates, leading to faster convergence and tighter lower bounds.
MiniCount: Scalable Upper Bounds through Statistical Inference
Establishing upper bounds is traditionally more challenging than lower bounds, as solvers may only explore "easy" regions of the search space. MiniCount addresses this by modifying a standard DPLL-based solver (MiniSat) to track the number of branching decisions $d$ required to find a solution.
A key innovation of MiniCount is the observation that $d$ follows a distribution closely approximating a normal distribution. Consequently, the model count, which is related to $2^d$, follows a log-normal distribution. By executing the randomized solver multiple times, MiniCount applies the Shapiro-Wilk test for normality and computes a statistical confidence interval to derive a conservative upper bound ($c_{max}$).
Experimental Evaluation
The proposed methods were evaluated on a diverse set of benchmarks, including circuit synthesis, random k-CNF, Latin square construction, and FPGA routing instances.
Key Results and Statistical Validation
- Performance: BPCount frequently outperformed
SampleCountby several orders of magnitude. For FPGA routing instances with over $10^{100}$ solutions, BPCount provided estimates in minutes, whereas exact counters timed out. - Tightness: For random 3-CNF instances, BPCount produced bounds very close to the true count within seconds.
- Scalability: MiniCount provided the first effective statistical upper bounds for formulas far beyond the reach of exact counters, often creating a useful "envelope" for the true count when combined with BPCount's lower bounds.
The log-normality assumption was validated across most industrial and random instances. However, the method encountered difficulties with specific combinatorial structures, such as Langford problems, where the Shapiro-Wilk test indicated significant deviations from normality.
Conclusion and Future Work
This work demonstrates that Belief Propagation is a robust tool for guiding model counting, even on loopy industrial formulas. Furthermore, the discovery of log-normal search depth distributions provides a powerful statistical pathway for bounding #SAT. Future research will focus on developing more robust message-passing schemes for BP and exploring the integration of BP-based heuristics directly into SAT solver design to improve general search efficiency.
Summary updated