A Scalable Approximate Model Counter

  • Supratik Chakraborty
  • Kuldeep S. Meel
  • Moshe Y. Vardi
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8124)


Propositional model counting (#SAT), i.e., counting the number of satisfying assignments of a propositional formula, is a problem of significant theoretical and practical interest. Due to the inherent complexity of the problem, approximate model counting, which counts the number of satisfying assignments to within given tolerance and confidence level, was proposed as a practical alternative to exact model counting. Yet, approximate model counting has been studied essentially only theoretically. The only reported implementation of approximate model counting, due to Karp and Luby, worked only for DNF formulas. A few existing tools for CNF formulas are bounding model counters; they can handle realistic problem sizes, but fall short of providing counts within given tolerance and confidence, and, thus, are not approximate model counters.

We present here a novel algorithm, as well as a reference implementation, that is the first scalable approximate model counter for CNF formulas. The algorithm works by issuing a polynomial number of calls to a SAT solver. Our tool, ApproxMC, scales to formulas with tens of thousands of variables. Careful experimental comparisons show that ApproxMC reports, with high confidence, bounds that are close to the exact count, and also succeeds in reporting bounds with small tolerance and high confidence in cases that are too large for computing exact model counts.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
  3. 3.
    Angluin, D.: On counting problems and the polynomial-time hierarchy. Theoretical Computer Science 12(2), 161–173 (1980)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Bacchus, F., Dalmao, S., Pitassi, T.: Algorithms and complexity results for #SAT and bayesian inference. In: Proc. of FOCS, pp. 340–351 (2004)Google Scholar
  5. 5.
    Bellare, M., Goldreich, O., Petrank, E.: Uniform generation of NP-witnesses using an NP-oracle. Information and Computation 163(2), 510–526 (1998)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Birnbaum, E., Lozinskii, E.L.: The good old Davis-Putnam procedure helps counting models. Journal of Artificial Intelligence Research 10(1), 457–477 (1999)MathSciNetzbMATHGoogle Scholar
  7. 7.
    Chakraborty, S., Meel, K.S., Vardi, M.Y.: A scalable and nearly uniform generator of SAT witnesses. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 608–623. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  8. 8.
    Darwiche, A.: New advances in compiling CNF to decomposable negation normal form. In: Proc. of ECAI, pp. 328–332. Citeseer (2004)Google Scholar
  9. 9.
    Domshlak, C., Hoffmann, J.: Probabilistic planning via heuristic forward search and weighted model counting. Journal of Artificial Intelligence Research 30(1), 565–620 (2007)MathSciNetzbMATHGoogle Scholar
  10. 10.
    Ermon, S., Gomes, C.P., Selman, B.: Uniform solution sampling using a constraint solver as an oracle. In: Proc. of UAI (2012)Google Scholar
  11. 11.
    Gogate, V., Dechter, R.: Samplesearch: Importance sampling in presence of determinism. Artificial Intelligence 175(2), 694–729 (2011)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Gomes, C.P., Sabharwal, A., Selman, B.: Model counting: A new strategy for obtaining good bounds. In: Proc. of AAAI, pp. 54–61 (2006)Google Scholar
  13. 13.
    Gomes, C.P., Sabharwal, A., Selman, B.: Model counting. In: Biere, A., Heule, M., Maaren, H.V., Walsh, T. (eds.) Handbook of Satisfiability. Frontiers in Artificial Intelligence and Applications, vol. 185, pp. 633–654. IOS Press (2009)Google Scholar
  14. 14.
    Gomes, C.P., Hoffmann, J., Sabharwal, A., Selman, B.: From sampling to model counting. In: Proc. of IJCAI, pp. 2293–2299 (2007)Google Scholar
  15. 15.
    Gomes, C.P., Sabharwal, A., Selman, B.: Near-uniform sampling of combinatorial spaces using XOR constraints. In: Proc. of NIPS, pp. 670–676 (2007)Google Scholar
  16. 16.
    Jerrum, M.R., Valiant, L.G., Vazirani, V.V.: Random generation of combinatorial structures from a uniform distribution. Theoretical Computer Science 43(2-3), 169–188 (1986)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Bayardo Jr., R.J., Schrag, R.: Using CSP look-back techniques to solve real-world SAT instances. In: Proc. of AAAI, pp. 203–208 (1997)Google Scholar
  18. 18.
    Karp, R.M., Luby, M., Madras, N.: Monte-Carlo approximation algorithms for enumeration problems. Journal of Algorithms 10(3), 429–448 (1989)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Kitchen, N., Kuehlmann, A.: Stimulus generation for constrained random simulation. In: Proc. of ICCAD, pp. 258–265 (2007)Google Scholar
  20. 20.
    Kroc, L., Sabharwal, A., Selman, B.: Leveraging belief propagation, backtrack search, and statistics for model counting. In: Trick, M.A. (ed.) CPAIOR 2008. LNCS, vol. 5015, pp. 127–141. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  21. 21.
    Löbbing, M., Wegener, I.: The number of knight’s tours equals 33,439,123,484,294 – counting with binary decision diagrams. The Electronic Journal of Combinatorics 3(1), R5 (1996)Google Scholar
  22. 22.
    Luby, M.G.: Monte-Carlo Methods for Estimating System Reliability. PhD thesis, EECS Department, University of California, Berkeley (June 1983)Google Scholar
  23. 23.
    Minato, S.: Zero-suppressed bdds for set manipulation in combinatorial problems. In: Proc. of Design Automation Conference, pp. 272–277 (1993)Google Scholar
  24. 24.
    Roth, D.: On the hardness of approximate reasoning. Artificial Intelligence 82(1), 273–302 (1996)MathSciNetCrossRefGoogle Scholar
  25. 25.
    Rubinstein, R.: Stochastic enumeration method for counting np-hard problems. In: Methodology and Computing in Applied Probability, pp. 1–43 (2012)Google Scholar
  26. 26.
    Sang, T., Bacchus, F., Beame, P., Kautz, H., Pitassi, T.: Combining component caching and clause learning for effective model counting. In: Proc. of SAT (2004)Google Scholar
  27. 27.
    Sang, T., Bearne, P., Kautz, H.: Performing bayesian inference by weighted model counting. In: Prof. of AAAI, pp. 475–481 (2005)Google Scholar
  28. 28.
    Schmidt, J.P., Siegel, A., Srinivasan, A.: Chernoff-Hoeffding bounds for applications with limited independence. SIAM Journal on Discrete Mathematics 8, 223–250 (1995)MathSciNetCrossRefzbMATHGoogle Scholar
  29. 29.
    Simon, J.: On the difference between one and many. In: Salomaa, A., Steinby, M. (eds.) ICALP 1977. LNCS, vol. 52, pp. 480–491. Springer, Heidelberg (1977)CrossRefGoogle Scholar
  30. 30.
    Sipser, M.: A complexity theoretic approach to randomness. In: Proc. of STOC, pp. 330–335 (1983)Google Scholar
  31. 31.
    Stockmeyer, L.: The complexity of approximate counting. In: Proc. of STOC, pp. 118–126 (1983)Google Scholar
  32. 32.
    Thurley, M.: sharpSAT – counting models with advanced component caching and implicit BCP. In: Biere, A., Gomes, C.P. (eds.) SAT 2006. LNCS, vol. 4121, pp. 424–429. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  33. 33.
    Toda, S.: On the computational power of PP and (+)P. In: Proc. of FOCS, pp. 514–519. IEEE (1989)Google Scholar
  34. 34.
    Trevisan, L.: Lecture notes on computational complexity. Notes written in Fall (2002),
  35. 35.
    Valiant, L.G.: The complexity of enumeration and reliability problems. SIAM Journal on Computing 8(3), 410–421 (1979)MathSciNetCrossRefzbMATHGoogle Scholar
  36. 36.
    Wei, W., Selman, B.: A new approach to model counting. In: Bacchus, F., Walsh, T. (eds.) SAT 2005. LNCS, vol. 3569, pp. 324–339. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  37. 37.
    Yuan, J., Aziz, A., Pixley, C., Albin, K.: Simplifying boolean constraint solving for random simulation-vector generation. IEEE Trans. on CAD of Integrated Circuits and Systems 23(3), 412–420 (2004)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Supratik Chakraborty
    • 1
  • Kuldeep S. Meel
    • 2
  • Moshe Y. Vardi
    • 2
  1. 1.Indian Institute of Technology BombayIndia
  2. 2.Department of Computer ScienceRice UniversityUSA

Personalised recommendations