Removable Online Knapsack and Advice

Authors Hans-Joachim Böckenhauer , Fabian Frei , Peter Rossmanith

Thumbnail PDF


  • Filesize: 0.69 MB
  • 17 pages

Document Identifiers

Author Details

Hans-Joachim Böckenhauer
  • Department of Computer Science, ETH Zürich, Switzerland
Fabian Frei
  • CISPA Helmholtz Center for Information Security, Saarbrücken, Germany
Peter Rossmanith
  • Department of Computer Science, RWTH Aachen, Germany

Cite AsGet BibTex

Hans-Joachim Böckenhauer, Fabian Frei, and Peter Rossmanith. Removable Online Knapsack and Advice. In 41st International Symposium on Theoretical Aspects of Computer Science (STACS 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 289, pp. 18:1-18:17, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)


In the proportional knapsack problem, we are given a knapsack of some capacity and a set of variably sized items. The goal is to pack a selection of these items that fills the knapsack as much as possible. The online version of this problem reveals the items and their sizes not all at once but one by one. For each item, the algorithm has to decide immediately whether to pack it or not. We consider a natural variant of this online knapsack problem, which has been coined removable knapsack. It differs from the classical variant by allowing the removal of any packed item from the knapsack. Repacking is impossible, however: Once an item is removed, it is gone for good. We analyze the advice complexity of this problem. It measures how many advice bits an omniscient oracle needs to provide for an online algorithm to reach any given competitive ratio, which is - understood in its strict sense - just the algorithm’s approximation factor. The online knapsack problem is known for its peculiar advice behavior involving three jumps in competitivity. We show that the advice complexity of the version with removability is quite different but just as interesting: The competitivity starts from the golden ratio when no advice is given. It then drops down to 1+ε for a constant amount of advice already, which requires logarithmic advice in the classical version. Removability comes as no relief to the perfectionist, however: Optimality still requires linear advice as before. These results are particularly noteworthy from a structural viewpoint for the exceptionally slow transition from near-optimality to optimality. Our most important and demanding result shows that the general knapsack problem, which allows an item’s value to differ from its size, exhibits a similar behavior for removability, but with an even more pronounced jump from an unbounded competitive ratio to near-optimality within just constantly many advice bits. This is a unique behavior among the problems considered in the literature so far. An advice analysis is interesting in its own right, as it allows us to measure the information content of a problem and leads to structural insights. But it also provides insurmountable lower bounds, applicable to any kind of additional information about the instances, including predictions provided by machine-learning algorithms and artificial intelligence. Unexpectedly, advice algorithms are useful in various real-life situations, too. For example, they provide smart strategies for cooperation in winner-take-all competitions, where several participants pool together to implement different strategies and share the obtained prize. Further illustrating the versatility of our advice-complexity bounds, our results automatically improve some of the best known lower bounds on the competitive ratio for removable knapsack with randomization. The presented advice algorithms also automatically yield deterministic algorithms for established deterministic models such as knapsack with a resource buffer and various problems with more than one knapsack. In their seminal paper introducing removability to the knapsack problem, Iwama and Taketomi have indeed proposed a multiple knapsack problem for which we can establish a one-to-one correspondence with the advice model; this paper therefore even provides a comprehensive analysis for this up until now neglected problem.

Subject Classification

