This thesis, "Constrained Counting and Sampling: Bridging the Gap between Theory and Practice" by Kuldeep Singh Meel, represents a landmark shift in how we approach two of the most difficult problems in computer science: counting satisfying assignments to constraints (#SAT) and sampling them uniformly.
TL;DR
This work bridges the gap between theoretical algorithms with strong guarantees and heuristic tools that actually scale. By combining universal hashing with modern SAT/SMT solvers, Meel introduces frameworks like ApproxMC2 and UniGen that scale from handling a few hundred variables to over a million, providing the first theoretically sound and practically efficient tools for large-scale probabilistic reasoning and verification.
What Problem Does This Paper Address?
In many fields—from hardware verification to network reliability—we need to know two things: "How many solutions exist for these constraints?" (Counting) and "Can I see a representative random solution?" (Sampling).
Mathematically, these are #P-complete problems, making them significantly harder than the already-difficult NP-complete problems (like simply finding one solution). Historically, researchers were stuck with a binary choice:
- Heuristics: Fast and scalable, but they offer no guarantees. You might get an answer that is off by several orders of magnitude without knowing it.
- Theoretical Algorithms: Provably accurate, but computationally "prohibitive." They were beautiful on paper but crashed when faced with more than a few dozen variables.
Meel’s goal was to find a "middle way" that offers rigorous $(\epsilon, \delta)$ guarantees—meaning the answer is within a factor of $(1+\epsilon)$ with high confidence $(1-\delta)$—while actually working on real-world engineering problems.
Methods
The core of the approach is a hashing-based framework.
Imagine a massive space of potential solutions. The algorithms use universal hash functions (specifically XOR-based constraints) to randomly partition this space into "cells." If we can find a number of hash functions that leaves a "small" number of solutions in a single cell, we can count those few solutions using a standard SAT solver and then multiply by the number of cells to estimate the total.
Key technical innovations include:
- ApproxMC2: An improved counter that reduces the number of expensive SAT solver calls from linear to logarithmic relative to the number of variables.
- Minimal Independent Support (MIS): A technique to identify a subset of variables that uniquely determine the rest. By only hashing these "independent" variables, the XOR constraints become much "thinner" and easier for SAT solvers to process.
- SMTApproxMC: The first word-level approximate counter that leverages SMT (Satisfiability Modulo Theories) solvers to handle bit-vectors directly, rather than breaking them down into millions of individual bits ("bit-blasting").
Datasets
The thesis evaluates these tools across a massive suite of over 200 benchmarks, including:
- Probabilistic Inference: Grid networks and Ising models.
- Hardware Verification: ISCAS89 combinational circuits.
- Program Synthesis: Constraints from tools like FlashFill.
- Network Reliability: A new dataset of 10 real-world power-transmission networks from U.S. cities (e.g., Amarillo, TX; Memphis, TN), where the task is to estimate connectivity during natural disasters.
Key Insights and Ideas
- The "SAT Revolution" as an Oracle: The thesis treats modern SAT solvers as "black-box" oracles. As SAT solvers get faster, Meel’s counting and sampling tools get faster automatically.
- Dependent Hashing: Unlike previous theories that required independent hash functions for every step, Meel proves that "prefix-slices" of the same hash function can be used. This allows for a "galloping" search that finds the right cell size much faster.
- Independent Support is a Game Changer: Discovering that you only need to hash a small "key" of variables (often 1/10th to 1/100th of the total) allows the solvers to avoid the "explosion" of complexity usually caused by long XOR constraints.
Key Results
- Massive Scalability: The tools handle formulas with up to 1 million variables, a massive jump from the prior state-of-the-art of ~1,000 variables.
- Performance Leap: ApproxMC2 is 1-2 orders of magnitude faster than its predecessor, ApproxMC.
- RelNet Success: In the network reliability case study, Meel’s framework (RelNet) provided theoretically sound estimates for city-scale power grids in seconds, while previous exact methods timed out.
- High Accuracy: While the theoretical error bound $(\epsilon)$ was set to 0.8, the observed error in practice was often as low as 0.02 to 0.04.
Limitations and Future Work
Despite the progress, the author notes several remaining hurdles:
- The "No Free Lunch" of Tolerance: The runtime still depends on $1/\epsilon^2$. If you want extremely high precision (a very small $\epsilon$), the number of SAT calls still becomes very high.
- SMT Hashing: The current word-level hash functions only provide "2-universality." Extending this to "3-universality" is needed to provide even stronger guarantees for sampling.
- Gaussian Elimination: While the theory is solid, many SMT solvers don't yet have built-in Gaussian elimination to handle the linear modular arithmetic of the hash functions efficiently. Integrating this is a key next step for the SMT community.
Summary updated