0-1 Knapsack in Nearly Quadratic Time (2308.04093v2)
Abstract: We study pseudo-polynomial time algorithms for the fundamental \emph{0-1 Knapsack} problem. Recent research interest has focused on its fine-grained complexity with respect to the number of items $n$ and the \emph{maximum item weight} $w_{\max}$. Under $(\min,+)$-convolution hypothesis, 0-1 Knapsack does not have $O((n+w_{\max}){2-\delta})$ time algorithms (Cygan-Mucha-W\k{e}grzycki-W\l{}odarczyk 2017 and K\"{u}nnemann-Paturi-Schneider 2017). On the upper bound side, currently the fastest algorithm runs in $\tilde O(n + w_{\max}{12/5})$ time (Chen, Lian, Mao, and Zhang 2023), improving the earlier $O(n + w_{\max}3)$-time algorithm by Polak, Rohwedder, and W\k{e}grzycki (2021). In this paper, we close this gap between the upper bound and the conditional lower bound (up to subpolynomial factors): - The 0-1 Knapsack problem has a deterministic algorithm in $O(n + w_{\max}{2}\log4w_{\max})$ time. Our algorithm combines and extends several recent structural results and algorithmic techniques from the literature on knapsack-type problems: - We generalize the "fine-grained proximity" technique of Chen, Lian, Mao, and Zhang (2023) derived from the additive-combinatorial results of Bringmann and Wellnitz (2021) on dense subset sums. This allows us to bound the support size of the useful partial solutions in the dynamic program. - To exploit the small support size, our main technical component is a vast extension of the "witness propagation" method, originally designed by Deng, Mao, and Zhong (2023) for speeding up dynamic programming in the easier unbounded knapsack settings. To extend this approach to our 0-1 setting, we use a novel pruning method, as well as the two-level color-coding of Bringmann (2017) and the SMAWK algorithm on tall matrices.
- Scheduling lower bounds via AND subset sum. J. Comput. Syst. Sci., 127:29–40, 2022. doi:10.1016/j.jcss.2022.01.005.
- SETH-based lower bounds for subset sum and bicriteria path. ACM Trans. Algorithms, 18(1):6:1–6:22, 2022. doi:10.1145/3450524.
- Fast modular subset sum using linear sketching. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, pages 58–69. SIAM, 2019. doi:10.1137/1.9781611975482.4.
- Applications of generalized matrix searching to geometric algorithms. Discret. Appl. Math., 27(1-2):3–23, 1990. doi:10.1016/0166-218X(90)90124-U.
- Geometric applications of a matrix-searching algorithm. Algorithmica, 2:195–208, 1987. doi:10.1007/BF01840359.
- Capacitated dynamic programming: Faster knapsack and graph algorithms. In 46th International Colloquium on Automata, Languages, and Programming, ICALP 2019, volume 132 of LIPIcs, pages 19:1–19:13. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.ICALP.2019.19.
- Color-coding. J. ACM, 42(4):844–856, 1995. doi:10.1145/210332.210337.
- Faster knapsack algorithms via bounded monotone min-plus-convolution. In 49th International Colloquium on Automata, Languages, and Programming, ICALP 2022, volume 229 of LIPIcs, pages 31:1–31:21. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPIcs.ICALP.2022.31.
- Faster 0-1-knapsack via near-convex min-plus-convolution. In 31st Annual European Symposium on Algorithms, ESA 2023, volume 274 of LIPIcs, pages 24:1–24:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPICS.ESA.2023.24.
- Necklaces, convolutions, and X+Y. Algorithmica, 69(2):294–314, 2014. doi:10.1007/s00453-012-9734-3.
- Richard Bellman. Dynamic Programming. Princeton University Press, Princeton, NJ, USA, 1957.
- Faster minimization of tardy processing time on a single machine. Algorithmica, 84(5):1341–1356, 2022. doi:10.1007/s00453-022-00928-w.
- Time bounds for selection. J. Comput. Syst. Sci., 7(4):448–461, 1973. doi:10.1016/S0022-0000(73)80033-9.
- Fast algorithms for knapsack via convolution and prediction. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2018, pages 1269–1282. ACM, 2018. doi:10.1145/3188745.3188876.
- A fine-grained perspective on approximating subset sum and partition. In Proc. 2021 ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1797–1815, 2021. doi:10.1137/1.9781611976465.108.
- Karl Bringmann. A near-linear pseudopolynomial time algorithm for subset sum. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, pages 1073–1084. SIAM, 2017. doi:10.1137/1.9781611974782.69.
- Karl Bringmann. Knapsack with small items in near-quadratic time. arXiv preprint arXiv:2308.03075, 2023. To appear in STOC 2024. arXiv:2308.03075.
- On near-linear-time algorithms for dense subset sum. In Proceedings of the 2021 ACM-SIAM Symposium on Discrete Algorithms, SODA 2021, pages 1777–1796. SIAM, 2021. arXiv:2010.09096, doi:10.1137/1.9781611976465.107.
- Faster min-plus product for monotone instances. In STOC ’22: 54th Annual ACM SIGACT Symposium on Theory of Computing, pages 1529–1542. ACM, 2022. doi:10.1145/3519935.3520057.
- Solving dense subset-sum problems by using analytical number theory. J. Complexity, 5(3):271–282, 1989. doi:10.1016/0885-064X(89)90025-3.
- Subset sums, completeness and colorings. arXiv preprint arXiv:2104.14766, 2021. arXiv:2104.14766.
- Sensitivity theorems in integer linear programming. Math. Program., 34(3):251–264, 1986. doi:10.1007/BF01582230.
- More on change-making and related problems. J. Comput. Syst. Sci., 124:159–169, 2022. doi:10.1016/j.jcss.2021.09.005.
- Mark Chaimovich. New algorithm for dense subset-sum problem. Number 258, pages xvi, 363–373. 1999. Structure theory of set addition.
- Mark Chaimovich. New structural approach to integer programming: a survey. Number 258, pages xv–xvi, 341–362. 1999. Structure theory of set addition.
- Timothy M. Chan. Approximation schemes for 0-1 knapsack. In 1st Symposium on Simplicity in Algorithms, SOSA 2018, volume 61 of OASIcs, pages 5:1–5:12. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2018. doi:10.4230/OASIcs.SOSA.2018.5.
- Clustered integer 3SUM via additive combinatorics. In Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, STOC 2015, pages 31–40. ACM, 2015. doi:10.1145/2746539.2746568.
- A nearly quadratic-time FPTAS for knapsack. CoRR, abs/2308.07821, 2023. To appear in STOC 2024. arXiv:2308.07821.
- Faster algorithms for bounded knapsack and bounded subset sum via fine-grained proximity results. In Proceedings of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 4828–4848, 2024. arXiv:2307.12582, doi:10.1137/1.9781611977912.171.
- On problems equivalent to (min, +)-convolution. ACM Trans. Algorithms, 15(1):14:1–14:25, 2019. doi:10.1145/3293465.
- Deterministic APSP, orthogonal vectors, and more: Quickly derandomizing Razborov-Smolensky. ACM Trans. Algorithms, 17(1):2:1–2:14, 2021. doi:10.1145/3402926.
- Approximating knapsack and partition via dense subset sums. In Proceedings of the 2023 ACM-SIAM Symposium on Discrete Algorithms, SODA 2023, pages 2961–2979. SIAM, 2023. arXiv:2301.09333, doi:10.1137/1.9781611977554.ch113.
- On problems related to unbounded subsetsum: A unified combinatorial approach. In Proceedings of the 2023 ACM-SIAM Symposium on Discrete Algorithms, SODA 2023, pages 2980–2990. SIAM, 2023. doi:10.1137/1.9781611977554.ch114.
- P. Erdős and A. Sárközy. On a problem of Straus. In Disorder in physical systems, Oxford Sci. Publ., pages 55–66. Oxford Univ. Press, New York, 1990.
- Carathéodory bounds for integer cones. Oper. Res. Lett., 34(5):564–568, 2006. doi:10.1016/j.orl.2005.09.008.
- Proximity results and faster algorithms for integer programming using the steinitz lemma. ACM Trans. Algorithms, 16(1):5:1–5:14, 2020. doi:10.1145/3340322.
- Gregory A. Freiman. On extremal additive problems of Paul Erdős. Ars Combin., 26(B):93–114, 1988.
- G. A. Freiman. Subset-sum problem with different summands. In Proceedings of the Twentieth Southeastern Conference on Combinatorics, Graph Theory, and Computing (Boca Raton, FL, 1989), volume 70, pages 207–215, 1990.
- Gregory A. Freiman. New analytical results in subset-sum problem. volume 114, pages 205–217. 1993. Combinatorics and algorithms (Jerusalem, 1988). doi:10.1016/0012-365X(93)90367-3.
- An almost linear-time algorithm for the dense subset-sum problem. SIAM J. Comput., 20(6):1157–1189, 1991. doi:10.1137/0220072.
- Computing partitions with applications to the knapsack problem. Journal of the ACM, 21(2):277–292, 1974. doi:10.1145/321812.321823.
- Simple and faster algorithms for knapsack. In 2024 Symposium on Simplicity in Algorithms (SOSA), pages 56–62, 2024. doi:10.1137/1.9781611977936.6.
- Ce Jin. An improved FPTAS for 0-1 knapsack. In 46th International Colloquium on Automata, Languages, and Programming, ICALP 2019, volume 132 of LIPIcs, pages 76:1–76:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.ICALP.2019.76.
- On integer programming and convolution. In 10th Innovations in Theoretical Computer Science Conference, ITCS 2019, volume 124 of LIPIcs, pages 43:1–43:17. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.ITCS.2019.43.
- On integer programming, discrepancy, and convolution. Mathematics of Operations Research, 0(0):1–15, 2022. doi:10.1287/moor.2022.1308.
- Richard M. Karp. Reducibility among combinatorial problems. In Proceedings of a symposium on the Complexity of Computer Computations, held March 20-22, 1972, at the IBM Thomas J. Watson Research Center, Yorktown Heights, New York, USA, The IBM Research Symposia Series, pages 85–103. Plenum Press, New York, 1972. doi:10.1007/978-1-4684-2001-2_9.
- Kim-Manuel Klein. On the fine-grained complexity of the unbounded subsetsum and the frobenius problem. In Proceedings of the 2022 ACM-SIAM Symposium on Discrete Algorithms, SODA 2022, pages 3567–3582. SIAM, 2022. doi:10.1137/1.9781611977073.141.
- Improved dynamic programming in connection with an FPTAS for the knapsack problem. J. Comb. Optim., 8(1):5–11, 2004. doi:10.1023/B:JOCO.0000021934.29833.6b.
- Knapsack problems. Springer, 2004. doi:10.1007/978-3-540-24777-7.
- On minimizing tardy processing time, max-min skewed convolution, and triangular structured ilps. In Proceedings of the 2023 ACM-SIAM Symposium on Discrete Algorithms, SODA 2023, pages 2947–2960. SIAM, 2023. doi:10.1137/1.9781611977554.ch112.
- On the fine-grained complexity of one-dimensional dynamic programming. In 44th International Colloquium on Automata, Languages, and Programming, ICALP 2017, volume 80 of LIPIcs, pages 21:1–21:15. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2017. doi:10.4230/LIPIcs.ICALP.2017.21.
- Faster pseudopolynomial time algorithms for subset sum. ACM Trans. Algorithms, 15(3):40:1–40:20, 2019. doi:10.1145/3329863.
- Monochromatic triangles, intermediate matrix products, and convolutions. In 11th Innovations in Theoretical Computer Science Conference, ITCS 2020, volume 151 of LIPIcs, pages 53:1–53:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPIcs.ITCS.2020.53.
- Xiao Mao. (1-ϵitalic-ϵ\epsilonitalic_ϵ)-approximation of knapsack in nearly quadratic time. CoRR, abs/2308.07004, 2023. To appear in STOC 2024. arXiv:2308.07004.
- A subquadratic approximation scheme for partition. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, pages 70–88. SIAM, 2019. doi:10.1137/1.9781611975482.5.
- David Pisinger. Linear time algorithms for knapsack problems with bounded weights. J. Algorithms, 33(1):1–14, 1999. doi:10.1006/jagm.1999.1034.
- Knapsack and subset sum with small items. In 48th International Colloquium on Automata, Languages, and Programming, ICALP 2021, volume 198 of LIPIcs, pages 106:1–106:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2021. arXiv:2105.04035, doi:10.4230/LIPIcs.ICALP.2021.106.
- Prabhakar Raghavan. Probabilistic construction of deterministic algorithms: Approximating packing integer programs. J. Comput. Syst. Sci., 37(2):130–143, 1988. doi:10.1016/0022-0000(88)90003-7.
- A. Sárközy. Finite addition theorems. I. J. Number Theory, 32(1):114–130, 1989. doi:10.1016/0022-314X(89)90102-9.
- A. Sárközy. Finite addition theorems. II. J. Number Theory, 48(2):197–218, 1994. doi:10.1006/jnth.1994.1062.
- Joel Spencer. Ten lectures on the probabilistic method. In Proc. CBMS-NRM Regional Conference Series in Applied Mathematics, volume 52. SIAM, 1987.
- A T=O(2n/2)𝑇𝑂superscript2𝑛2T=O(2^{n/2})italic_T = italic_O ( 2 start_POSTSUPERSCRIPT italic_n / 2 end_POSTSUPERSCRIPT ), S=O(2n/4)𝑆𝑂superscript2𝑛4S=O(2^{n/4})italic_S = italic_O ( 2 start_POSTSUPERSCRIPT italic_n / 4 end_POSTSUPERSCRIPT ) algorithm for certain NP-complete problems. SIAM Journal on Computing, 10(3):456–464, 1981. doi:10.1137/0210033.
- E. Szemerédi and V. H. Vu. Finite and infinite arithmetic progressions in sumsets. Ann. of Math. (2), 163(1):1–35, 2006. doi:10.4007/annals.2006.163.1.
- R. Ryan Williams. Faster all-pairs shortest paths via circuit complexity. SIAM J. Comput., 47(5):1965–1985, 2018. doi:10.1137/15M1024524.