Engineering an Exact Pseudo-Boolean Model Counter

Suwei Yang, Kuldeep S. Meel

Abstract

Model counting is a fundamental task in computer science with applications ranging from network verification to combinatorial optimization. While traditionally performed on Boolean formulas in Conjunctive Normal Form (CNF), many real-world constraints are more naturally expressed as Pseudo-Boolean (PB) formulas. This paper introduces PBCount, the first native exact model counter for PB formulas. By leveraging Algebraic Decision Diagrams (ADDs) to represent linear inequalities directly, PBCount bypasses the exponential variable blow-up inherent in PB-to-CNF translation. Our evaluation on 3,473 benchmark instances demonstrates that PBCount solves approximately 50% more instances than current state-of-the-art CNF-based counters.

Introduction

In computer science, model counting involves finding the total number of satisfying assignments for a set of constraints. Traditionally, this task is performed using formulas in Conjunctive Normal Form (CNF). However, many practical problems—such as the knapsack problem, sensor placement, or neural network verification—are more succinctly expressed as Pseudo-Boolean (PB) formulas, which consist of linear inequalities with binary variables.

Until now, the standard approach for PB model counting was to translate PB constraints into CNF using tools like PBLib and then apply a standard CNF counter. This translation often results in a massive "blow-up" in the number of variables and clauses, significantly hindering performance. PBCount addresses this by treating PB constraints as first-class citizens, avoiding the overhead of CNF conversion.

Methods

PBCount's architecture is built upon three primary pillars designed to handle PB formulas natively:

  1. Native Preprocessing: The system simplifies formulas using techniques like unit propagation and assumption probing, specifically adapted for linear inequalities.
  2. Dual Compilation Strategies: To transform a PB formula into an Algebraic Decision Diagram (ADD), PBCount employs two distinct methods:
  3. Bottom-up: Constructs small ADDs for individual terms and merges them, optimized by sorting terms to maximize sub-component sharing.
  4. Top-down: Utilizes a recursive "if-then-else" approach that enables early termination when a constraint is guaranteed to be satisfied or violated.
  5. Dynamic Heuristic: PBCount uses a novel heuristic to analyze constraint features—such as coefficient distribution and length—to decide on-the-fly whether to apply the top-down or bottom-up approach for a given constraint.
The PBCount architecture, highlighting native preprocessing and ADD compilation.

Experimental Evaluation

The authors evaluated PBCount against a suite of 3,473 benchmark instances across three domains:

  • Sensor Placement: Identifying code sets in network graphs (1,473 instances).
  • Combinatorial Auctions: Determining item sharing based on utility thresholds (1,000 instances).
  • Multi-dimension Knapsack: Classic optimization constraints (1,000 instances).

PBCount was compared against leading CNF model counters—GPMC, DPMC, and D4—all of which required a PB-to-CNF conversion step.

Key Results

PBCount demonstrated a significant performance leap over existing methodologies:

  • Coverage: PBCount solved 1,513 instances, a 50% improvement over the best CNF-based approach, GPMC, which solved 1,013 instances.
  • Speed: In the auction domain, PBCount was approximately 2.3x faster than GPMC and nearly 5x faster than DPMC.
  • Efficiency: The results prove that the representation format is a major bottleneck; native PB reasoning allows for superior performance even with simpler preprocessing than its CNF rivals.
Performance comparison showing instances completed vs. time elapsed for PBCount and CNF-based counters.

Conclusion

PBCount represents a milestone in model counting by demonstrating the power of native Pseudo-Boolean representation. By using ADDs to "math" through problems rather than relying solely on logical branching, it avoids the exponential explosion of variables that plagues CNF-based pipelines. Future work will focus on incorporating more advanced preprocessing techniques and exploring search-based PB counting to further reduce memory overhead and handle even larger problem instances.

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