On the Advice Complexity of the Knapsack Problem

  • Hans-Joachim Böckenhauer
  • Dennis Komm
  • Richard Královič
  • Peter Rossmanith
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7256)


We study the advice complexity and the random bit complexity of the online knapsack problem: Given a knapsack of unit capacity, and n items that arrive in successive time steps, an online algorithm has to decide for every item whether it gets packed into the knapsack or not. The goal is to maximize the value of the items in the knapsack without exceeding its capacity. In the model of advice complexity of online problems, one asks how many bits of advice about the unknown parts of the input are both necessary and sufficient to achieve a specific competitive ratio. It is well-known that even the unweighted online knapsack problem does not admit any competitive deterministic online algorithm. We show that a single bit of advice helps a deterministic algorithm to become 2-competitive, but that \(\ensuremath{\mathrm{\Omega}\mathopen{}\left(\log n\right)} \) advice bits are necessary to further improve the deterministic competitive ratio. This is the first time that such a phase transition for the number of advice bits has been observed for any problem. We also show that, surprisingly, instead of an advice bit, a single random bit allows for a competitive ratio of 2, and any further amount of randomness does not improve this. Moreover, we prove that, in a resource augmentation model, i.e., when allowing a little overpacking of the knapsack, a constant number of advice bits suffices to achieve a near-optimal competitive ratio. We also study the weighted version of the problem proving that, with \(\ensuremath{\mathcal{O}\hspace*{-0.4pt}\mathopen{}\left(\log n\right)} \) bits of advice, we can get arbitrarily close to an optimal solution and, using asymptotically fewer bits, we are not competitive.


Knapsack Problem Competitive Ratio Online Algorithm Online Problem Resource Augmentation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Böckenhauer, H.-J., Komm, D., Královič, R., Královič, R.: On the Advice Complexity of the k-Server Problem. In: Aceto, L., Henzinger, M., Sgall, J. (eds.) ICALP 2011. LNCS, vol. 6755, pp. 207–218. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  2. 2.
    Böckenhauer, H.-J., Komm, D., Královič, R., Královič, R., Mömke, T.: On the Advice Complexity of Online Problems. In: Dong, Y., Du, D.-Z., Ibarra, O. (eds.) ISAAC 2009. LNCS, vol. 5878, pp. 331–340. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  3. 3.
    Böckenhauer, H.-J., Komm, D., Královič, R., Rossmanith, P.: On the advice complexity of the knapsack problem. Technical Report 740, ETH Zurich (2011)Google Scholar
  4. 4.
    Borodin, A., El-Yaniv, R.: Online Computation and Competitive Analysis. Cambridge University Press (1998)Google Scholar
  5. 5.
    Csirik, J., Woeginger, G.J.: Resource augmentation for online bounded space bin packing. Journal of Algorithms 44(2), 308–320 (2002)MathSciNetzbMATHCrossRefGoogle Scholar
  6. 6.
    Dobrev, S., Královič, R., Pardubská, D.: Measuring the problem-relevant information in input. Theoretical Informatics and Applications (RAIRO) 43(3), 585–613 (2009)zbMATHCrossRefGoogle Scholar
  7. 7.
    Emek, Y., Fraigniaud, P., Korman, A., Rosén, A.: Online computation with advice. Theoretical Computer Science 412(24), 2642–2656 (2011)MathSciNetzbMATHCrossRefGoogle Scholar
  8. 8.
    Hromkovič, J.: Algorithmics for Hard Problems, 2nd edn. Springer, Heidelberg (2004)zbMATHGoogle Scholar
  9. 9.
    Hromkovič, J., Královič, R., Královič, R.: Information Complexity of Online Problems. In: Hliněný, P., Kučera, A. (eds.) MFCS 2010. LNCS, vol. 6281, pp. 24–36. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  10. 10.
    Iwama, K., Zhang, G.: Online knapsack with resource augmentation. Information Processing Letters 110(22), 1016–1020 (2010)MathSciNetCrossRefGoogle Scholar
  11. 11.
    Kalyanasundaram, B., Pruhs, K.: Speed is as powerful as clairvoyance. Journal of the ACM 47(4), 617–643 (2000)MathSciNetzbMATHCrossRefGoogle Scholar
  12. 12.
    Kellerer, H., Pferschy, U., Pisinger, D.: Knapsack problems. Springer, Heidelberg (2004)zbMATHGoogle Scholar
  13. 13.
    Komm, D., Královič, R.: Advice complexity and barely random algorithms. Theoretical Informatics and Applications (RAIRO) 45(2), 249–267 (2011)zbMATHCrossRefGoogle Scholar
  14. 14.
    Komm, D., Královič, R., Mömke, T.: On the advice complexity of the set cover problem. Technical Report 738, ETH Zurich (2011)Google Scholar
  15. 15.
    Marchetti-Spaccamela, A., Vercellis, C.: Stochastic on-line knapsack problems. Mathematical Programming 68, 73–104 (1995)MathSciNetzbMATHGoogle Scholar
  16. 16.
    Phillips, C.A., Stein, C., Torng, E., Wein, J.: Optimal time-critical scheduling via resource augmentation. Algorithmica 32(2), 163–200 (2002)MathSciNetzbMATHCrossRefGoogle Scholar
  17. 17.
    Zhou, Y., Chakrabarty, D., Lukose, R.M.: Budget Constrained Bidding in Keyword Auctions and Online Knapsack Problems. In: Papadimitriou, C., Zhang, S. (eds.) WINE 2008. LNCS, vol. 5385, pp. 566–576. Springer, Heidelberg (2008)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Hans-Joachim Böckenhauer
    • 1
  • Dennis Komm
    • 1
  • Richard Královič
    • 1
  • Peter Rossmanith
    • 2
  1. 1.Department of Computer ScienceETH ZurichSwitzerland
  2. 2.Department of Computer ScienceRWTH AachenGermany

Personalised recommendations