An Improved Unbounded-DP Algorithm for the Unbounded Knapsack Problem with Bounded Coefficients
Abstract
:1. Introduction
1.1. Our Results
1.2. Sketch of Proof Techniques
1.3. Organization of the Paper
2. Preliminary
2.1. Dynamic Programming
Algorithm 1 Unbounded-DP |
Require: Ensure:
|
2.2. Branch and Bound
2.3. Linear Diophantine Equation
3. A Constant Time Complexity Algorithm for the UKPB
3.1. An Upper Bound for the Selected Times of the Type in Set
3.2. An Algorithm for Types of Set
- Case 1. When , we can solve the problem exactly by directly applying the unbounded-DP within a time complexity of and a space complexity of .
- Case 2. When , there exists a value of such that within the interval . According to Theorem 4, there must be a non-negative integer solution such that
3.3. Complexity Analysis
Algorithm 2 Our algorithm for UKPB |
Require: Ensure:
|
3.4. A Small Instance
j | 1 | 2 | 3 |
6 | 7 | 4 | |
6 | 7 | 5 |
- Step 1.
- The Euclidean algorithm is used to obtain and .
- Step 2.
- Calling unbounded-DP to solve and , respectively, we obtain iterative arrays and . The capacity of is and that of is , respectively.
- Step 3.
- The temporary array A is obtained by iterating through a loop indexed by t. For example, when , we have . Consequently,
- Step 4.
- Finding the value of k via a search process, and subsequently utilizing unbounded-DP to determine the optimal solution
4. The Algorithm for the AUKP
Algorithm 3 Our algorithm for AUKP |
Require: Ensure:
|
5. Conclusions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
UKPB | Unbounded Knapsack Problem with Bounded coefficients |
B&B | Branch and Bound |
LDE | Linear Diophantine Equation |
AUKP | All-capacities Unbounded Knapsack Problem |
References
- Martello, S.; Toth, P. Knapsack Problems: Algorithms and Computer Implementations; John Wiley & Sons: Chichester, UK, 1990. [Google Scholar]
- Kellerer, H.; Pferschy, U.; Pisinger, D. Knapsack Problems; Springer: Berlin/Heidelberg, Germany, 2004. [Google Scholar]
- Cacchiani, V.; Iori, M.; Locatelli, A.; Martello, S. Knapsack problems—An overview of recent advances. Part I: Single knapsack problems. Comput. Oper. Res. 2022, 143, 105692. [Google Scholar] [CrossRef]
- Cacchiani, V.; Iori, M.; Locatelli, A.; Martello, S. Knapsack problems—An overview of recent advances. Part II: Multiple, multidimensional, and quadratic knapsack problems. Comput. Oper. Res. 2022, 143, 105693. [Google Scholar] [CrossRef]
- Becker, H.; Buriol, L.S. An empirical analysis of exact algorithms for the unbounded knapsack problem. Eur. J. Oper. Res. 2019, 277, 84–99. [Google Scholar] [CrossRef]
- Papadimitriou, C.H. On the complexity of integer programming. J. ACM 1981, 28, 765–768. [Google Scholar] [CrossRef]
- Sun, X.L.; Li, D. Integer Programming; Science Press: Beijing, China, 2010. (In Chinese) [Google Scholar]
- Wolsey, L.A. Integer Programming; John Wiley & Sons: Chichester, UK, 2020. [Google Scholar]
- Conforti, M.; Cornuejols, G.; Zambelli, G. Integer Programming. In Ser. Graduate Texts in Mathematics; Springer: Cham, Switzerland, 2014. [Google Scholar]
- Cook, S.A. The complexity of theorem-proving procedures. In Proceedings of the 3rd Annual ACM Symposium on Theory of Computing(STOC 1971), Shaker Heights, ON, USA, 3–5 May 1971; pp. 151–158. [Google Scholar]
- Karp, R.M. Reducibility among Combinatorial Problems. In Complexity of Computer Computations; Miller, R.E., Thatcher, J.W., Bohlinger, J.D., Eds.; Springer: Boston, MA, USA, 1972; pp. 85–103. [Google Scholar]
- Hannusch, C.; Major, S.R. Torch: Software Package for the Search Of Linear Binary Codes. In Proceedings of the 2nd Conference on Information Technology and Data Science (CITDS 2022), Debrecen, Hungary, 16–18 May 2022; pp. 103–106. [Google Scholar]
- Chan, T.M.; He, Q.Z. More on change-making and related problems. J. Comput. Syst. Sci. 2022, 124, 159–169. [Google Scholar] [CrossRef]
- Sapir, M.V.; Birget, J.C.; Rips, E. Isoperimetric and isodiametric functions of groups. Ann. Math. 2002, 156, 345–466. [Google Scholar] [CrossRef]
- Dinur, I.; Safra, S. On the hardness of approximating vertex cover. Ann. Math. 2005, 162, 439–485. [Google Scholar] [CrossRef]
- Garey, M.R.; Johnson, D.S. Computer and Intractablility: A Guide to the Theory of NP-Completeness; Freeman: San Francisco, CA, USA, 1979. [Google Scholar]
- Bellman, R. Dynamic Programming; Princeton University Press: Princeton, NJ, USA, 1957. [Google Scholar]
- Ailsa, H.L.; Alison, G.D. An automatic method of solving discrete programming problem. Econometrica 1960, 28, 497–520. [Google Scholar]
- Dantzig, G.B. Discrete-Variable Extremum Problems. Oper. Res. 1957, 5, 266–288. [Google Scholar] [CrossRef]
- Gomory, R.E.; Johnson, E.L. T-space and cutting planes. Math. Prog. 2003, 96, 341–375. [Google Scholar] [CrossRef]
- Lee, Y.T.; Sidford, A.; Wong, S.C.-W. A Faster Cutting Plane Method and its Implications for Combinatorial and Convex Optimization. In Proceedings of the 2015 IEEE 56th Annual Symposium on Foundations of Computer Science (FOCS 2015), Berkeley, CA, USA, 17–20 October 2015; pp. 1049–1065. [Google Scholar]
- Pisinger, D. A Minimal Algorithm for the 0–1 Knapsack Problem. Oper. Res. 1997, 46, 758–767. [Google Scholar] [CrossRef]
- Martello, S.; Pisinger, D.; Toth, P. Dynamic programming and strong bounds for the 0-1 knapsack problem. Manag. Sci. 1999, 45, 414–424. [Google Scholar] [CrossRef]
- Bianchessi, N.; Irnich, S. Branch-and-Cut for the Split Delivery Vehicle Routing Problem with Time Windows. Transport. Sci. 2019, 53, 442–462. [Google Scholar] [CrossRef]
- Gmys, J.; Mezmaz, M.; Melab, N.; Tuyttens, D. A computationally efficient Branch-and-Bound algorithm for the permutation flow-shop scheduling problem. Eur. J. Oper. Res. 2020, 284, 814–833. [Google Scholar] [CrossRef]
- Martello, S.; Toth, P. A Mixture of Dynamic Programming and Branch-andBound for the Subset-Sum Problem. Manag. Sci. 1984, 30, 765–771. [Google Scholar] [CrossRef]
- Bringmann, K. A Near-Linear Pseudopolynomial Time Algorithm for Subset Sum. In Proceedings of the 28th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2017), Barcelona, Spain, 16–19 January 2017; pp. 1073–1084. [Google Scholar]
- Koiliaris, K.; Xu, C. Faster Pseudopolynomial Time Algorithms for Subset Sum. ACM Trans. Algorithms 2019, 15, 1–20. [Google Scholar] [CrossRef]
- Deng, M.Y.; Mao, X.; Zhong, Z.Q. On Problems Related to Unbounded SubsetSum: A Unified Combinatorial Approach. In Proceedings of the 34th Annual ACM Symposium on Theory of Computing (SODA 2023), Florence, Italy, 22–25 January 2023; pp. 2980–2990. [Google Scholar]
- Magazine, M.J.; Nemhauser, G.L.; Trotter, L.E., Jr. When the Greedy Solution Solves a Class of Knapsack Problems. Oper. Res. 1975, 23, 207–217. [Google Scholar] [CrossRef]
- Hu, T.C.; Lenard, M.L. Technical Note-Optimality of a Heuristic Solution for a Class of Knapsack Problems. Oper. Res. 1976, 24, 193–196. [Google Scholar] [CrossRef]
- Zukermana, M.; Jia, L.; Neame, T.; Woeginger, G.J. A polynomially solvable special case of the unbounded knapsack problem. Oper. Res. Lett. 2001, 29, 13–16. [Google Scholar] [CrossRef]
- Deineko, V.G.; Woeginger, G.J. Unbounded knapsack problems with arithmetic weight sequences. Eur. J. Oper. Res. 2011, 213, 384–387. [Google Scholar] [CrossRef]
- Adams, W.; Belotti, P.; Shen, R.B. Convex Hull Characterizations of Lexicographic Orderings. J. Global Optim. 2016, 66, 311–329. [Google Scholar] [CrossRef]
- Hirschberg, D.S.; Wong, C.K. A Polynomial-Time Algorithm for the Knapsack Problem with Two Variables. J. ACM 1976, 23, 147–154. [Google Scholar] [CrossRef]
- Kannan, R. A Polynomial Algorithm for the Two-Variable Integer Programming Problem. J. ACM 1980, 27, 118–122. [Google Scholar] [CrossRef]
- Scarf, H.E. Production Sets with Indivisibilities, Part I: Generalities. Econometrica 1981, 49, 1–32. [Google Scholar] [CrossRef]
- Lenstra, H.W., Jr. Integer Programming with a Fixed Number of Variables. Math. Oper. Res. 1983, 8, 533–548. [Google Scholar] [CrossRef]
- Chen, J.E.; Liu, Y.; Lu, S.J.; O’sullivan, B.; Razgon, I. A fixed-parameter algorithm for the directed feedback vertex set problem. J. ACM 2008, 55, 1–19. [Google Scholar]
- Bateni, M.; Hajiaghayi, M.; Seddighin, S.; Stein, C. Fast algorithms for knapsack via convolution and prediction. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing (STOC 2018), Los Angeles, CA, USA, 25–29 June 2018; pp. 1269–1282. [Google Scholar]
- Axiotis, K.; Tzamos, C. Capacitated Dynamic Programming: Faster Knapsack and Graph Algorithms. In Proceedings of the 46th International Colloquium on Automata, Languages, and Programming (ICALP 2019), Patras, Greece, 9–12 July 2019; Volume 19, pp. 1–13. [Google Scholar]
- Bringmann, K.; Cassis, A. Faster Knapsack Algorithms via Bounded Monotone Min-Plus-Convolution. In Proceedings of the 49th International Colloquium on Automata, Languages, and Programming (ICALP 2022), Paris, France, 4–8 July 2022; Volume 31, pp. 1–21. [Google Scholar]
- Chen, L.; Lian, J.Y.; Mao, Y.C.; Zhang, G.C. 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 2024), Alexandria, WV, USA, 7–10 January 2024; pp. 4828–4848. [Google Scholar]
- Jansen, K.; Rohwedder, L. On integer programming and convolution. Math. Oper. Res. 2023, 48, 1481–1495. [Google Scholar] [CrossRef]
- Dey, S.S.; Dubey, Y.; Molinaro, M. Branch-and-bound solves random binary IPs in poly(n)-time. Math. Prog. 2023, 200, 569–587. [Google Scholar] [CrossRef]
- Greenberg, H. An Algorithm for a Linear Diophantine Equation and a Problem of Frobenius. Numer. Math. 1980, 34, 349–352. [Google Scholar] [CrossRef]
- Chou, T.-W.J.; Collins, G.E. Algorithms for the Solution of Systems of Linear Diophantine Equations. SIAM J. Comput. 1982, 11, 687–708. [Google Scholar] [CrossRef]
- Dahmen, W.; Micchelli, C.A. The number of solutions to linear Diophantine equations and multivariate splines. Trans. Am. Math. Soc. 1988, 308, 509–532. [Google Scholar] [CrossRef]
- Ireland, K.; Rosen, M. A Classical Introduction to Modern Number Theory. In Ser. Graduate Texts in Mathematics; Springer: New York, NY, USA, 1990. [Google Scholar]
- Contejean, E.; Devie, H. An Efficient Incremental Algorithm for Solving Systems of Linear Diophantine Equations. Inform. Comput. 1994, 113, 143–172. [Google Scholar] [CrossRef]
- Rosen, K.H. Elementary Number Theory and Its Applications, 5th ed.; Addison-Wesley: Boston, MA, USA, 2005. [Google Scholar]
- Alfonsin, J.R. The Diophantine Frobenius Problem. In Ser. Oxford Lectures Series in Mathematics and Its Applications; Oxford University Press: New York, NY, USA, 2005. [Google Scholar]
- Evertse, J.-H.; Györy, K. Effective Results and Methods for Diophantine Equations over Finitely Generated Domains; Cambridge University Press: Cambridge, UK, 2022. [Google Scholar]
- Marklof, J. The asymptotic distribution of Frobenius numbers. Invent. Math. 2010, 181, 179–207. [Google Scholar] [CrossRef]
- Aliev, I.; Henk, M.; Hinrichs, A. Expected Frobenius numbers. J. Comb. Theory A 2011, 118, 525–531. [Google Scholar] [CrossRef]
- Fukshansky, L.; Schürmann, A. Bounds on generalized Frobenius numbers. Eur. J. Combin. 2011, 32, 361–368. [Google Scholar] [CrossRef]
- Andonov, R.; Poirriez, V.; Rajopadhye, S. Unbounded knapsack problem: Dynamic programming revisited. Eur. J. Oper. Res. 2000, 123, 394–407. [Google Scholar] [CrossRef]
- Pisinger, D. Dynamic programming on the word RAM. Algorithmica 2003, 35, 128–145. [Google Scholar] [CrossRef]
- Boyd, S.; Vandenberghe, L. Convex Optimization; Cambridge University Press: Cambridge, UK, 2004. [Google Scholar]
- Yang, Y. An upper bound of the mutation probability in the genetic algorithm for general 0–1 knapsack problem. arXiv 2024, arXiv:2403.11307. [Google Scholar]
- Shallit, J. Origins of the analysis of the Euclidean algorithm. Hist. Math. 1994, 21, 401–419. [Google Scholar] [CrossRef]
- Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms, 4th ed.; The MIT Press: Cambridge, UK, 2022. [Google Scholar]
- Everest, G.; Ward, T. An Introduction to Number Theory. In Ser. Graduate Texts in Mathematics; Springer: London, UK, 2005. [Google Scholar]
- Brauer, A. On a problem of partitions. Am. J. Math. 1942, 64, 299–312. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Yang, Y. An Improved Unbounded-DP Algorithm for the Unbounded Knapsack Problem with Bounded Coefficients. Mathematics 2024, 12, 1878. https://doi.org/10.3390/math12121878
Yang Y. An Improved Unbounded-DP Algorithm for the Unbounded Knapsack Problem with Bounded Coefficients. Mathematics. 2024; 12(12):1878. https://doi.org/10.3390/math12121878
Chicago/Turabian StyleYang, Yang. 2024. "An Improved Unbounded-DP Algorithm for the Unbounded Knapsack Problem with Bounded Coefficients" Mathematics 12, no. 12: 1878. https://doi.org/10.3390/math12121878
APA StyleYang, Y. (2024). An Improved Unbounded-DP Algorithm for the Unbounded Knapsack Problem with Bounded Coefficients. Mathematics, 12(12), 1878. https://doi.org/10.3390/math12121878