# Not all FPRASs are equal: demystifying FPRASs for DNF-counting

## Abstract

The problem of counting the number of solutions of a DNF formula, also called #DNF, is a fundamental problem in artificial intelligence with applications in diverse domains ranging from network reliability to probabilistic databases. Owing to the intractability of the exact variant, efforts have focused on the design of approximate techniques for #DNF. Consequently, several Fully Polynomial Randomized Approximation Schemes (FPRASs) based on Monte Carlo techniques have been proposed. Recently, it was discovered that hashing-based techniques too lend themselves to FPRASs for #DNF. Despite significant improvements, the complexity of the hashing-based FPRAS is still worse than that of the best Monte Carlo FPRAS by polylog factors. Two questions were left unanswered in previous works: Can the complexity of the hashing-based techniques be improved? How do the various approaches stack up against each other empirically? In this paper, we first propose a new search procedure for the hashing-based FPRAS that removes the polylog factors from its time complexity. We then present the first empirical study of runtime behavior of different FPRASs for #DNF. The result of our study produces a nuanced picture. First of all, we observe that there is no single best algorithm that outperforms all others for all classes of formulas and input parameters. Second, we observe that the algorithm with one of the worst time complexities solves the largest number of benchmarks.

## Keywords

Model counting Hashing Disjunctive normal form Boolean formulas Fully polynomial randomized approximation scheme ApproxMC## Notes

### Acknowledgements

The authors would like to thank anonymous reviewers for their insightful comments and suggestions. Moshe Y. Vardi and Aditya A. Shrotri’s work was supported in parts by NSF grant IIS-1527668, NSF Expeditions in Computing project “ExCAPE: Expeditions in Computer Augmented Program Engineering”. Kuldeep S. Meel’s work was supported in parts by NUS ODPRT Grant R-252-000-685-133, AI Singapore Grant R-252-000-A16-490, and Sung Kah Kay Assistant Professorship Fund.

## References