ACM Subject Classification
  • Theory of computation → Online algorithms
  • Removable Online Knapsack
  • Multiple Knapsack
  • Advice Analysis
  • Advice Applications
  • Machine Learning and AI


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


  1. Richard Bellman. Dynamic Programming. Princeton University Press, Princeton, NJ, USA, 1957. Google Scholar
  2. Hans-Joachim Böckenhauer, Elisabet Burjons, Juraj Hromkovič, Henri Lotze, and Peter Rossmanith. Online simple knapsack with reservation costs. In Markus Bläser and Benjamin Monmege, editors, 38th International Symposium on Theoretical Aspects of Computer Science, STACS 2021, March 16-19, 2021, Saarbrücken, Germany (Virtual Conference), volume 187 of LIPIcs, pages 16:1-16:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2021. Google Scholar
  3. Hans-Joachim Böckenhauer, Dennis Komm, Rastislav Královič, Richard Královič, and Tobias Mömke. On the advice complexity of online problems. In ISAAC 2009, number 5878 in LNCS, pages 331-340, 2009. Google Scholar
  4. Hans-Joachim Böckenhauer, Dennis Komm, Richard Královič, and Peter Rossmanith. The online knapsack problem: Advice and randomization. Theoretical Computer Science, 527:61-72, 2014. Google Scholar
  5. Allan Borodin and Ran El-Yaniv. Online computation and competitive analysis. Cambridge University Press, 1998. Google Scholar
  6. Joan Boyar, Lene M. Favrholdt, Christian Kudahl, Kim S. Larsen, and Jesper W. Mikkelsen. Online algorithms with advice: A survey. ACM Comput. Surv., 50(2):19:1-19:34, 2017. Google Scholar
  7. Marek Cygan, Łukasz Jeż, and Jiří Sgall. Online knapsack revisited. Theory Comput. Syst., 58(1):153-190, 2016. Google Scholar
  8. George B. Dantzig. Discrete-variable extremum problems. Operations Research, 5(2):266-277, 1957. Google Scholar
  9. Yuval Emek, Pierre Fraigniaud, Amos Korman, and Adi Rosén. Online computation with advice. Theoretical Computer Science, 412(24):2642-2656, 2011. Google Scholar
  10. Xin Han, Yasushi Kawase, and Kazuhisa Makino. Online unweighted knapsack problem with removal cost. Algorithmica, 70(1):76-91, 2014. Google Scholar
  11. Xin Han, Yasushi Kawase, and Kazuhisa Makino. Randomized algorithms for online knapsack problems. Theoretical Computer Science, 562:395-405, 2015. Google Scholar
  12. Xin Han, Yasushi Kawase, Kazuhisa Makino, and He Guo. Online removable knapsack problem under convex function. Theoretical Computer Science, 540:62-69, 2014. Google Scholar
  13. Xin Han, Yasushi Kawase, Kazuhisa Makino, and Haruki Yokomaku. Online knapsack problems with a resource buffer. In Pinyan Lu and Guochuan Zhang, editors, 30th International Symposium on Algorithms and Computation, ISAAC 2019, December 8-11, 2019, Shanghai University of Finance and Economics, Shanghai, China, volume 149 of LIPIcs, pages 28:1-28:14. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019. Google Scholar
  14. Xin Han and Kazuhisa Makino. Online removable knapsack with limited cuts. Theoretical Computer Science, 411(44-46):3956-3964, 2010. Google Scholar
  15. Juraj Hromkovič, Rastislav Královič, and Richard Královič. Information complexity of online problems. In MFCS 2010, number 6281 in LNCS, pages 24-36. Springer, 2010. Google Scholar
  16. Oscar H. Ibarra and Chul E. Kim. Fast approximation algorithms for the knapsack and sum of subset problems. Journal of the ACM, 22(4), 1975. Google Scholar
  17. Kazuo Iwama and Shiro Taketomi. Removable online knapsack problems. In ICALP 2002, number 2380 in LNCS, pages 293-305. Springer, 2002. Google Scholar
  18. Kazuo Iwama and Guochuan Zhang. Online knapsack with resource augmentation. Information Processing Letters, 110(22):1016-1020, 2010. Google Scholar
  19. Richard M. Karp. Reducibility among combinatorial problems. In Complexity of computer computations, pages 85-103. Plenum, 1972. Google Scholar
  20. Dennis Komm. An Introduction to Online Computation - Determinism, Randomization, Advice. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2016. Google Scholar
  21. Alberto Marchetti-Spaccamela and Carlo Vercellis. Stochastic on-line knapsack problems. Mathematical Programming, 68:73-104, 1995. Google Scholar
  22. John Noga and Veerawan Sarbua. An online partially fractional knapsack problem. In 8th International Symposium on Parallel Architectures, Algorithms, and Networks, ISPAN 2005, December 7-9. 2005, Las Vegas, Nevada, USA, pages 108-112. IEEE Computer Society, 2005. Google Scholar
  23. Peter Rossmanith. On the advice complexity of online edge- and node-deletion problems. In Adventures Between Lower Bounds and Higher Altitudes - Essays Dedicated to Juraj Hromkovič on the Occasion of His 60th Birthday, number 11011 in LNCS, pages 449-462. Springer, 2018. 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