Engineering an Exact Pseudo-Boolean Model Counter

Suwei Yang, Kuldeep S. Meel · DOI

Abstract

Model counting is a fundamental task in probabilistic reasoning and AI planning, traditionally performed on formulas in Conjunctive Normal Form (CNF). However, many real-world constraints are more naturally and succinctly expressed as Pseudo-Boolean (PB) formulas. Converting these to CNF often results in a massive increase in variables and clauses, hindering performance. We present PBCount, the first native, exact model counter for PB formulas. PBCount leverages Algebraic Decision Diagrams (ADDs) and native preprocessing to directly count satisfying assignments. Our evaluation demonstrates that PBCount significantly outperforms state-of-the-art CNF-based counters, solving 1513 benchmark instances compared to 1013 by the best competitor.

Introduction

Exact model counting involves determining the number of satisfying assignments for a Boolean formula. While CNF is the standard representation, it is often verbose. For instance, a single PB constraint like $3x_1 + 4x_2 \ge 3$ can replace a polynomial number of CNF clauses. Despite this, most exact counters require conversion to CNF, which can lead to a computational "blow-up." PBCount addresses this by treating PB formulas as first-class citizens, avoiding the overhead of CNF conversion and leveraging the inherent mathematical structure of PB constraints.

The PBCount Architecture

PBCount is designed with a three-stage pipeline to handle PB formulas natively, as illustrated in the system architecture.

The PBCount architecture consists of native preprocessing, dual compilation into ADDs, and final model counting.
  1. Native Preprocessing: Unlike CNF counters that use logic-based simplifiers, PBCount employs native PB techniques. This includes unit propagation and "assumption probing"—a simplified failed literal probing—to prune the search space before the heavy lifting of counting begins.
  2. Dual Compilation Strategies: PBCount converts PB constraints into Algebraic Decision Diagrams (ADDs). It employs two distinct strategies:
  3. Bottom-up: Constructs ADDs for individual terms and sums them. This is particularly effective when coefficients repeat, allowing the diagram to "collapse" via collisions.
  4. Top-down: A recursive "If-Then-Else" approach that allows for early termination when a partial assignment satisfies the inequality.
  5. Dynamic Heuristic: PBCount uses a heuristic to choose between compilation strategies on the fly based on constraint length and coefficient distribution.

Experimental Evaluation

We evaluated PBCount against top CNF counters—DPMC, D4, and GPMC—using a suite of 3473 benchmark instances from domains like sensor placement, combinatorial auctions, and multi-dimension knapsack. PB formulas were converted to CNF using PBLib for the baseline counters.

Cactus plot showing the number of instances completed over time. PBCount solves significantly more instances than CNF-based competitors like GPMC, D4, and DPMC.

As shown in the performance results, PBCount solved 1513 instances, a 50% improvement over GPMC's 1013. The advantage was most pronounced in domains with high mathematical structure. In Multi-dimension Knapsack, PBCount solved 503 instances versus D4's 281. In Auction benchmarks, the native PB representation had only 91 variables and 9 constraints, while the CNF conversion ballooned to ~42,000 variables and ~77,000 clauses. This 4-to-5 order of magnitude difference explains why native counting is so much faster.

Conclusion and Future Work

PBCount demonstrates that native reasoning on Pseudo-Boolean formulas is far more efficient than converting them to CNF for model counting. The use of ADDs and a dynamic compilation heuristic allows PBCount to exploit the succinctness and mathematical regularities of PB constraints. Future work will focus on maturing PB-specific preprocessing techniques and exploring search-based counting paradigms to further enhance performance.

Summary updated

BibTeX
@inproceedings{yang2024engineering,
  author = {Suwei Yang and Kuldeep S. Meel},
  title = {{Engineering an Exact Pseudo-Boolean Model Counter}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i8.28660},
}
Figure