- 1.Dueñas-Osorio, L., Meel, K.S., Paredes, R., Vardi, M.Y. (2017). Counting-based reliability estimation for power-transmission grids. In
*Proceedings of AAAI conference on artificial intelligence (AAAI)*.Google Scholar - 2.Bacchus, F., Dalmao, S., Pitassi, T. (2003). Algorithms and complexity results for #SAT and Bayesian inference, In
*Proceedings of FOCS*(pp. 340–351) ISBN: 0-7695-2040-5. http://dl.acm.org/citation.cfm?id=946243.946291. - 3.Sang, T., Beame, P., Kautz, H. (2005). Performing Bayesian inference by weighted model counting. In
*Prof. of AAAI*(pp. 475–481).Google Scholar - 4.Dalvi, N., & Suciu, D. (2007). Efficient query evaluation on probabilistic databases.
*The VLDB Journal*,*16*(4), 523–544.CrossRefGoogle Scholar - 5.Biondi, F., Enescu, M., Heuser, A., Legay, A., Meel, K.S., Quilbeuf, J. (2018). Scalable approximation of quantitative information flow in programs. In
*Proceedings of VMCAI*.Google Scholar - 6.Karger, D.R. (2001). A randomized fully polynomial time approximation scheme for the all-terminal network reliability problem.
*SIAM Review*.Google Scholar - 7.Valiant, L.G. (1979). The complexity of enumeration and reliability problems.
*SIAM Journal on Computing*,*8*(3), 410–421.MathSciNetCrossRefGoogle Scholar - 8.Karp, R.M., & Luby, M. (1983). Monte Carlo algorithms for enumeration and reliability problems. In
*Proceedings of FOCS*.Google Scholar - 9.Karp, R.M., Luby, M., Madras, N. (1989). Monte Carlo approximation algorithms for enumeration problems.
*Journal of Algorithms*,*10*(3), 429–448.MathSciNetCrossRefGoogle Scholar - 10.Vazirani, V.V. (2013).
*Approximation algorithms*. Springer Science & Business Media.Google Scholar - 11.Dagum, P., Karp, R., Luby, M., Ross, S. (2000). An optimal algorithm for Monte Carlo estimation.
*SIAM Journal on Computing*,*29*(5), 1484–1496.MathSciNetCrossRefGoogle Scholar - 12.Chakraborty, S., Meel, K.S., Vardi, M.Y. (2016). Algorithmic improvements in approximate counting for probabilistic inference: from linear to logarithmic SAT call. In
*Proceedings of IJCAI*.Google Scholar - 13.Meel, K.S., Shrotri, A.A., Vardi, M.Y. (2017). On hashing-based approaches to approximate DNF-counting. In
*Proceedings of FSTTCS*.Google Scholar - 14.Ermon, S., Gomes, C.P., Sabharwal, A., Selman, B. (2013). Taming the curse of dimensionality: discrete integration by hashing and optimization. In
*Proceedings of ICML*(pp. 334–342).Google Scholar - 15.Meel, K.S. (2018). Constrained counting and sampling: bridging the gap between theory and practice. arXiv:1806.02239.
- 16.Carter, J.L., & Wegman, M.N. (1977). Universal classes of hash functions. In
*Proceedings of STOC*(pp. 106–112). ACM.Google Scholar - 17.Luby, M., & Veličković, B. (1996). On deterministic approximation of DNF.
*Algorithmica*,*16*(4), 415–433.MathSciNetCrossRefGoogle Scholar - 18.Trevisan, L. (2004). A note on approximate counting for k-DNF. In
*Approximation, randomization, and combinatorial optimization. Algorithms and techniques*(pp. 417–425). Springer.Google Scholar - 19.Gopalan, P., Meka, R., Reingold, O. (2013). DNF sparsification and a faster deterministic counting algorithm.
*Computational Complexity*.Google Scholar - 20.Ajtai, M., & Wigderson, A. (1985). Deterministic simulation of probabilistic constant depth circuits. In
*Proceedings of FOCS*(pp. 11–19). IEEE.Google Scholar - 21.Nisan, N. (1991). Pseudorandom bits for constant depth circuits.
*Combinatorica*,*11*(1), 63–70.MathSciNetCrossRefGoogle Scholar - 22.De, A., Etesami, O., Trevisan, L., Tulsiani, M. (2010). Improved pseudorandom generators for depth 2 circuits. In
*Approximation, randomization, and combinatorial optimization. Algorithms and techniques*(pp. 504–517). Springer.Google Scholar - 23.Olteanu, D., Huang, J., Koch, C. (2010). Approximate confidence computation in probabilistic databases. In
*ICDE*(pp. 145–156). IEEE.Google Scholar - 24.Fink, R., & Olteanu, D. (2011). On the optimal approximation of queries using tractable propositional languages. In
*Proceedings of ICDT*. ACM.Google Scholar - 25.Gatterbauer, W., & Suciu, D. (2014). Oblivious bounds on the probability of Boolean functions.
*ACM TODS*,*39*(1), 5.MathSciNetCrossRefGoogle Scholar - 26.Tao, Q., Scott, S., Vinodchandran, N.V., Osugi, T.T. (2004). SVM-based generalized multiple-instance learning via approximate box counting. In
*Proceedings of the twenty-first international conference on machine learning*(p. 101). ACM.Google Scholar - 27.Babai, L. (1979). Monte-Carlo algorithms in graph isomorphism testing. Université tde Montréal Technical Report. DMS, pp 79–10.Google Scholar
- 28.Motwani, R., & Raghavan, P. (2010). Randomized algorithms.Google Scholar
- 29.Albrecht, M., & Bard, G. (2012). The M4RI Library – Version 20121224. http://m4ri.sagemath.org.
- 30.Huang, J., Antova, L., Koch, C., Olteanu, D. (2009). MayBMS: a probabilistic database management system. In
*Proceedings of SIGMOD*. ACM.Google Scholar - 31.TPC Benchmark H. http://www.tpc.org/.
- 32.Mitchell, D., Selman, B., Levesque, H. (1992). Hard and easy distributions of SAT problems. In
*Proceedings of AAAI*(pp. 459–465).Google Scholar - 33.Thurley, M. (2006). SharpSAT: counting models with advanced component caching and implicit BCP. In
*Proceedings of SAT*(pp. 424–429).Google Scholar - 34.Chakraborty, S., Meel, K.S., Vardi, M.Y. (2013). A scalable approximate model counter. In
*Proceedings of CP*(pp. 200–216).Google Scholar