While there has been very substantial progress in practical algorithms for satisfiability, there are many related logical problems where satisfiability alone is not enough. One particularly useful extension to satisfiability is the associated counting problem, #SAT, which requires computing the number of assignments that satisfy the input formula. #SAT’s practical importance stems in part from its very close relationship to the problem of general Bayesian inference. #SAT seems to be more computationally difficult than SAT since an algorithm for SAT can stop once it has found a single satisfying assignment, whereas #SAT requires finding all such assignments. In fact, #SAT is complete for the class #P which is at least as hard as the polynomial-time hierarchy [10]. Not only is #SAT intrinsically important, it is also an excellent test-bed for algorithmic ideas in propositional reasoning. One of these new ideas is formula caching [7, 1, 5] which seems particularly promising when performed in the form called component caching [1, 2]. In component caching, disjoint components of the formula, generated dynamically during a DPLL search, are cached so that they only have to be solved once. While formula caching in general may have theoretical value even in SAT solvers [5], component caching seems to hold great promise for the practical improvement of #SAT algorithms (and Bayes inference) where there is more of a chance to reuse cached results. In particular, Bacchus, Dalmao, and Pitassi [1] discuss three different caching schemes: simple caching, component caching, and linear-space caching and show that component caching is theoretically competitive with the best of current methods for Bayesian inference (and substantially better in some instances). It has not been clear, however, whether component caching can be as competitive in practice as it is theoretically. We provide significant evidence that it can, demonstrating that on many instances it can outperform existing algorithms for #SAT by orders of magnitude. The key to this success is carefully incorporating component caching with clause learning, one of the most important ideas used in modern SAT solvers. Although both component caching and clause learning involve recording information collected during search, the nature and use of the recorded information is radically different. In clause learning, a clause that captures the reason for failure is computed from every failed search path. Component caching, on the other hand, stores the result computed when solving a subproblem. When that subproblem is encountered again its value can be retrieved from the cache rather than having to solve it again. It is not immediately obvious how to maintain correctness as well as obtain the best performance from a combination of these techniques. In this paper we show how this combination can be achieved so as to obtain the performance improvements just mentioned. Our model-counting program is built on the ZChaff SAT solver [8, 11]. ZChaff already implements clause learning, and we have added new modules and modified many others to support #SAT and to integrate component caching with clause learning. Ours is the first implementation we are aware of that is able to benefit from both component caching and clause learning. We have tested our program against the relsat [4, 3] system, which also performs component analysis, but does not cache the computed values of these components. In most instances of both random and structured problems our new solver is significantly faster than relsat, often by up to several orders of magnitude. 3 We begin by reviewing DPLL with caching for #SAT [1], and DPLL with learning for SAT. We then outline a basic approach for efficiently integrating component caching and clause learning. With this basic
[1]
Adnan Darwiche,et al.
A compiler for deterministic, decomposable negation normal form
,
2002,
AAAI/IAAI.
[2]
Toniann Pitassi,et al.
DPLL with Caching: A new algorithm for #SAT and Bayesian Inference
,
2003,
Electron. Colloquium Comput. Complex..
[3]
Sharad Malik,et al.
Chaff: engineering an efficient SAT solver
,
2001,
Proceedings of the 38th Design Automation Conference (IEEE Cat. No.01CH37232).
[4]
Sharad Malik,et al.
Efficient conflict driven learning in a Boolean satisfiability solver
,
2001,
IEEE/ACM International Conference on Computer Aided Design. ICCAD 2001. IEEE/ACM Digest of Technical Papers (Cat. No.01CH37281).
[5]
Roberto J. Bayardo,et al.
Counting Models Using Connected Components
,
2000,
AAAI/IAAI.
[6]
Roberto J. Bayardo,et al.
Using CSP Look-Back Techniques to Solve Real-World SAT Instances
,
1997,
AAAI/IAAI.
[7]
Russell Impagliazzo,et al.
Memoization and DPLL: formula caching proof systems
,
2003,
18th IEEE Annual Conference on Computational Complexity, 2003. Proceedings..
[8]
Henry A. Kautz,et al.
Using Problem Structure for Efficient Clause Learning
,
2003,
SAT.
[9]
Seinosuke Toda,et al.
PP is as Hard as the Polynomial-Time Hierarchy
,
1991,
SIAM J. Comput..
[10]
Michael L. Littman,et al.
Using Caching to Solve Larger Probabilistic Planning Problems
,
1998,
AAAI/IAAI.
[11]
Toniann Pitassi,et al.
Value Elimination: Bayesian Interence via Backtracking Search
,
2002,
UAI.