A Faster FPTAS for #Knapsack

Authors Pawel Gawrychowski, Liran Markin, Oren Weimann

Thumbnail PDF


  • Filesize: 484 kB
  • 13 pages

Document Identifiers

Author Details

Pawel Gawrychowski
  • Institute of Computer Science, University of Wrocław, Poland
Liran Markin
  • University of Haifa, Israel
Oren Weimann
  • University of Haifa, Israel

Cite AsGet BibTex

Pawel Gawrychowski, Liran Markin, and Oren Weimann. A Faster FPTAS for #Knapsack. In 45th International Colloquium on Automata, Languages, and Programming (ICALP 2018). Leibniz International Proceedings in Informatics (LIPIcs), Volume 107, pp. 64:1-64:13, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2018)


Given a set W = {w_1,..., w_n} of non-negative integer weights and an integer C, the #Knapsack problem asks to count the number of distinct subsets of W whose total weight is at most C. In the more general integer version of the problem, the subsets are multisets. That is, we are also given a set {u_1,..., u_n} and we are allowed to take up to u_i items of weight w_i. We present a deterministic FPTAS for #Knapsack running in O(n^{2.5}epsilon^{-1.5}log(n epsilon^{-1})log (n epsilon)) time. The previous best deterministic algorithm [FOCS 2011] runs in O(n^3 epsilon^{-1} log(n epsilon^{-1})) time (see also [ESA 2014] for a logarithmic factor improvement). The previous best randomized algorithm [STOC 2003] runs in O(n^{2.5} sqrt{log (n epsilon^{-1})} + epsilon^{-2} n^2) time. Therefore, for the case of constant epsilon, we close the gap between the O~(n^{2.5}) randomized algorithm and the O~(n^3) deterministic algorithm. For the integer version with U = max_i {u_i}, we present a deterministic FPTAS running in O(n^{2.5}epsilon^{-1.5}log(n epsilon^{-1} log U)log (n epsilon) log^2 U) time. The previous best deterministic algorithm [TCS 2016] runs in O(n^3 epsilon^{-1}log(n epsilon^{-1} log U) log^2 U) time.

Subject Classification

ACM Subject Classification
  • Theory of computation → Design and analysis of algorithms
  • knapsack
  • approximate counting
  • K-approximating sets and functions


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Mohsen Bayati, David Gamarnik, Dimitriy Katz, Chandra Nair, and Prasad Tetali. Simple deterministic approximation algorithms for counting matchings. In STOC, pages 122-127, 2007. Google Scholar
  2. Ilias Diakonikolas, Parikshit Gopalan, Ragesh Jaiswal, Rocco A. Servedio, and Emanuele Viola. Bounded independence fools halfspaces. In FOCS, pages 171-180, 2009. Google Scholar
  3. Martin Dyer. Approximate counting by dynamic programming. In STOC, pages 693-699, 2003. Google Scholar
  4. Martin Dyer, Alan Frieze, Ravi Kannan, Ajai Kapoor, Ljubomir Perkovic, and Umesh Vazirani. A mildly exponential time algorithm for approximating the number of solutions to a multidimensional knapsack problem. Combinatorics, Probability and Computing, 2:271-284, 1993. Google Scholar
  5. Parikshit Gopalan, Adam Klivans, and Raghu Meka. Polynomial-time approximation schemes for knapsack and related counting problems using branching programs. arXiv 1008.3187, 2010. Google Scholar
  6. Parikshit Gopalan, Adam Klivans, Raghu Meka, Daniel Štefankovic, Santosh Vempala, and Eric Vigoda. An FPTAS for #Knapsack and related counting problems. In FOCS, pages 817-826, 2011. Google Scholar
  7. Nir Halman. A deterministic fully polynomial time approximation scheme for counting integer knapsack solutions made easy. Theoretical Computer Science, 645:41-47, 2016. Google Scholar
  8. Nir Halman, Diego Klabjan, Mohamed Mostagir, Jim Orlin, and David Simchi-Levi. A fully polynomial-time approximation scheme for single-item stochastic inventory control with discrete demand. Mathematics of Operations Research, 34(3):674-685, 2009. Google Scholar
  9. Raghu Meka and David Zuckerman. Pseudorandom generators for polynomial threshold functions. In STOC, pages 427-436, 2010. Google Scholar
  10. Ben Morris and Alistair Sinclair. Random walks on truncated cubes and sampling 0-1 knapsack solutions. SIAM journal on computing, 34(1):195-226, 2004. Preliminary version in FOCS 1999. Google Scholar
  11. Yuval Rabani and Amir Shpilka. Explicit construction of a small epsilon-net for linear threshold functions. In STOC, pages 649-658, 2009. Google Scholar
  12. Romeo Rizzi and Alexandru I. Tomescu. Faster FPTASes for counting and random generation of knapsack solutions. In ESA, pages 762-773, 2014. Google Scholar
  13. Daniel Štefankovič, Santosh Vempala, and Eric Vigoda. A deterministic polynomial-time approximation scheme for counting knapsack solutions. SIAM Journal on Computing, 41(2):356-366, 2012. Google Scholar
  14. Dror Weitz. Counting independent sets up to the tree threshold. In STOC, pages 140-149, 2006. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail