License: arXiv.org perpetual non-exclusive license
arXiv:2005.01867v2 [cs.DS] 28 Feb 2024
\hideLIPIcs

Department of Computer Science, ETH Zü[email protected]://orcid.org/0000-0001-9164-3674 CISPA Helmholtz Center for Information [email protected]://orcid.org/0000-0002-1368-3205Work done in part while at ETH Zürich. Department of Computer Science, RWTH [email protected]://orcid.org/0000-0003-0177-8028 \CopyrightHans-Joachim Böckenhauer, Fabian Frei, Peter Rossmanith \ccsdescTheory of computation Online algorithms

Removable Online Knapsack and Advice

Hans-Joachim Böckenhauer    Fabian Frei    Peter Rossmanith ∈∈))))∈∈))))∈∈))))∈∈))))
Abstract

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+ε1𝜀1+\varepsilon1 + italic_ε 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.

keywords:
Removable Online Knapsack, Competitive Ratio, Advice Analysis, Advice Applications, Randomized Algorithms, Machine Learning and AI

1 Introduction

In this first section, we briefly summarize what online algorithms and advice are, then informally present the problem whose advice complexity we will be analyzing, and finally describe several applications of such advice complexity results.

1.1 Online Algorithms and Advice Complexity

Online algorithms receive their input piece by piece and have to determine parts of the solution before knowing the entire instance. This often leaves them unable to compete with offline algorithms, which know the entire input in advance, in a meaningful way. In the advice model, we assume an omniscient oracle that provides the online algorithm with some information on how to solve the upcoming instance best. If the oracle can communicate to the algorithm an unlimited amount of such advice, it will of course be able to lead the algorithm to an optimal solution for every instance. The advice complexity measures the minimum amount of information necessary for the online algorithm to achieve any given approximation ratio, which is commonly called strict competitive ratio or competitivity in this context.

Advice complexity is a well-established tool to gauge the information content of an online problem [3, 9, 15]. For a detailed and careful introduction to the theory, we refer to the textbook by Komm [20]. Another classical textbook on online problems is written by Borodin and Yaniv [5]. The trade-off between a low number of transmitted advice bits on the one hand and achieving a good competitive ratio on the other hand has been examined for a wealth of problems—see the survey by Boyar et al. [6]—but one stands out for its peculiar behavior: the knapsack problem.

1.2 Knapsack and Removability

A knapsack instance presents the online algorithm with a sequence of items of different sizes. Upon the arrival of each item, the algorithm has to decide whether to pack it into a knapsack or discard it. The goal is to fill the knapsack as much as possible without ever exceeding the knapsack’s given capacity. This problem is sometimes also referred to as the proportional or simple knapsack problem, as opposed to the general knapsack problem, in which every item has not only a size but also a value.111It is also quite common for the proportional and general knapsack problem to be called unweighted and weighted, respectively. The notion weight is ambiguous, however, as some authors [4] use it for what is called size here, while others [18] use it for what is called the value here or profit elsewhere. For the sake of clarity, we are well advised to avoid the term weight altogether. In the generalized version, the goal is to maximize the total value of all packed items. With no further specification given, we are always referring to the proportional case.

A variant of the knapsack problem has been proposed by Iwama and Taketomi [17] under the name of removable knapsack. In this model, we can discard an item not only when it is first presented to us; we may also remove a packed item from the knapsack at any point. This is possible only once for each item, however; once removed, an item cannot be repacked. As for the classical problem without removability, the capacity of the knapsack may not be exceeded at any point in time. Recently, Rossmanith has introduced a similar relaxed online setting for graph problems where decisions are taken only when constraints make it inevitable [24].

This model is arguably just as natural a way to translate the knapsack problem into the online setting as the more well-examined variant without removability. In many cases, it will not be hard to discard items at regular intervals, only the chance of obtaining specific objects is subject to special circumstances. For a practical example, consider a storage room in which you can store all kinds of objects that you come across over time. In the beginning you can just keep collecting everything, but by doing so you inevitably run out of space before too long. Then you will have to start disposing of some of your possessions to make room for new, potentially more interesting acquisitions. Your goal is to end up with a selection of just the most meaningful and useful items that you could have. This paper analyzes the advice complexity of both the proportional and general removable knapsack problem. It is telling you how much information about upcoming opportunities you need to ensure an outcome that is either optimal or off by at most a given factor.

1.3 Advice Applications

Besides inherently interesting insights into the information complexity of the knapsack problem, our advice algorithms also offer more concrete applications. Any algorithm reading a bounded number of advice bits can be implemented by running a bounded number of deterministic algorithms in parallel and selecting the best result. An advice analysis thus tells us, for example, how to optimally organize a betting pool in a winner-take-all scenario. Our main result in particular provides a smart selection of strategies to be assigned to a mere constant number of actors such that one is guaranteed to be as close to optimality as we desire, no matter how difficult the instances of the general knapsack problem with removability may become.

A further advantage of analyzing the advice complexity of a problem is that the resulting bounds are very versatile. The lower bounds are particularly strong. They show that a certain competitivity cannot be achieved with a given amount of additional information, regardless of the form this advice may take. The oracle is indeed able to convey to the algorithm all kinds of structural information about the adversarial instance; for example, in the case of our knapsack problem, whether items smaller than a given threshold should or must not be ignored, whether replacing packed items by later ones will ever be beneficial, whether the values span more than a certain range, whether an optimal solution fills the knapsack completely, whether there are multiple optimal solutions, and so on. Lower bounds on the competitivity of advice algorithms imply lower bounds for randomized algorithms, and our results indeed improve upon the best bounds known for randomization; Theorem 5.3 even completely closes the remaining gap in the analysis of barely random algorithms for the general knapsack problem.

There are also interesting implications for deterministic algorithms. Consider the multiple knapsack problem in which every item is either rejected or packed into one of k>1𝑘1k>1italic_k > 1 knapsacks; the goal is for the algorithm to have in the end one knapsack that is as full as possible. This problem has been analyzed with removability by Iwama and Taketomi in the proportional case. In the conclusion of their paper [17], they pose it as an open problem to analyze this model if we are allowed to copy items and pack them into arbitrarily many of the available knapsacks. It turns out that deterministic algorithms for this problem with different k𝑘kitalic_ks are equivalent to advice algorithms: An advice algorithm restricted to logk𝑘\log kroman_log italic_k advice bits can read up to k𝑘kitalic_k different advice strings. Even if the algorithm reads the entire advice string right at the beginning, before taking any decision, it will thus implement one of k𝑘kitalic_k deterministic strategies. Having k𝑘kitalic_k knapsacks and being able to pack each item into several of them at the same time means that we can just simulate each possible strategy in one of the knapsacks and see which one leads to the best result in the end. Conversely, the oracle in our model already knows the optimal choice and can communicate to an advice algorithm which of the knapsacks it should be simulating. Knowing the advice complexity of our problem with only one knapsack therefore automatically yields a comprehensive competitive analysis for this deterministic problem for any k>1𝑘1k>1italic_k > 1. All of this remains true for the general knapsack problem; thus our results provide a comprehensive picture for the proposed model in both the proportional and non-proportional case. We remark that algorithms for the resource buffer model are generally not applicable here. Algorithm 2222 by Han et al. [13, Thm. 9], for example, keeps regrou** items in every step and thus crucially relies on having a single large buffer instead of multiple standard-sized knapsacks without an option to shuffle items between them.

2 Preliminaries

Throughout this paper, log\logroman_log denotes the binary logarithm. We formally define the removable knapsack problem as follows.

Definition 2.1 (Removable Knapsack Problem).

RemKnap is an online maximization problem. An instance isasequence𝑖𝑠𝑎𝑠𝑒𝑞𝑢𝑒𝑛𝑐𝑒isasequenceitalic_i italic_s italic_a italic_s italic_e italic_q italic_u italic_e italic_n italic_c italic_e(s𝑠sitalic_s_1,v𝑣vitalic_v_1),…,(s𝑠sitalic_s_n,v𝑣vitalic_v_n)of𝑜𝑓ofitalic_o italic_fnitems,eachofwhichisapairofsomerealpositivesize𝑖𝑡𝑒𝑚𝑠𝑒𝑎𝑐𝑜𝑓𝑤𝑖𝑐𝑖𝑠𝑎𝑝𝑎𝑖𝑟𝑜𝑓𝑠𝑜𝑚𝑒𝑟𝑒𝑎𝑙𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒sizeitems,eachofwhichisapairofsomerealpositive\emph{size}italic_i italic_t italic_e italic_m italic_s , italic_e italic_a italic_c italic_h italic_o italic_f italic_w italic_h italic_i italic_c italic_h italic_i italic_s italic_a italic_p italic_a italic_i italic_r italic_o italic_f italic_s italic_o italic_m italic_e italic_r italic_e italic_a italic_l italic_p italic_o italic_s italic_i italic_t italic_i italic_v italic_e sizes𝑠sitalic_s_iandvalue𝑎𝑛𝑑valueand\emph{value}italic_a italic_n italic_d valuev𝑣vitalic_v_i.Whereuseful,wedenotesizeandvalueofanitem.Whereuseful,wedenotesizeandvalueofanitem. italic_W italic_h italic_e italic_r italic_e italic_u italic_s italic_e italic_f italic_u italic_l , italic_w italic_e italic_d italic_e italic_n italic_o italic_t italic_e italic_s italic_i italic_z italic_e italic_a italic_n italic_d italic_v italic_a italic_l italic_u italic_e italic_o italic_f italic_a italic_n italic_i italic_t italic_e italic_mifunctionallyby𝑓𝑢𝑛𝑐𝑡𝑖𝑜𝑛𝑎𝑙𝑙𝑦𝑏𝑦functionallybyitalic_f italic_u italic_n italic_c italic_t italic_i italic_o italic_n italic_a italic_l italic_l italic_y italic_b italic_ys𝑠sitalic_s(i)= s𝑠sitalic_s_iand𝑎𝑛𝑑anditalic_a italic_n italic_dv𝑣vitalic_v(i)=v𝑣vitalic_v_i.Thedomainofthisfunctionnaturallyextendstoarbitrarysubsets.Thedomainofthisfunctionnaturallyextendstoarbitrarysubsets. italic_T italic_h italic_e italic_d italic_o italic_m italic_a italic_i italic_n italic_o italic_f italic_t italic_h italic_i italic_s italic_f italic_u italic_n italic_c italic_t italic_i italic_o italic_n italic_n italic_a italic_t italic_u italic_r italic_a italic_l italic_l italic_y italic_e italic_x italic_t italic_e italic_n italic_d italic_s italic_t italic_o italic_a italic_r italic_b italic_i italic_t italic_r italic_a italic_r italic_y italic_s italic_u italic_b italic_s italic_e italic_t italic_sT𝑇Titalic_T⊆{1,…,n}ofitemsbydefining𝑜𝑓𝑖𝑡𝑒𝑚𝑠𝑏𝑦𝑑𝑒𝑓𝑖𝑛𝑖𝑛𝑔ofitemsbydefiningitalic_o italic_f italic_i italic_t italic_e italic_m italic_s italic_b italic_y italic_d italic_e italic_f italic_i italic_n italic_i italic_n italic_gs𝑠sitalic_s(T𝑇Titalic_T)=_iT𝑇Titalic_Ts𝑠sitalic_s(i)and𝑎𝑛𝑑anditalic_a italic_n italic_dv𝑣vitalic_v(T𝑇Titalic_T)=_iT𝑇Titalic_Tv𝑣vitalic_v(i).Theknapsackhasamaximumsizecapacity,whichwenormalizetobe.Theknapsackhasamaximumsizecapacity,whichwenormalizetobe. italic_T italic_h italic_e italic_k italic_n italic_a italic_p italic_s italic_a italic_c italic_k italic_h italic_a italic_s italic_a italic_m italic_a italic_x italic_i italic_m italic_u italic_m italic_s italic_i italic_z italic_e italic_c italic_a italic_p italic_a italic_c italic_i italic_t italic_y , italic_w italic_h italic_i italic_c italic_h italic_w italic_e italic_n italic_o italic_r italic_m italic_a italic_l italic_i italic_z italic_e italic_t italic_o italic_b italic_e1.Theinstanceispresenteditembyitemtoanonlinealgorithm.\par Theinstanceispresenteditembyitemtoanonlinealgorithm. italic_T italic_h italic_e italic_i italic_n italic_s italic_t italic_a italic_n italic_c italic_e italic_i italic_s italic_p italic_r italic_e italic_s italic_e italic_n italic_t italic_e italic_d italic_i italic_t italic_e italic_m italic_b italic_y italic_i italic_t italic_e italic_m italic_t italic_o italic_a italic_n italic_o italic_n italic_l italic_i italic_n italic_e italic_a italic_l italic_g italic_o italic_r italic_i italic_t italic_h italic_m𝒜𝒜\mathcal{A}caligraphic_Athathastomaintainapacking,asetofpackeditems.Wecallthetotalsizeofthecurrentlypackeditemsthecurrentfillingoftheknapsack.Thealgorithmstartsoutwithanemptyknapsack,representedbytheemptysetformulae-sequence𝑡𝑎𝑡𝑎𝑠𝑡𝑜𝑚𝑎𝑖𝑛𝑡𝑎𝑖𝑛𝑎packing𝑎𝑠𝑒𝑡𝑜𝑓𝑝𝑎𝑐𝑘𝑒𝑑𝑖𝑡𝑒𝑚𝑠𝑊𝑒𝑐𝑎𝑙𝑙𝑡𝑒𝑡𝑜𝑡𝑎𝑙𝑠𝑖𝑧𝑒𝑜𝑓𝑡𝑒𝑐𝑢𝑟𝑟𝑒𝑛𝑡𝑙𝑦𝑝𝑎𝑐𝑘𝑒𝑑𝑖𝑡𝑒𝑚𝑠𝑡𝑒𝑐𝑢𝑟𝑟𝑒𝑛𝑡filling𝑜𝑓𝑡𝑒𝑘𝑛𝑎𝑝𝑠𝑎𝑐𝑘𝑇𝑒𝑎𝑙𝑔𝑜𝑟𝑖𝑡𝑚𝑠𝑡𝑎𝑟𝑡𝑠𝑜𝑢𝑡𝑤𝑖𝑡𝑎𝑛𝑒𝑚𝑝𝑡𝑦𝑘𝑛𝑎𝑝𝑠𝑎𝑐𝑘𝑟𝑒𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑒𝑑𝑏𝑦𝑡𝑒𝑒𝑚𝑝𝑡𝑦𝑠𝑒𝑡thathastomaintaina\emph{packing},asetofpackeditems.% Wecallthetotalsizeofthecurrentlypackeditemsthecurrent\emph{filling}% oftheknapsack.Thealgorithmstartsoutwithanemptyknapsack,representedbytheemptysetitalic_t italic_h italic_a italic_t italic_h italic_a italic_s italic_t italic_o italic_m italic_a italic_i italic_n italic_t italic_a italic_i italic_n italic_a packing , italic_a italic_s italic_e italic_t italic_o italic_f italic_p italic_a italic_c italic_k italic_e italic_d italic_i italic_t italic_e italic_m italic_s . italic_W italic_e italic_c italic_a italic_l italic_l italic_t italic_h italic_e italic_t italic_o italic_t italic_a italic_l italic_s italic_i italic_z italic_e italic_o italic_f italic_t italic_h italic_e italic_c italic_u italic_r italic_r italic_e italic_n italic_t italic_l italic_y italic_p italic_a italic_c italic_k italic_e italic_d italic_i italic_t italic_e italic_m italic_s italic_t italic_h italic_e italic_c italic_u italic_r italic_r italic_e italic_n italic_t filling italic_o italic_f italic_t italic_h italic_e italic_k italic_n italic_a italic_p italic_s italic_a italic_c italic_k . italic_T italic_h italic_e italic_a italic_l italic_g italic_o italic_r italic_i italic_t italic_h italic_m italic_s italic_t italic_a italic_r italic_t italic_s italic_o italic_u italic_t italic_w italic_i italic_t italic_h italic_a italic_n italic_e italic_m italic_p italic_t italic_y italic_k italic_n italic_a italic_p italic_s italic_a italic_c italic_k , italic_r italic_e italic_p italic_r italic_e italic_s italic_e italic_n italic_t italic_e italic_d italic_b italic_y italic_t italic_h italic_e italic_e italic_m italic_p italic_t italic_y italic_s italic_e italic_tT𝑇Titalic_T_0=.Whenpresentedwithitem.Whenpresentedwithitem. italic_W italic_h italic_e italic_n italic_p italic_r italic_e italic_s italic_e italic_n italic_t italic_e italic_d italic_w italic_i italic_t italic_h italic_i italic_t italic_e italic_mi,thealgorithmmayfirstremoveanyoftheitems,thealgorithmmayfirstremoveanyoftheitems, italic_t italic_h italic_e italic_a italic_l italic_g italic_o italic_r italic_i italic_t italic_h italic_m italic_m italic_a italic_y italic_f italic_i italic_r italic_s italic_t italic_r italic_e italic_m italic_o italic_v italic_e italic_a italic_n italic_y italic_o italic_f italic_t italic_h italic_e italic_i italic_t italic_e italic_m italic_sT𝑇Titalic_T_i-1packedsofar;thenitmaypackthenewitemifthisdoesnotexceedtheknapsackcapacity.Inotherwords,thealgorithmselectsasubsetformulae-sequence𝑝𝑎𝑐𝑘𝑒𝑑𝑠𝑜𝑓𝑎𝑟𝑡𝑒𝑛𝑖𝑡𝑚𝑎𝑦𝑝𝑎𝑐𝑘𝑡𝑒𝑛𝑒𝑤𝑖𝑡𝑒𝑚𝑖𝑓𝑡𝑖𝑠𝑑𝑜𝑒𝑠𝑛𝑜𝑡𝑒𝑥𝑐𝑒𝑒𝑑𝑡𝑒𝑘𝑛𝑎𝑝𝑠𝑎𝑐𝑘𝑐𝑎𝑝𝑎𝑐𝑖𝑡𝑦𝐼𝑛𝑜𝑡𝑒𝑟𝑤𝑜𝑟𝑑𝑠𝑡𝑒𝑎𝑙𝑔𝑜𝑟𝑖𝑡𝑚𝑠𝑒𝑙𝑒𝑐𝑡𝑠𝑎𝑠𝑢𝑏𝑠𝑒𝑡packedsofar;thenitmaypackthenewitemifthisdoesnotexceedtheknapsackcapacity.% Inotherwords,thealgorithmselectsasubsetitalic_p italic_a italic_c italic_k italic_e italic_d italic_s italic_o italic_f italic_a italic_r ; italic_t italic_h italic_e italic_n italic_i italic_t italic_m italic_a italic_y italic_p italic_a italic_c italic_k italic_t italic_h italic_e italic_n italic_e italic_w italic_i italic_t italic_e italic_m italic_i italic_f italic_t italic_h italic_i italic_s italic_d italic_o italic_e italic_s italic_n italic_o italic_t italic_e italic_x italic_c italic_e italic_e italic_d italic_t italic_h italic_e italic_k italic_n italic_a italic_p italic_s italic_a italic_c italic_k italic_c italic_a italic_p italic_a italic_c italic_i italic_t italic_y . italic_I italic_n italic_o italic_t italic_h italic_e italic_r italic_w italic_o italic_r italic_d italic_s , italic_t italic_h italic_e italic_a italic_l italic_g italic_o italic_r italic_i italic_t italic_h italic_m italic_s italic_e italic_l italic_e italic_c italic_t italic_s italic_a italic_s italic_u italic_b italic_s italic_e italic_tT𝑇Titalic_T_iT𝑇Titalic_T_i-1∪{i}with𝑤𝑖𝑡withitalic_w italic_i italic_t italic_hs𝑠sitalic_s(T𝑇Titalic_T_i)1instep𝑖𝑛𝑠𝑡𝑒𝑝instepitalic_i italic_n italic_s italic_t italic_e italic_pi.Thealgorithmlearnsthesizeofitem.Thealgorithmlearnsthesizeofitem. italic_T italic_h italic_e italic_a italic_l italic_g italic_o italic_r italic_i italic_t italic_h italic_m italic_l italic_e italic_a italic_r italic_n italic_s italic_t italic_h italic_e italic_s italic_i italic_z italic_e italic_o italic_f italic_i italic_t italic_e italic_mionlyonceitispresentedandonlylearnsthetotalnumber𝑜𝑛𝑙𝑦𝑜𝑛𝑐𝑒𝑖𝑡𝑖𝑠𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑒𝑑𝑎𝑛𝑑𝑜𝑛𝑙𝑦𝑙𝑒𝑎𝑟𝑛𝑠𝑡𝑒𝑡𝑜𝑡𝑎𝑙𝑛𝑢𝑚𝑏𝑒𝑟onlyonceitispresentedandonlylearnsthetotalnumberitalic_o italic_n italic_l italic_y italic_o italic_n italic_c italic_e italic_i italic_t italic_i italic_s italic_p italic_r italic_e italic_s italic_e italic_n italic_t italic_e italic_d italic_a italic_n italic_d italic_o italic_n italic_l italic_y italic_l italic_e italic_a italic_r italic_n italic_s italic_t italic_h italic_e italic_t italic_o italic_t italic_a italic_l italic_n italic_u italic_m italic_b italic_e italic_rnofitemsafterselecting𝑜𝑓𝑖𝑡𝑒𝑚𝑠𝑎𝑓𝑡𝑒𝑟𝑠𝑒𝑙𝑒𝑐𝑡𝑖𝑛𝑔ofitemsafterselectingitalic_o italic_f italic_i italic_t italic_e italic_m italic_s italic_a italic_f italic_t italic_e italic_r italic_s italic_e italic_l italic_e italic_c italic_t italic_i italic_n italic_gT𝑇Titalic_T_n.Thefinalpackingcomputedby.Thefinalpackingcomputedby. italic_T italic_h italic_e italic_f italic_i italic_n italic_a italic_l italic_p italic_a italic_c italic_k italic_i italic_n italic_g italic_c italic_o italic_m italic_p italic_u italic_t italic_e italic_d italic_b italic_y𝒜𝒜\mathcal{A}caligraphic_Aisdenotedby𝑖𝑠𝑑𝑒𝑛𝑜𝑡𝑒𝑑𝑏𝑦isdenotedbyitalic_i italic_s italic_d italic_e italic_n italic_o italic_t italic_e italic_d italic_b italic_yT𝑇Titalic_T=T𝑇Titalic_T_n.Thegainthatweaimtomaximizeisthetotalvalue.The\emph{gain}thatweaimtomaximizeisthetotalvalue. italic_T italic_h italic_e gain italic_t italic_h italic_a italic_t italic_w italic_e italic_a italic_i italic_m italic_t italic_o italic_m italic_a italic_x italic_i italic_m italic_i italic_z italic_e italic_i italic_s italic_t italic_h italic_e italic_t italic_o italic_t italic_a italic_l italic_v italic_a italic_l italic_u italic_ev𝑣vitalic_v(T𝑇Titalic_T)ofthefinalpacking.TheproportionalvariantPropRemKnapadditionallysatisfiesformulae-sequence𝑜𝑓𝑡𝑒𝑓𝑖𝑛𝑎𝑙𝑝𝑎𝑐𝑘𝑖𝑛𝑔𝑇𝑒𝑝𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛𝑎𝑙𝑣𝑎𝑟𝑖𝑎𝑛𝑡PropRemKnap𝑎𝑑𝑑𝑖𝑡𝑖𝑜𝑛𝑎𝑙𝑙𝑦𝑠𝑎𝑡𝑖𝑠𝑓𝑖𝑒𝑠ofthefinalpacking.\par Theproportionalvariant\textnormal{{Prop\-Rem\-Knap}}additionallysatisfiesitalic_o italic_f italic_t italic_h italic_e italic_f italic_i italic_n italic_a italic_l italic_p italic_a italic_c italic_k italic_i italic_n italic_g . italic_T italic_h italic_e italic_p italic_r italic_o italic_p italic_o italic_r italic_t italic_i italic_o italic_n italic_a italic_l italic_v italic_a italic_r italic_i italic_a italic_n italic_t PropRemKnap italic_a italic_d italic_d italic_i italic_t italic_i italic_o italic_n italic_a italic_l italic_l italic_y italic_s italic_a italic_t italic_i italic_s italic_f italic_i italic_e italic_ss𝑠sitalic_s_i=v𝑣vitalic_v_iforeachitem𝑓𝑜𝑟𝑒𝑎𝑐𝑖𝑡𝑒𝑚foreachitemitalic_f italic_o italic_r italic_e italic_a italic_c italic_h italic_i italic_t italic_e italic_mi.

Definition 2.2 (Competitive Ratio).

Let an online maximization problem with instance set \mathcal{I}caligraphic_I be given and let 𝒜𝒜\mathcal{A}caligraphic_A be an online algorithm solving it. For any instance \mathcal{I}caligraphic_I, denote by 𝚊𝚕𝚐(\textnormal{{alg}}(alg ( the gain that 𝒜𝒜\mathcal{A}caligraphic_A achieves on andby𝑎𝑛𝑑𝑏𝑦andbyitalic_a italic_n italic_d italic_b italic_yopt(thegainofanoptimalsolutionto𝑡𝑒𝑔𝑎𝑖𝑛𝑜𝑓𝑎𝑛𝑜𝑝𝑡𝑖𝑚𝑎𝑙𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛𝑡𝑜thegainofanoptimalsolutiontoitalic_t italic_h italic_e italic_g italic_a italic_i italic_n italic_o italic_f italic_a italic_n italic_o italic_p italic_t italic_i italic_m italic_a italic_l italic_s italic_o italic_l italic_u italic_t italic_i italic_o italic_n italic_t italic_o computed offline. The competitive performance of 𝒜𝒜\mathcal{A}caligraphic_A on an instance \mathcal{I}caligraphic_I is 𝚘𝚙𝚝(/𝚊𝚕𝚐(\textnormal{{opt}}(/\textnormal{{alg}}(opt ( / alg (. For any ρ𝐑𝜌𝐑\rho\in\text{{\boldmath R}}italic_ρ ∈ R, the algorithm 𝒜𝒜\mathcal{A}caligraphic_A is called strictly ρ𝜌\rhoitalic_ρ-competitive if it performs ρ𝜌\rhoitalic_ρ-competitively across all instances, that is, if :𝚘𝚙𝚝(/𝚊𝚕𝚐(ρ\forall\,\mathcal{I}\colon\ \textnormal{{opt}}(/\textnormal{{alg}}(\leq\rho∀ caligraphic_I : opt ( / alg ( ≤ italic_ρ. The infimal competitivity inf{ρ𝐑𝒜 is strictly ρ-competitive}infconditional-set𝜌𝐑𝒜 is strictly ρ-competitive\textnormal{inf}\{\,\rho\in\text{{\boldmath R}}\mid\mathcal{A}\text{ is % strictly $\rho$-competitive}\,\}inf { italic_ρ ∈ R ∣ caligraphic_A is strictly italic_ρ -competitive } is called strict competitive ratio of 𝒜𝒜\mathcal{A}caligraphic_A. We can weaken the defining inequality above so that it only needs to hold asymptotically in the sense of α𝐑+::𝚘𝚙𝚝(ρ𝚊𝚕𝚐(+α\exists\,\alpha\in\text{{\boldmath R}}_{+}\colon\ \forall\,\mathcal{I}\colon\ % \textnormal{{opt}}(\leq\rho\cdot\textnormal{{alg}}(+\alpha∃ italic_α ∈ R start_POSTSUBSCRIPT + end_POSTSUBSCRIPT : ∀ caligraphic_I : opt ( ≤ italic_ρ ⋅ alg ( + italic_α. If this condition is met, we call 𝒜𝒜\mathcal{A}caligraphic_A nonstrictly ρ𝜌\rhoitalic_ρ-competitive.

Note that strict ρ𝜌\rhoitalic_ρ-competitivity implies nonstrict ρ𝜌\rhoitalic_ρ-competitivity but not vice versa, making it harder to prove lower bounds for nonstrict competitivity. For the knapsack problem, however, it makes sense to always analyze competitivity in the strict sense: On the one hand, we obtain a nonstrict lower bound from a strict one by scaling up the knapsack capacity and all item sizes in a hard instance set such that the smallest item is strictly larger than α𝛼\alphaitalic_α. If, on the other hand, scaling is impossible due to the problem being defined with a fixed knapsack capacity of 1111, for example, then choosing α=1𝛼1\alpha=1italic_α = 1 shows any online algorithm is 1111-competitive in the nonstrict sense.

3 Related Work

Knapsack is one of the 21 NP-complete decision problem in Karp’s famous list [19]. An algorithm based on dynamic programming solves both the proportional and the general version in pseudo-polynomial time; see Bellman [1, Section 1.4] for the general technique and Dantzig [8, p. 275] for a concrete description of its application to the knapsack problem. The pseudo-polynomial time algorithm can be adapted to the optimization version, yielding a fully polynomial-time approximation scheme [16]. In the following two subsections, we list the known results on the advice complexity of the proportional knapsack problem, first for the classical version and then for the variant allowing the removal of packed items.

3.1 Knapsack without Removability

Marchetti-Spaccamela and Vercellis were the first to consider the classical online version of the knapsack problem in 1995. They called it the {0,1}01\{0,1\}{ 0 , 1 } knapsack problem to distinguish it from the fractional knapsack problem, which allows for packing items partially. They proved that both versions have an unbounded competitive ratio if items are allowed to have sizes different from their values [21, Thm. 2.1]. We denote the classical problem with neither fractional items nor removability by Knapand its proportional variant by PropKnap.

The concept of advice emerged much later. When it did, Knapquickly became one of the prime examples of a problem with an interesting advice complexity.

First, just a single advice bit brings with it a jump from non-competitivity to a 2222-competitive algorithm [4, Thm. 4]. More advice bits do not help however, as long as the number stays below log(n1)𝑛1\lfloor\log(n-1)\rfloor⌊ roman_log ( italic_n - 1 ) ⌋ [4, Thm. 5]. Once this threshold is surpassed, logarithmic advice allows for a competitive ratio that is arbitrarily close to 1 [4, Thm. 6]. Achieving optimality, finally, requires at least n1𝑛1n-1italic_n - 1 advice bits [4, Thm. 3].

The situation for the general variant is simpler: Any algorithm reading less than logn𝑛\log nroman_log italic_n advice bits has an unbounded competitive ratio, but 𝒪(logn)𝒪𝑛\mathcal{O}(\log n)caligraphic_O ( roman_log italic_n ) advice suffices for a near-optimal solution [4, Thms. 11 and 12]. A schematic plot of the advice complexity behaviors just described can be found in Figure 1 in light gray.

3.2 Online Knapsack Variants

Iwama and Taketomi [17] proposed the online knapsack model with removability as it is examined in the present paper. They proved that the competitive ratio for the proportional variant of this problem, which we denote by PropRemKnap, is exactly the golden ratio. Iwama and Zhang later considered the problem with resource augmentation, that is, for online algorithms that may use a larger knapsack than the offline algorithm [18].

Later still, Han et al. [12] proved an upper bound of 5/3535/35 / 3 on the competitive ratio for a variant of PropRemKnap where the value v𝑣vitalic_v of an item is not necessarily proportional to its size s𝑠sitalic_s but not arbitrary either; instead, the value is given by a convex function v=f(s)𝑣𝑓𝑠v=f(s)italic_v = italic_f ( italic_s ) known to the algorithm. They also proved the golden ratio to be optimal if f𝑓fitalic_f has some further technical properties. Han et al. [10] considered online knapsack with removal costs, a variant of PropRemKnap where items can be removed, but not for free.

Noga and Sarbua [22] considered a knapsack variant, where it is possible to split each arriving item in two parts of not necessarily equal size, and combine this with resource augmentation. Han and Makino [14] considered another partially fractional variant of PropRemKnap where each item can be split a constant number of times at any time. Most importantly in our context, Han et al. [11] examined randomized algorithms for PropRemKnap, proving an upper bound of 10/710710/710 / 7 and a lower bound of 5/4545/45 / 4 on the expected competitivity. Cygan et al. [7] extended the study of randomization for PropRemKnap to a variant with multiple knapsacks. Recently, Böckenhauer et al. [2] have introduced a new model for the online proportional knapsack problem in which items can be stored outside of the knapsack until the instance ends after paying a reservation fee that is a fixed fraction α𝛼\alphaitalic_α of the item’s value.

4 Results for Proportional Removable Knapsack

In Section 4.1, we consider how much—or rather, how little—removability helps when trying to obtain an optimal solution. In Section 4.2, we prove upper and lower bounds on what is possible with a single advice bit. Finally, we prove in Section 4.3 that a constant amount of advice is sufficient to achieve a competitive ratio of 1+ε1𝜀1+\varepsilon1 + italic_ε, for an arbitrary ε>0𝜀0\varepsilon>0italic_ε > 0, and a constant depending on ε𝜀\varepsilonitalic_ε. See Figure 1 for a rough representation of these results in dark gray.

00\phantom{(}0\hphantom{)}O(1)𝑂1O(1)italic_O ( 1 )O(logn)𝑂𝑛O(\log n)italic_O ( roman_log italic_n )n𝑛\hphantom{(}n\hphantom{)}italic_n11111+ε1𝜀1+\varepsilon1 + italic_εΦΦ\Phiroman_Φ2222logn𝑛\hphantom{(}\log n\hphantom{)}roman_log italic_nnlogn𝑛𝑛\hphantom{(}n-\log n\hphantom{)}italic_n - roman_log italic_nAdvice BitsCompetitivityProportional Knapsack without Removability …… and with Removability00\phantom{(}0\hphantom{)}O(1)𝑂1O(1)italic_O ( 1 )O(logn)𝑂𝑛O(\log n)italic_O ( roman_log italic_n )n𝑛\hphantom{(}n\hphantom{)}italic_n11111+ε1𝜀1+\varepsilon1 + italic_ε2222logn𝑛\hphantom{(}\log n\hphantom{)}roman_log italic_nnlogn𝑛𝑛\hphantom{(}n-\log n\hphantom{)}italic_n - roman_log italic_nAdvice BitsCompetitivityGeneral Knapsack without …… and with Removability
Figure 1: A schematic plot of the advice complexity behavior of the classical online knapsack problem in light gray and the relaxed variant with removability in dark gray. For the proportional version without removability there are two large plateaus; removability collapses to a single vast expanse. For the general version, in which an item’s value may differ from its size, there is only one but a more extreme jump directly from an unbounded competitive ratio to near optimality; with removability, this jump is occurring earlier and even steeper.

4.1 Achieving Optimality

We begin by briefly considering PropKnap, the classical proportional knapsack problem without removability. Solving it optimally is trivial with n𝑛nitalic_n advice bits: The algorithm reads one bit per item, telling it whether to accept or reject. LABEL:{thm:classic_prop_opt_lower_tight} proves this to be tight by lifting the best known lower bound from n1𝑛1n-1italic_n - 1 advice bits [4, Thm. 3] to n𝑛nitalic_n advice bits.

Theorem 4.1.

Any algorithm for PropKnap reading less than n𝑛nitalic_n advice bits is suboptimal.

Proof 4.2.

For every n𝑛nitalic_n, we consider the 2nsuperscript2𝑛2^{n}2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT instances that all begin with the same n1𝑛1n-1italic_n - 1 items, namely one for each of the sizes s1=21,s2=22,,sn1=2(n1)formulae-sequencesubscript𝑠1superscript21formulae-sequencesubscript𝑠2superscript22normal-…subscript𝑠𝑛1superscript2𝑛1s_{1}=2^{-1},s_{2}=2^{-2},\dots,s_{n-1}=2^{-(n-1)}italic_s start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT , italic_s start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT - 2 end_POSTSUPERSCRIPT , … , italic_s start_POSTSUBSCRIPT italic_n - 1 end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT - ( italic_n - 1 ) end_POSTSUPERSCRIPT. The size of the final item is either sn=2nsubscript𝑠𝑛superscript2𝑛s_{n}=2^{-n}italic_s start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT - italic_n end_POSTSUPERSCRIPT or any sn{ 1iIsiI{1,2,,n1}}superscriptsubscript𝑠𝑛normal-′conditional-set1subscript𝑖𝐼subscript𝑠𝑖𝐼12normal-…𝑛1s_{n}^{\prime}\in\{\,1-\sum_{i\in I}s_{i}\mid I\subsetneq\{1,2,\dots,n-1\}\,\}italic_s start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∈ { 1 - ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I end_POSTSUBSCRIPT italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∣ italic_I ⊊ { 1 , 2 , … , italic_n - 1 } }. We remark that this hard instance family is almost identical to the one used by Böckenhauer et al. [4, Thm. 3] for proving the lower bound of n1𝑛1n-1italic_n - 1 advice bits; the only tiny modification is changing the item size sn=1iIsisuperscriptsubscript𝑠𝑛normal-′1subscript𝑖𝐼subscript𝑠𝑖s_{n}^{\prime}=1-\sum_{i\in I}s_{i}italic_s start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = 1 - ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I end_POSTSUBSCRIPT italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT for I={1,2,,n1}}I=\{1,2,\dots,n-1\}\}italic_I = { 1 , 2 , … , italic_n - 1 } } to sn=2nsubscript𝑠𝑛superscript2𝑛s_{n}=2^{-n}italic_s start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT - italic_n end_POSTSUPERSCRIPT. There are 2n1superscript2𝑛12^{n-1}2 start_POSTSUPERSCRIPT italic_n - 1 end_POSTSUPERSCRIPT options for the final item, and each one requires an optimal algorithm to have packed another one of the 2n1superscript2𝑛12^{n-1}2 start_POSTSUPERSCRIPT italic_n - 1 end_POSTSUPERSCRIPT possible subsets of the previous n1𝑛1n-1italic_n - 1 items: If the last item turns out to have size sn=iIsisuperscriptsubscript𝑠𝑛normal-′subscript𝑖𝐼subscript𝑠𝑖s_{n}^{\prime}=\sum_{i\in I}s_{i}italic_s start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I end_POSTSUBSCRIPT italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, for any given I{1,2,,n1}𝐼12normal-…𝑛1I\subsetneq\{1,2,\dots,n-1\}italic_I ⊊ { 1 , 2 , … , italic_n - 1 }, then the knapsack can be filled completely if and only if exactly the items I𝐼Iitalic_I have been packed before it. And if the last item has size sn=2nsubscript𝑠𝑛superscript2𝑛s_{n}=2^{-n}italic_s start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT = 2 start_POSTSUPERSCRIPT - italic_n end_POSTSUPERSCRIPT, then the algorithm needs to pack all items for optimality, leaving a gap of 2nsuperscript2𝑛2^{-n}2 start_POSTSUPERSCRIPT - italic_n end_POSTSUPERSCRIPT. Now, an advice string of length n1𝑛1n-1italic_n - 1 should already enable us to distinguish between the 2n1superscript2𝑛12^{n-1}2 start_POSTSUPERSCRIPT italic_n - 1 end_POSTSUPERSCRIPT possible sizes of the last item, allowing the algorithm to select the optimal subset of the first n1𝑛1n-1italic_n - 1 items. An advice algorithm reading fewer than n1𝑛1n-1italic_n - 1 advice bits on instances of length n𝑛nitalic_n inevitably packs the same subset of the first n1𝑛1n-1italic_n - 1 items for two different sizes of the last item, leading to a suboptimal performance for one of the two.

This is essentially what led to the previously known lower bound of n1𝑛1n-1italic_n - 1 advice bits for optimality. The key point to note now is that the algorithm has to read these n1𝑛1n-1italic_n - 1 advice bits, proved necessary for optimality on instances of length n𝑛nitalic_n, before the last item is presented. Thus it is in fact reading n1𝑛1n-1italic_n - 1 advice bits while processing the first n1𝑛1n-1italic_n - 1 items of the instance, which—thanks to our modification—also constitute a complete instance on their own. Thus n=n1superscript𝑛normal-′𝑛1n^{\prime}=n-1italic_n start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = italic_n - 1 advice bits are consumed on an instance of length nsuperscript𝑛normal-′n^{\prime}italic_n start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, concluding the proof.

Having determined PropKnap’s advice complexity for optimality, we now do the same for PropRemKnap, the variant with removability. It turns out that the option to remove items hardly helps at all in achieving optimality. We begin the upper bound, which is simple but instructive as to what is possible with removability.

Theorem 4.3.

There is an optimal algorithm for PropRemKnap reading n1𝑛1n-1italic_n - 1 advice bits.

Proof 4.4.

Consider an algorithm that packs the first item without reading any advice bits. For each subsequent item, it reads one advice bit, telling it whether the new item is part of a fixed optimal solution. If so, then the new item is packed; otherwise, it is rejected. The first item, which has been packed without advice, is kept in the knapsack as long as there is enough room for it. If the first item is part of the fixed optimal solution, then it will always fit in beside the other items being packed; otherwise, it will be discarded at some point. Thus the algorithm is able to reproduce the fixed optimal solution exactly.

Theorem 4.5.

Solving PropRemKnap optimally requires more than nlogn𝑛𝑛n-\log nitalic_n - roman_log italic_n advice bits.

Proof 4.6.

Let any positive ε<1/3𝜀13\varepsilon<1/3italic_ε < 1 / 3 of the form ε=1/(2j)𝜀12𝑗\varepsilon=1/(2j)italic_ε = 1 / ( 2 italic_j ) for an odd integer j𝑗jitalic_j be given. Now, we can choose an arbitrarily large odd integer m𝑚mitalic_m such that 2εm+12𝜀𝑚12\varepsilon m+12 italic_ε italic_m + 1 is a power of two, namely an appropriate multiple of j𝑗jitalic_j. Since 2εm+12𝜀𝑚12\varepsilon m+12 italic_ε italic_m + 1 is even and m𝑚mitalic_m is odd, we know that m2εm𝑚2𝜀𝑚m-2\varepsilon mitalic_m - 2 italic_ε italic_m is even and thus m/2εm𝑚2𝜀𝑚m/2-\varepsilon mitalic_m / 2 - italic_ε italic_m is an integer. We denote it by k=m/2εm𝑘𝑚2𝜀𝑚k=m/2-\varepsilon mitalic_k = italic_m / 2 - italic_ε italic_m and note that m2k=2εm𝑚2𝑘2𝜀𝑚m-2k=2\varepsilon mitalic_m - 2 italic_k = 2 italic_ε italic_m. We consider a family of instances that are all identical, with exception of the final item. The capacity of the knapsack shall be mk+1𝑚𝑘1m-k+1italic_m - italic_k + 1. We could of course normalize this to 1111 by scaling down the capacity and all item sizes.

First, for each i{0,1,,log(2εm+1)1}𝑖01normal-…2𝜀𝑚11i\in\{0,1,\dots,\log(2\varepsilon m+1)-1\}italic_i ∈ { 0 , 1 , … , roman_log ( 2 italic_ε italic_m + 1 ) - 1 }, an item of size 2isuperscript2𝑖2^{i}2 start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT is presented. Note that these log(εm+1)𝜀𝑚1\log(\varepsilon m+1)roman_log ( italic_ε italic_m + 1 ) items have a total size of i=0log(2εm+1)12i=2log(2εm+1)1=2εmsuperscriptsubscript𝑖02𝜀𝑚11superscript2𝑖superscript22𝜀𝑚112𝜀𝑚\sum_{i=0}^{\log(2\varepsilon m+1)-1}2^{i}=2^{\log(2\varepsilon m+1)}-1=2\varepsilon m∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_log ( 2 italic_ε italic_m + 1 ) - 1 end_POSTSUPERSCRIPT 2 start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT = 2 start_POSTSUPERSCRIPT roman_log ( 2 italic_ε italic_m + 1 ) end_POSTSUPERSCRIPT - 1 = 2 italic_ε italic_m. Moreover, for every j{0,1,,2εm}𝑗01normal-…2𝜀𝑚j\in\{0,1,\dots,2\varepsilon m\}italic_j ∈ { 0 , 1 , … , 2 italic_ε italic_m }, there is exactly one item subset of total size j𝑗jitalic_j.

The instance then continues with m𝑚mitalic_m more items, one of each size in

M={1+12,,1+12m}={ 1+12i|1im}.𝑀11211superscript2𝑚conditional-set11superscript2𝑖1𝑖𝑚M=\Bigl{\{}1+\frac{1}{2},\ldots,1+\frac{1}{2^{m}}\Bigr{\}}=\Bigl{\{}\,1+\frac{% 1}{2^{i}}\Bigm{|}1\leq i\leq m\,\Bigr{\}}.italic_M = { 1 + divide start_ARG 1 end_ARG start_ARG 2 end_ARG , … , 1 + divide start_ARG 1 end_ARG start_ARG 2 start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT end_ARG } = { 1 + divide start_ARG 1 end_ARG start_ARG 2 start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT end_ARG | 1 ≤ italic_i ≤ italic_m } .

Finally, a single item of size 1sS(s1)1subscript𝑠𝑆𝑠11-\sum_{s\in S}(s-1)1 - ∑ start_POSTSUBSCRIPT italic_s ∈ italic_S end_POSTSUBSCRIPT ( italic_s - 1 ) is presented, where S𝑆Sitalic_S may be any subset of M𝑀Mitalic_M whose cardinality satisfies k|S|mk𝑘𝑆𝑚𝑘k\leq|S|\leq m-kitalic_k ≤ | italic_S | ≤ italic_m - italic_k. There are i=kmk(mi)superscriptsubscript𝑖𝑘𝑚𝑘binomial𝑚𝑖\sum_{i=k}^{m-k}\binom{m}{i}∑ start_POSTSUBSCRIPT italic_i = italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m - italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) such subsets and we have one instance for each possible choice. A straightforward tail bound, which we derive at the end of this proof, shows that we have i=0k(mi)2mH(1/2ε)+logm1superscriptsubscript𝑖0𝑘binomial𝑚𝑖superscript2𝑚𝐻12𝜀𝑚1\sum_{i=0}^{k}\binom{m}{i}\leq 2^{mH(1/2-\varepsilon)+\log m-1}∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) ≤ 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) + roman_log italic_m - 1 end_POSTSUPERSCRIPT, where H(p)=plogp(1p)log(1p)𝐻𝑝𝑝𝑝1𝑝1𝑝H(p)=-p\log p-(1-p)\log(1-p)italic_H ( italic_p ) = - italic_p roman_log italic_p - ( 1 - italic_p ) roman_log ( 1 - italic_p ) is the binary entropy function. We also know that i=0m(mi)=2msuperscriptsubscript𝑖0𝑚binomial𝑚𝑖superscript2𝑚\sum_{i=0}^{m}\binom{m}{i}=2^{m}∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) = 2 start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT and therefore obtain

i=kmk(mi)superscriptsubscript𝑖𝑘𝑚𝑘binomial𝑚𝑖\displaystyle\sum_{i=k}^{m-k}\binom{m}{i}∑ start_POSTSUBSCRIPT italic_i = italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m - italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) 2m22mH(1/2ε)+logm1=2m(12m(1H(1/2ε))+logm)absentsuperscript2𝑚2superscript2𝑚𝐻12𝜀𝑚1superscript2𝑚1superscript2𝑚1𝐻12𝜀𝑚\displaystyle\geq 2^{m}-2\cdot 2^{mH(1/2-\varepsilon)+\log m-1}=2^{m}(1-2^{-m(% 1-H(1/2-\varepsilon))+\log m})≥ 2 start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT - 2 ⋅ 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) + roman_log italic_m - 1 end_POSTSUPERSCRIPT = 2 start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT ( 1 - 2 start_POSTSUPERSCRIPT - italic_m ( 1 - italic_H ( 1 / 2 - italic_ε ) ) + roman_log italic_m end_POSTSUPERSCRIPT )

as a lower bound on the number of instances.

Consider the instance whose final item has size 1sS0(s1)1subscript𝑠subscript𝑆0𝑠11-\sum_{s\in S_{0}}(s-1)1 - ∑ start_POSTSUBSCRIPT italic_s ∈ italic_S start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_POSTSUBSCRIPT ( italic_s - 1 ) for any given S0Msubscript𝑆0𝑀S_{0}\subseteq Mitalic_S start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ⊆ italic_M. The knapsack of capacity mk+1𝑚𝑘1m-k+1italic_m - italic_k + 1 can be filled completely with the items of this instance as follows: Pack the last item, all items of sizes in S0subscript𝑆0S_{0}italic_S start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT—which brings us to a total size of exactly |S0|+1subscript𝑆01|S_{0}|+1| italic_S start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT | + 1—and finally the unique subset of the first log(2εm+1)2𝜀𝑚1\log(2\varepsilon m+1)roman_log ( 2 italic_ε italic_m + 1 ) items with a total size of mk+1(|S0|+1)=m(k+|S0|)𝑚𝑘1subscript𝑆01𝑚𝑘subscript𝑆0m-k+1-(|S_{0}|+1)=m-(k+|S_{0}|)italic_m - italic_k + 1 - ( | italic_S start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT | + 1 ) = italic_m - ( italic_k + | italic_S start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT | ). This is in fact the only way to fill the knapsack entirely for the following reason. There is exactly one selection of the items with non-integer sizes such that their fractional parts sum up to an integer—namely exactly 1111—which is necessary to fill the knapsack of integer capacity completely. The remaining integer gap has to be filled by the remaining items with integer sizes, and we have already noted before that there is exactly one way to do this for every integer between 00 and m2k=2εm𝑚2𝑘2𝜀𝑚m-2k=2\varepsilon mitalic_m - 2 italic_k = 2 italic_ε italic_m. The instances are all identical until the last item is presented. Therefore, any online algorithm must have packed exactly the right selection of items when the final one is presented to realize the optimal solution. The number of advice bits necessary to distinguish the possible instances and guarantee optimality is therefore

logi=kmk(mi)superscriptsubscript𝑖𝑘𝑚𝑘binomial𝑚𝑖\displaystyle\log\sum_{i=k}^{m-k}\binom{m}{i}roman_log ∑ start_POSTSUBSCRIPT italic_i = italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m - italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) m+log(12m(1H(1/2ε))+logm).absent𝑚1superscript2𝑚1𝐻12𝜀𝑚\displaystyle\geq m+\log(1-2^{-m(1-H(1/2-\varepsilon))+\log m}).≥ italic_m + roman_log ( 1 - 2 start_POSTSUPERSCRIPT - italic_m ( 1 - italic_H ( 1 / 2 - italic_ε ) ) + roman_log italic_m end_POSTSUPERSCRIPT ) .

The following straightforward calculations—using the Taylor expansion for the logarithm and Stirling bounds—show that this can be bounded from below by nlog(5εn)>nlog(n)+log(1/ε)3𝑛5𝜀𝑛𝑛𝑛1𝜀3n-\log(5\varepsilon n)>n-\log(n)+\log(1/\varepsilon)-3italic_n - roman_log ( 5 italic_ε italic_n ) > italic_n - roman_log ( italic_n ) + roman_log ( 1 / italic_ε ) - 3 for sufficiently large m𝑚mitalic_m.

Using the Taylor expansion for the natural logarithm around 1111, we have

log(1x)1𝑥\displaystyle\log(1-x)roman_log ( 1 - italic_x ) =1logei=1xiiabsent1𝑒superscriptsubscript𝑖1superscript𝑥𝑖𝑖\displaystyle=\frac{-1}{\log e}\sum_{i=1}^{\infty}\frac{x^{i}}{i}= divide start_ARG - 1 end_ARG start_ARG roman_log italic_e end_ARG ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT divide start_ARG italic_x start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT end_ARG start_ARG italic_i end_ARG
>xi=1xi1iabsent𝑥superscriptsubscript𝑖1superscript𝑥𝑖1𝑖\displaystyle>-x\sum_{i=1}^{\infty}\frac{x^{i-1}}{i}> - italic_x ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT divide start_ARG italic_x start_POSTSUPERSCRIPT italic_i - 1 end_POSTSUPERSCRIPT end_ARG start_ARG italic_i end_ARG
=xi=0xii+1absent𝑥superscriptsubscript𝑖0superscript𝑥𝑖𝑖1\displaystyle=-x\sum_{i=0}^{\infty}\frac{x^{i}}{i+1}= - italic_x ∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT divide start_ARG italic_x start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT end_ARG start_ARG italic_i + 1 end_ARG
>xi=0xiabsent𝑥superscriptsubscript𝑖0superscript𝑥𝑖\displaystyle>-x\sum_{i=0}^{\infty}x^{i}> - italic_x ∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_x start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT
>x11xabsent𝑥11𝑥\displaystyle>-x\frac{1}{1-x}> - italic_x divide start_ARG 1 end_ARG start_ARG 1 - italic_x end_ARG
2xabsent2𝑥\displaystyle\geq-2x≥ - 2 italic_x

for 0<x<1/20𝑥120<x<1/20 < italic_x < 1 / 2. Applying this to x=2m(1H(1/2ε))+logm𝑥superscript2𝑚1𝐻12𝜀𝑚x=2^{-m(1-H(1/2-\varepsilon))+\log m}italic_x = 2 start_POSTSUPERSCRIPT - italic_m ( 1 - italic_H ( 1 / 2 - italic_ε ) ) + roman_log italic_m end_POSTSUPERSCRIPT we can thus further bound the number of required advice from below by

logi=kmk(mi)superscriptsubscript𝑖𝑘𝑚𝑘binomial𝑚𝑖\displaystyle\log\sum_{i=k}^{m-k}\binom{m}{i}roman_log ∑ start_POSTSUBSCRIPT italic_i = italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m - italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) m22m(1H(1/2ε))+logm.absent𝑚2superscript2𝑚1𝐻12𝜀𝑚\displaystyle\geq m-2\cdot 2^{-m(1-H(1/2-\varepsilon))+\log m}.≥ italic_m - 2 ⋅ 2 start_POSTSUPERSCRIPT - italic_m ( 1 - italic_H ( 1 / 2 - italic_ε ) ) + roman_log italic_m end_POSTSUPERSCRIPT .

Each of the described instances contains n=log(2εm+1)+m+1𝑛2𝜀𝑚1𝑚1n=\log(2\varepsilon m+1)+m+1italic_n = roman_log ( 2 italic_ε italic_m + 1 ) + italic_m + 1 items. This is greater than the number of required advice bits by at most

log(2εm+1)+1+22m(1H(1/2ε))+logm.2𝜀𝑚112superscript2𝑚1𝐻12𝜀𝑚\log(2\varepsilon m+1)+1+2\cdot 2^{-m(1-H(1/2-\varepsilon))+\log m}.roman_log ( 2 italic_ε italic_m + 1 ) + 1 + 2 ⋅ 2 start_POSTSUPERSCRIPT - italic_m ( 1 - italic_H ( 1 / 2 - italic_ε ) ) + roman_log italic_m end_POSTSUPERSCRIPT .

For any fixed, positive ε<1/2𝜀12\varepsilon<1/2italic_ε < 1 / 2, we have 0<H(1/2ε)<10𝐻12𝜀10<H(1/2-\varepsilon)<10 < italic_H ( 1 / 2 - italic_ε ) < 1 and thus the exponent m(1H(1/2ε))+logm𝑚1𝐻12𝜀𝑚-m(1-H(1/2-\varepsilon))+\log m- italic_m ( 1 - italic_H ( 1 / 2 - italic_ε ) ) + roman_log italic_m growing to arbitrarily large negative numbers for increasing m𝑚mitalic_m. This means that the difference between the number of items n𝑛nitalic_n and the number of required advice bits asymptotically coincides with log(2εm+1)+1=nm2𝜀𝑚11𝑛𝑚\log(2\varepsilon m+1)+1=n-mroman_log ( 2 italic_ε italic_m + 1 ) + 1 = italic_n - italic_m.

We have m=nlog(2εm+1)1>nlog(2εn+1)1𝑚𝑛2𝜀𝑚11𝑛2𝜀𝑛11m=n-\log(2\varepsilon m+1)-1>n-\log(2\varepsilon n+1)-1italic_m = italic_n - roman_log ( 2 italic_ε italic_m + 1 ) - 1 > italic_n - roman_log ( 2 italic_ε italic_n + 1 ) - 1 and thus nm<log(2εn+1)+1<log(5εn)𝑛𝑚2𝜀𝑛115𝜀𝑛n-m<\log(2\varepsilon n+1)+1<\log(5\varepsilon n)italic_n - italic_m < roman_log ( 2 italic_ε italic_n + 1 ) + 1 < roman_log ( 5 italic_ε italic_n ) for sufficiently large m𝑚mitalic_m and thus n𝑛nitalic_n. Hence more than nlog(5εn)>nlog(n)+log(1/ε)3𝑛5𝜀𝑛𝑛𝑛1𝜀3n-\log(5\varepsilon n)>n-\log(n)+\log(1/\varepsilon)-3italic_n - roman_log ( 5 italic_ε italic_n ) > italic_n - roman_log ( italic_n ) + roman_log ( 1 / italic_ε ) - 3 advice bits are necessary for optimality on instances of length n𝑛nitalic_n for an arbitrarily small positive ε<1/2𝜀12\varepsilon<1/2italic_ε < 1 / 2.

It remains to prove the mentioned tail bound, for which we use the standard Stirling bounds [23], which—in a simple form—are 2πn(n/e)nn!en(n/e)n2𝜋𝑛superscript𝑛𝑒𝑛𝑛𝑒𝑛superscript𝑛𝑒𝑛\sqrt{2\pi n}(n/e)^{n}\leq n!\leq e\sqrt{n}(n/e)^{n}square-root start_ARG 2 italic_π italic_n end_ARG ( italic_n / italic_e ) start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT ≤ italic_n ! ≤ italic_e square-root start_ARG italic_n end_ARG ( italic_n / italic_e ) start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT.

We obtain

i=0k(mi)superscriptsubscript𝑖0𝑘binomial𝑚𝑖\displaystyle\sum_{i=0}^{k}\binom{m}{i}∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) =1+i=1k(mi)absent1superscriptsubscript𝑖1𝑘binomial𝑚𝑖\displaystyle=1+\sum_{i=1}^{k}\binom{m}{i}= 1 + ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG )
1+k(mk)absent1𝑘binomial𝑚𝑘\displaystyle\leq 1+k\binom{m}{k}≤ 1 + italic_k ( FRACOP start_ARG italic_m end_ARG start_ARG italic_k end_ARG )
1+m!kk!(mk)!absent1𝑚𝑘𝑘𝑚𝑘\displaystyle\leq 1+\frac{m!k}{k!(m-k)!}≤ 1 + divide start_ARG italic_m ! italic_k end_ARG start_ARG italic_k ! ( italic_m - italic_k ) ! end_ARG
1+ekm(m/e)m2πk(k/e)k2π(mk)((mk)/e)mkabsent1𝑒𝑘𝑚superscript𝑚𝑒𝑚2𝜋𝑘superscript𝑘𝑒𝑘2𝜋𝑚𝑘superscript𝑚𝑘𝑒𝑚𝑘\displaystyle\leq 1+\frac{ek\sqrt{m}(m/e)^{m}}{\sqrt{2\pi k}(k/e)^{k}\sqrt{2% \pi(m-k)}((m-k)/e)^{m-k}}≤ 1 + divide start_ARG italic_e italic_k square-root start_ARG italic_m end_ARG ( italic_m / italic_e ) start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT end_ARG start_ARG square-root start_ARG 2 italic_π italic_k end_ARG ( italic_k / italic_e ) start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT square-root start_ARG 2 italic_π ( italic_m - italic_k ) end_ARG ( ( italic_m - italic_k ) / italic_e ) start_POSTSUPERSCRIPT italic_m - italic_k end_POSTSUPERSCRIPT end_ARG
=1+ek2πmk(mk)mmkk(mk)mkekemkemabsent1𝑒𝑘2𝜋𝑚𝑘𝑚𝑘superscript𝑚𝑚superscript𝑘𝑘superscript𝑚𝑘𝑚𝑘superscript𝑒𝑘superscript𝑒𝑚𝑘superscript𝑒𝑚\displaystyle=1+\frac{ek}{2\pi}\frac{\sqrt{m}}{\sqrt{k(m-k)}}\frac{m^{m}}{k^{k% }(m-k)^{m-k}}\frac{e^{k}e^{m-k}}{e^{m}}= 1 + divide start_ARG italic_e italic_k end_ARG start_ARG 2 italic_π end_ARG divide start_ARG square-root start_ARG italic_m end_ARG end_ARG start_ARG square-root start_ARG italic_k ( italic_m - italic_k ) end_ARG end_ARG divide start_ARG italic_m start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT end_ARG start_ARG italic_k start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( italic_m - italic_k ) start_POSTSUPERSCRIPT italic_m - italic_k end_POSTSUPERSCRIPT end_ARG divide start_ARG italic_e start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT italic_e start_POSTSUPERSCRIPT italic_m - italic_k end_POSTSUPERSCRIPT end_ARG start_ARG italic_e start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT end_ARG
=1+ek2πmk(mk)(mk)k(mmk)mkabsent1𝑒𝑘2𝜋𝑚𝑘𝑚𝑘superscript𝑚𝑘𝑘superscript𝑚𝑚𝑘𝑚𝑘\displaystyle=1+\frac{ek}{2\pi}\sqrt{\frac{m}{k(m-k)}}\mathopen{}\mathclose{{}% \left(\frac{m}{k}}\right)^{k}\mathopen{}\mathclose{{}\left(\frac{m}{m-k}}% \right)^{m-k}= 1 + divide start_ARG italic_e italic_k end_ARG start_ARG 2 italic_π end_ARG square-root start_ARG divide start_ARG italic_m end_ARG start_ARG italic_k ( italic_m - italic_k ) end_ARG end_ARG ( divide start_ARG italic_m end_ARG start_ARG italic_k end_ARG ) start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( divide start_ARG italic_m end_ARG start_ARG italic_m - italic_k end_ARG ) start_POSTSUPERSCRIPT italic_m - italic_k end_POSTSUPERSCRIPT
Since k=m/2εm=m(1/2ε)𝑘𝑚2𝜀𝑚𝑚12𝜀k=m/2-\varepsilon m=m(1/2-\varepsilon)italic_k = italic_m / 2 - italic_ε italic_m = italic_m ( 1 / 2 - italic_ε ), we have mk=m(1/2+ε)𝑚𝑘𝑚12𝜀m-k=m(1/2+\varepsilon)italic_m - italic_k = italic_m ( 1 / 2 + italic_ε ). Using this and the binomial theorem (1/2ε)(1/2+ε)=1/4ε212𝜀12𝜀14superscript𝜀2(1/2-\varepsilon)(1/2+\varepsilon)=1/4-\varepsilon^{2}( 1 / 2 - italic_ε ) ( 1 / 2 + italic_ε ) = 1 / 4 - italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT twice, we obtain the following bound.
i=0k(mi)superscriptsubscript𝑖0𝑘binomial𝑚𝑖\displaystyle\sum_{i=0}^{k}\binom{m}{i}∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) 1+ek2π1m(1/4ε2)(11/2ε)m(1/2ε)(11/2+ε)m(1/2+ε)absent1𝑒𝑘2𝜋1𝑚14superscript𝜀2superscript112𝜀𝑚12𝜀superscript112𝜀𝑚12𝜀\displaystyle\leq 1+\frac{ek}{2\pi}\frac{1}{\sqrt{m(1/4-\varepsilon^{2})}}% \mathopen{}\mathclose{{}\left(\frac{1}{1/2-\varepsilon}}\right)^{m(1/2-% \varepsilon)}\mathopen{}\mathclose{{}\left(\frac{1}{1/2+\varepsilon}}\right)^{% m(1/2+\varepsilon)}≤ 1 + divide start_ARG italic_e italic_k end_ARG start_ARG 2 italic_π end_ARG divide start_ARG 1 end_ARG start_ARG square-root start_ARG italic_m ( 1 / 4 - italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) end_ARG end_ARG ( divide start_ARG 1 end_ARG start_ARG 1 / 2 - italic_ε end_ARG ) start_POSTSUPERSCRIPT italic_m ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT ( divide start_ARG 1 end_ARG start_ARG 1 / 2 + italic_ε end_ARG ) start_POSTSUPERSCRIPT italic_m ( 1 / 2 + italic_ε ) end_POSTSUPERSCRIPT
Since H(p)=plog(1/p)+(1p)log(1/(1p))𝐻𝑝𝑝1𝑝1𝑝11𝑝H(p)=p\log(1/p)+(1-p)\log(1/(1-p))italic_H ( italic_p ) = italic_p roman_log ( 1 / italic_p ) + ( 1 - italic_p ) roman_log ( 1 / ( 1 - italic_p ) ), we have 2H(p)=(1p)p(11p)1psuperscript2𝐻𝑝superscript1𝑝𝑝superscript11𝑝1𝑝2^{H(p)}=\mathopen{}\mathclose{{}\left(\frac{1}{p}}\right)^{p}\mathopen{}% \mathclose{{}\left(\frac{1}{1-p}}\right)^{1-p}2 start_POSTSUPERSCRIPT italic_H ( italic_p ) end_POSTSUPERSCRIPT = ( divide start_ARG 1 end_ARG start_ARG italic_p end_ARG ) start_POSTSUPERSCRIPT italic_p end_POSTSUPERSCRIPT ( divide start_ARG 1 end_ARG start_ARG 1 - italic_p end_ARG ) start_POSTSUPERSCRIPT 1 - italic_p end_POSTSUPERSCRIPT and thus
i=0k(mi)superscriptsubscript𝑖0𝑘binomial𝑚𝑖\displaystyle\sum_{i=0}^{k}\binom{m}{i}∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) 1+ek2π1m(1/4ε2)2mH(1/2ε).absent1𝑒𝑘2𝜋1𝑚14superscript𝜀2superscript2𝑚𝐻12𝜀\displaystyle\leq 1+\frac{ek}{2\pi}\frac{1}{\sqrt{m(1/4-\varepsilon^{2})}}2^{% mH(1/2-\varepsilon)}.≤ 1 + divide start_ARG italic_e italic_k end_ARG start_ARG 2 italic_π end_ARG divide start_ARG 1 end_ARG start_ARG square-root start_ARG italic_m ( 1 / 4 - italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) end_ARG end_ARG 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT .
Since e/(2π)>1/3𝑒2𝜋13e/(2\pi)>1/3italic_e / ( 2 italic_π ) > 1 / 3 and ε1/3𝜀13\varepsilon\leq 1/3italic_ε ≤ 1 / 3, we can continue as follows.
i=0k(mi)superscriptsubscript𝑖0𝑘binomial𝑚𝑖\displaystyle\sum_{i=0}^{k}\binom{m}{i}∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) 1+3k1m/92mH(1/2ε)absent13𝑘1𝑚9superscript2𝑚𝐻12𝜀\displaystyle\leq 1+3k\frac{1}{\sqrt{m}/9}2^{mH(1/2-\varepsilon)}≤ 1 + 3 italic_k divide start_ARG 1 end_ARG start_ARG square-root start_ARG italic_m end_ARG / 9 end_ARG 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT
1+9km2mH(1/2ε)absent19𝑘𝑚superscript2𝑚𝐻12𝜀\displaystyle\leq 1+\frac{9k}{\sqrt{m}}2^{mH(1/2-\varepsilon)}≤ 1 + divide start_ARG 9 italic_k end_ARG start_ARG square-root start_ARG italic_m end_ARG end_ARG 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT
=1+9m(1/2ε)2mH(1/2ε)absent19𝑚12𝜀superscript2𝑚𝐻12𝜀\displaystyle=1+9\sqrt{m}(1/2-\varepsilon)2^{mH(1/2-\varepsilon)}= 1 + 9 square-root start_ARG italic_m end_ARG ( 1 / 2 - italic_ε ) 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT
1+(9/2)m2mH(1/2ε)9εm2mH(1/2ε)absent192𝑚superscript2𝑚𝐻12𝜀9𝜀𝑚superscript2𝑚𝐻12𝜀\displaystyle\leq 1+(9/2)\sqrt{m}\cdot 2^{mH(1/2-\varepsilon)}-9\varepsilon% \sqrt{m}\cdot 2^{mH(1/2-\varepsilon)}≤ 1 + ( 9 / 2 ) square-root start_ARG italic_m end_ARG ⋅ 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT - 9 italic_ε square-root start_ARG italic_m end_ARG ⋅ 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT
For any given, positive ε<1/2𝜀12\varepsilon<1/2italic_ε < 1 / 2, we have H(1/2ε)>0𝐻12𝜀0H(1/2-\varepsilon)>0italic_H ( 1 / 2 - italic_ε ) > 0. Choosing m92𝑚superscript92m\geq 9^{2}italic_m ≥ 9 start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT sufficiently large yields the desired tail bound:
i=0k(mi)superscriptsubscript𝑖0𝑘binomial𝑚𝑖\displaystyle\sum_{i=0}^{k}\binom{m}{i}∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_m end_ARG start_ARG italic_i end_ARG ) 1+(m/2)2mH(1/2ε)9εm2mH(1/2ε)absent1𝑚2superscript2𝑚𝐻12𝜀9𝜀𝑚superscript2𝑚𝐻12𝜀\displaystyle\leq 1+(m/2)\cdot 2^{mH(1/2-\varepsilon)}-9\varepsilon\sqrt{m}% \cdot 2^{mH(1/2-\varepsilon)}≤ 1 + ( italic_m / 2 ) ⋅ 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT - 9 italic_ε square-root start_ARG italic_m end_ARG ⋅ 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT
(m/2)2mH(1/2ε)absent𝑚2superscript2𝑚𝐻12𝜀\displaystyle\leq(m/2)\cdot 2^{mH(1/2-\varepsilon)}≤ ( italic_m / 2 ) ⋅ 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) end_POSTSUPERSCRIPT
=2mH(1/2ε)+logm1absentsuperscript2𝑚𝐻12𝜀𝑚1\displaystyle=2^{mH(1/2-\varepsilon)+\log m-1}= 2 start_POSTSUPERSCRIPT italic_m italic_H ( 1 / 2 - italic_ε ) + roman_log italic_m - 1 end_POSTSUPERSCRIPT

This concludes the proof of the theorem.

4.2 A Single Advice Bit

The previous section covered the upper end of the advice spectrum, showing that, asymptotically, reading one advice bit for each item in the instance is necessary and sufficient for ensuring an optimal solution. We now turn to the other extreme and ask what can be done with the least nonzero amount of advice, one single bit for the entire instance.

First, we describe a very simple 3/2323/23 / 2-competitive advice algorithm where a single advice bit indicates whether there is an optimal solution containing more than one item from the interval [1/3,2/3]1323[1/3,2/3][ 1 / 3 , 2 / 3 ]: If the answer is yes, the algorithm maintains the smallest item in this interval until a second item fits in, while ignoring all items outside of the interval. As soon as a second item fits, it is packed and all remaining items are rejected. If the answer is no, the algorithm maintains in the knapsack the largest item of size at least 1/3131/31 / 3 seen so far while packing all items smaller than 1/3131/31 / 3 as long as they fit. If the knapsack capacity is never exceeded, the solution is optimal. If the knapsack capacity is exceeded at some point, all packed items but possibly one are smaller than 1/3131/31 / 3. Discard these items one by one, in arbitrary order, until we are within the capacity of the knapsack again. The remaining gap is at most 1/3131/31 / 3.

Han et al. [11, Thm. 6] have presented a randomized algorithm that relies on a partition of the items into six size classes. It is rather involved and hard to analyze, yet yields an expected competitive ratio of 10/71.4285711071.42857110/7\approx 1.42857110 / 7 ≈ 1.428571. Because it uses only a single random bit, it provides an upper bound for our case of one advice bit as well. We undercut this bound with a more manageable 22\sqrt{2}square-root start_ARG 2 end_ARG-competitive algorithm that needs only five classes. We then complement this with a lower bound of (1+17)/4=4/(171)1.2808117441711.2808(1+\sqrt{17})/4=4/(\sqrt{17}-1)\approx 1.2808( 1 + square-root start_ARG 17 end_ARG ) / 4 = 4 / ( square-root start_ARG 17 end_ARG - 1 ) ≈ 1.2808.

Theorem 4.7.

There is a 22\sqrt{2}square-root start_ARG 2 end_ARG-competitive algorithm for PropRemKnap reading only one advice bit.

tinytinysmallmediumbighugesmalltinysmallmediumbighugemediumtinysmallmediumbighugebigtinysmallmediumbighugehugetinysmallmediumbighugelittlelittlelargelargelittlelarge000abcd10𝑎𝑏𝑐𝑑10abcd10 italic_a italic_b italic_c italic_d 1a𝑎aitalic_a0abcd10𝑎𝑏𝑐𝑑10abcd10 italic_a italic_b italic_c italic_d 1b𝑏bitalic_b0abcd10𝑎𝑏𝑐𝑑10abcd10 italic_a italic_b italic_c italic_d 1c𝑐citalic_c0abcd10𝑎𝑏𝑐𝑑10abcd10 italic_a italic_b italic_c italic_d 1d𝑑ditalic_d0abcd10𝑎𝑏𝑐𝑑10abcd10 italic_a italic_b italic_c italic_d 11111
Figure 2: The partition of the interval (0,1]01(0,1]( 0 , 1 ] of possible sizes into the five subintervals used in the proof of Theorem 4.7—namely (0,a]0𝑎(0,a]( 0 , italic_a ], (a,b]𝑎𝑏(a,b]( italic_a , italic_b ], (b,c]𝑏𝑐(b,c]( italic_b , italic_c ], (c,d]𝑐𝑑(c,d]( italic_c , italic_d ], and (d,1]𝑑1(d,1]( italic_d , 1 ]—plus the corresponding class names. The values are a=11/20.293𝑎1120.293a=1-1/\sqrt{2}\approx 0.293italic_a = 1 - 1 / square-root start_ARG 2 end_ARG ≈ 0.293, and b=210.414𝑏210.414b=\sqrt{2}-1\approx 0.414italic_b = square-root start_ARG 2 end_ARG - 1 ≈ 0.414, and c=1/2𝑐12c=1/2italic_c = 1 / 2, and d=1/20.707𝑑120.707d=1/\sqrt{2}\approx 0.707italic_d = 1 / square-root start_ARG 2 end_ARG ≈ 0.707.
Proof 4.8.

We split the interval (0,1]01(0,1]( 0 , 1 ] of possible sizes into subintervals at four points a<b<c<d𝑎𝑏𝑐𝑑a<b<c<ditalic_a < italic_b < italic_c < italic_d. We will call the items with sizes in one of these five intervals tiny, small, medium, big, and huge, respectively. Formally, we partition the items into the five classes

Ptinysubscript𝑃tiny\displaystyle P_{\textnormal{tiny}}{}italic_P start_POSTSUBSCRIPT tiny end_POSTSUBSCRIPT ={i0<s(i)a},absentconditional-set𝑖0𝑠𝑖𝑎\displaystyle=\{\,i\mid 0<s(i)\leq a\,\},= { italic_i ∣ 0 < italic_s ( italic_i ) ≤ italic_a } , Psmallsubscript𝑃small\displaystyle P_{\textnormal{small}}{}italic_P start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ={ia<s(i)b},absentconditional-set𝑖𝑎𝑠𝑖𝑏\displaystyle=\{\,i\mid a<s(i)\leq b\,\},= { italic_i ∣ italic_a < italic_s ( italic_i ) ≤ italic_b } , Pmediumsubscript𝑃medium\displaystyle P_{\textnormal{medium}}{}italic_P start_POSTSUBSCRIPT medium end_POSTSUBSCRIPT ={ib<s(i)c},absentconditional-set𝑖𝑏𝑠𝑖𝑐\displaystyle=\{\,i\mid b<s(i)\leq c\,\},= { italic_i ∣ italic_b < italic_s ( italic_i ) ≤ italic_c } ,
Pbigsubscript𝑃big\displaystyle P_{\textnormal{big}}{}italic_P start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ={ic<s(i)d},absentconditional-set𝑖𝑐𝑠𝑖𝑑\displaystyle=\{\,i\mid c<s(i)\leq d\,\},\text{}= { italic_i ∣ italic_c < italic_s ( italic_i ) ≤ italic_d } , Phugesubscript𝑃huge\displaystyle P_{\textnormal{huge}}{}italic_P start_POSTSUBSCRIPT huge end_POSTSUBSCRIPT ={id<s(i)1},absentconditional-set𝑖𝑑𝑠𝑖1\displaystyle=\{\,i\mid d<s(i)\leq 1\,\},= { italic_i ∣ italic_d < italic_s ( italic_i ) ≤ 1 } ,

where a=11/20.29289𝑎1120.29289a=1-1/\sqrt{2}\approx 0.29289italic_a = 1 - 1 / square-root start_ARG 2 end_ARG ≈ 0.29289, b=210.41421𝑏210.41421b=\sqrt{2}-1\approx 0.41421italic_b = square-root start_ARG 2 end_ARG - 1 ≈ 0.41421, c=1/2𝑐12c=1/2italic_c = 1 / 2, and d=1/20.70711𝑑120.70711d=1/\sqrt{2}\approx 0.70711italic_d = 1 / square-root start_ARG 2 end_ARG ≈ 0.70711.

We will call the small and medium items the little ones collectively and refer to the big and huge items as the large ones. Accordingly, we let Plittle=PsmallPmediumsubscript𝑃littlesubscript𝑃smallsubscript𝑃mediumP_{\textnormal{little}}=P_{\textnormal{small}}\cup P_{\textnormal{medium}}italic_P start_POSTSUBSCRIPT little end_POSTSUBSCRIPT = italic_P start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ∪ italic_P start_POSTSUBSCRIPT medium end_POSTSUBSCRIPT and Plarge=PbigPhugesubscript𝑃largesubscript𝑃bigsubscript𝑃hugeP_{\textnormal{large}}=P_{\textnormal{big}}\cup P_{\textnormal{huge}}italic_P start_POSTSUBSCRIPT large end_POSTSUBSCRIPT = italic_P start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ∪ italic_P start_POSTSUBSCRIPT huge end_POSTSUBSCRIPT. See Figure 2 for an illustration of the subintervals and class names.

The oracle uses the one available advice bit to tell the algorithm which of the two strategies described below to apply. For the decision, the oracle picks an arbitrary optimal solution S𝑆Sitalic_S to the given instance. If S𝑆Sitalic_S contains a large item, the first strategy will be chosen, with one exception: If the instance contains no huge item but a little and a big item that fit into the knapsack together, then the first strategy is chosen only if a minimal big item appears in the instance before a minimal small item. In all other cases, the second strategy is implemented.

Strategy One

If at any point a huge item appears, the algorithm packs it and keeps it until the end, discarding everything else.

Otherwise, the algorithm operates with two slots, a primary one and a secondary one. In the primary slot, it maintains the minimal big item and in the secondary slot it maintains the minimal little item. The primary slot takes precedence; that is, in case of a conflict where a new minimal item for one slot is presented that does not fit with the minimal item in the other slot, we discard the little item.

While maintaining the slot contents, tiny items are always packed greedily. If at any point a presented tiny item does not fit, the current contents of the knapsack are frozen and kept as they are until the instance has ended. The same happens after a step in which only tiny items have been discarded.

Strategy Two

This strategy manages not only two but three slots, all of which maintain minimal items of some class. In order of precedence, the primary slot maintains two medium items, the secondary slot up to three small items, and the tertiary one big one. As an exception, if at any point a big item appears that can be packed alongside a currently packed small item by discarding everything else, then this is done and these two items are kept till the end. The tiny items are handled as before: They are packed greedily and if either a presented tiny item does not fit or only tiny items have been discarded in one step, then the current knapsack configuration is kept up to the very end.

We now need to carefully work through a case distinction according to the conditions listed in Table 1 and show that the algorithm’s competitivity is indeed bounded from above by max{1/d,d/c,\max\{1/d,d/c,roman_max { 1 / italic_d , italic_d / italic_c , 1/2b,1/(a+b),1/(1a),b/a}=21/2b,1/(a+b),1/(1-a),b/a\}=\sqrt{2}1 / 2 italic_b , 1 / ( italic_a + italic_b ) , 1 / ( 1 - italic_a ) , italic_b / italic_a } = square-root start_ARG 2 end_ARG.

Table 1: The mutually exclusive cases considered in Theorem 4.7.
Case Strategy Competitivity Case Conditions
A One 1/d1𝑑1/d1 / italic_d |Phuge|>0subscript𝑃huge0|P_{\textnormal{huge}}|>0| italic_P start_POSTSUBSCRIPT huge end_POSTSUBSCRIPT | > 0
B One/Two d/c𝑑𝑐d/citalic_d / italic_c |Phuge|=0subscript𝑃huge0|P_{\textnormal{huge}}|=0| italic_P start_POSTSUBSCRIPT huge end_POSTSUBSCRIPT | = 0 |SPbig|>0𝑆subscript𝑃big0|S\cap P_{\textnormal{big}}|>0| italic_S ∩ italic_P start_POSTSUBSCRIPT big end_POSTSUBSCRIPT | > 0 |Pmedium|1subscript𝑃medium1|P_{\textnormal{medium}}|\leq 1| italic_P start_POSTSUBSCRIPT medium end_POSTSUBSCRIPT | ≤ 1
C Two 1/2b12𝑏1/2b1 / 2 italic_b |Phuge|=0subscript𝑃huge0|P_{\textnormal{huge}}|=0| italic_P start_POSTSUBSCRIPT huge end_POSTSUBSCRIPT | = 0 |SPbig|0𝑆subscript𝑃big0|S\cap P_{\textnormal{big}}|\geq 0| italic_S ∩ italic_P start_POSTSUBSCRIPT big end_POSTSUBSCRIPT | ≥ 0 |Pmedium|>1subscript𝑃medium1|P_{\textnormal{medium}}|>1| italic_P start_POSTSUBSCRIPT medium end_POSTSUBSCRIPT | > 1
D Two 1/(a+b)1𝑎𝑏1/(a+b)1 / ( italic_a + italic_b ) |Phuge|=0subscript𝑃huge0|P_{\textnormal{huge}}|=0| italic_P start_POSTSUBSCRIPT huge end_POSTSUBSCRIPT | = 0 |SPbig|=0𝑆subscript𝑃big0|S\cap P_{\textnormal{big}}|=0| italic_S ∩ italic_P start_POSTSUBSCRIPT big end_POSTSUBSCRIPT | = 0 |Pmedium|=1subscript𝑃medium1|P_{\textnormal{medium}}|=1| italic_P start_POSTSUBSCRIPT medium end_POSTSUBSCRIPT | = 1 |Psmall|>0subscript𝑃small0|P_{\textnormal{small}}|>0| italic_P start_POSTSUBSCRIPT small end_POSTSUBSCRIPT | > 0
E Two b/a𝑏𝑎b/aitalic_b / italic_a |Phuge|=0subscript𝑃huge0|P_{\textnormal{huge}}|=0| italic_P start_POSTSUBSCRIPT huge end_POSTSUBSCRIPT | = 0 |SPbig|=0𝑆subscript𝑃big0|S\cap P_{\textnormal{big}}|=0| italic_S ∩ italic_P start_POSTSUBSCRIPT big end_POSTSUBSCRIPT | = 0 |Pmedium|=0subscript𝑃medium0|P_{\textnormal{medium}}|=0| italic_P start_POSTSUBSCRIPT medium end_POSTSUBSCRIPT | = 0 |Psmall|>0subscript𝑃small0|P_{\textnormal{small}}|>0| italic_P start_POSTSUBSCRIPT small end_POSTSUBSCRIPT | > 0
F Two 1/(1a)11𝑎1/(1-a)1 / ( 1 - italic_a ) |Phuge|=0subscript𝑃huge0|P_{\textnormal{huge}}|=0| italic_P start_POSTSUBSCRIPT huge end_POSTSUBSCRIPT | = 0 |SPbig|=0𝑆subscript𝑃big0|S\cap P_{\textnormal{big}}|=0| italic_S ∩ italic_P start_POSTSUBSCRIPT big end_POSTSUBSCRIPT | = 0 |Pmedium|1subscript𝑃medium1|P_{\textnormal{medium}}|\leq 1| italic_P start_POSTSUBSCRIPT medium end_POSTSUBSCRIPT | ≤ 1 |Psmall|=0subscript𝑃small0|P_{\textnormal{small}}|=0| italic_P start_POSTSUBSCRIPT small end_POSTSUBSCRIPT | = 0
Case A.

This case is trivial: If there are huge items in the instance, the first one will be packed and kept in the knapsack, yielding a competitive performance of 1/d1𝑑1/d1 / italic_d or better.

Case B.

The case condition |SPbig|>0𝑆subscript𝑃big0|S\cap P_{\textnormal{big}}|>0| italic_S ∩ italic_P start_POSTSUBSCRIPT big end_POSTSUBSCRIPT | > 0 tells us that the optimal solution contains at least one big item. Since big items have a size above c=1/2𝑐12c=1/2italic_c = 1 / 2, it contains exactly one. Moreover, there is at most one medium item in the entire instance. We now consider two subcases.

Subcase B1: Assume first that the instance contains no pair of a little and a big item that can be packed at the same time. This means that the first strategy—which gives preference to big items over little ones—is operative. The algorithm will thus only discard a possibly packed little item when the first appearing big item appears to replace it. The strategy guarantees that one big item of size greater than c𝑐citalic_c is contained in the knapsack in the end. If there are no tiny items, both the online solution and the optimal solution S𝑆Sitalic_S contain exactly one big item and nothing else, implying a competitive performance of c/d𝑐𝑑c/ditalic_c / italic_d. For the case that there are tiny items, recall that they are always packed greedily. Moreover, if any tiny item does not fit or is dismissed in some step, the algorithm conserves the current state of the knapsack, guaranteeing a filling of at least 1a1𝑎1-a1 - italic_a. We may therefore assume that every tiny item is packed and kept in the online solution computed here. Whatever tiny items are contained in the optimal solution S𝑆Sitalic_S are thus in the online solution as well. If they have a total size t𝑡titalic_t, the competitive performance is thus bounded from above by (d+t)/(c+t)d/c𝑑𝑡𝑐𝑡𝑑𝑐(d+t)/(c+t)\leq d/c( italic_d + italic_t ) / ( italic_c + italic_t ) ≤ italic_d / italic_c.

Subcase B2: Assume that there are a little and a big item that can be packed alongside each other. Let i𝑖iitalic_i be the first minimal little item and j𝑗jitalic_j the first minimal big item. Clearly, i𝑖iitalic_i and j𝑗jitalic_j fit into the knapsack together. If the knapsack contains these two items in the end, the competitive performance is 1/(a+c)1/(a+b)=d/c1𝑎𝑐1𝑎𝑏𝑑𝑐1/(a+c)\leq 1/(a+b)=d/c1 / ( italic_a + italic_c ) ≤ 1 / ( italic_a + italic_b ) = italic_d / italic_c or better.

Subcase B2a: Assume that i𝑖iitalic_i appears after j𝑗jitalic_j. In this case, the first strategy is used. Since it maintains the smallest big item seen so far in the primary slot, it will have j𝑗jitalic_j packed when i𝑖iitalic_i is presented, allowing for i𝑖iitalic_i to be packed alongside it.

Subcase B2b: Assume that i𝑖iitalic_i appears before j𝑗jitalic_j, letting the algorithm implement the second strategy. The chosen strategy maintains up to two minimal medium items in the primary slot and up to three minimal small items in its secondary slot. However, there is by the global assumption of case B𝐵Bitalic_B at most one medium item in the entire instance and a small item will always fit in beside a medium item because b+c1𝑏𝑐1b+c\leq 1italic_b + italic_c ≤ 1. Hence, overall, a minimal little item is maintained in the knapsack, meaning that i𝑖iitalic_i is packed already when j𝑗jitalic_j appears, allowing for a little and big item to be packed together according to the strategy’s stated exception.

Case C.

This simple case is covered by the second strategy. Maintaining two medium items in the slot with highest precedence guarantees a filled fraction of at least 2b2𝑏2b2 italic_b.

Case D.

This case is easy as well: The one medium item will be packed into the primary slot when presented, and at least one small item is packed into and stays in the secondary slot because any small item fits in beside any medium item. The total size of small and a medium item is at least a+b𝑎𝑏a+bitalic_a + italic_b, leading to a competitive performance of 1/(a+b)1𝑎𝑏1/(a+b)1 / ( italic_a + italic_b ) or better.

Case E.

Since there are no medium items in this case, the secondary slot will maintain up to three minimal small items. If there are three small items that fit together, they will eventually be packed, yielding a filled fraction of at least 3a>a/b3𝑎𝑎𝑏3a>a/b3 italic_a > italic_a / italic_b. Otherwise, two small items will be packed, or only one if and only if it is the only one. If there were no tiny items, we could in both cases bound the competitivity by b/a𝑏𝑎b/aitalic_b / italic_a, using the maximal and minimal possible size of a small item. However, repeating the argument of subcase B1, we may assume that all tiny items are packed and none discarded, otherwise the packing would freeze instantly with a filling of at least 1a1𝑎1-a1 - italic_a. If the tiny items have a total size of t𝑡titalic_t, our bound would therefore only improve to (b+t)/(a+t)b/a𝑏𝑡𝑎𝑡𝑏𝑎(b+t)/(a+t)\leq b/a( italic_b + italic_t ) / ( italic_a + italic_t ) ≤ italic_b / italic_a.

Case F.

This case is quite simple again. If there is a medium item, it is always packed and kept to the end. Beside this one potential medium item, there are only tiny ones, the minimization in the slot will therefore not affect the result adversely. If all items of the instance fit into the knapsack together, they are all packed and the solution is optimal. Otherwise, the greedy packing of tiny items leaves a gap of less than a𝑎aitalic_a, ensuring a competitive factor of 1/(1a)11𝑎1/(1-a)1 / ( 1 - italic_a ) or better.

We now complement the upper bound of Theorem 4.7 with a lower bound of (1+17)/4=4/(171)1.2808117441711.2808(1+\sqrt{17})/4=4/(\sqrt{17}-1)\approx 1.2808( 1 + square-root start_ARG 17 end_ARG ) / 4 = 4 / ( square-root start_ARG 17 end_ARG - 1 ) ≈ 1.2808.

Theorem 4.9.

No algorithm for PropRemKnap reading only a single advice bit can have a better competitive ratio than (1+17)/41174(1+\sqrt{17})/4( 1 + square-root start_ARG 17 end_ARG ) / 4.

Proof 4.10.

Let ψ=4/(1+17)𝜓4117\psi=4/(1+\sqrt{17})italic_ψ = 4 / ( 1 + square-root start_ARG 17 end_ARG ) and choose a positive ε<ψ0.7808𝜀𝜓0.7808\varepsilon<\psi\approx 0.7808italic_ε < italic_ψ ≈ 0.7808. Let an algorithm for PropRemKnap reading only a single advice bit be given. Consider the three instances I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, and I3subscript𝐼3I_{3}italic_I start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT that all start with the same three items of sizes x1=ψsubscript𝑥1𝜓x_{1}=\psiitalic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_ψ, x2=ψ2subscript𝑥2superscript𝜓2x_{2}=\psi^{2}italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT, and x3=1ψ2+εsubscript𝑥31superscript𝜓2𝜀x_{3}=1-\psi^{2}+\varepsilonitalic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT = 1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_ε, which is the end of instance I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT but followed by a last item of size y2=1ψ2subscript𝑦21superscript𝜓2y_{2}=1-\psi^{2}italic_y start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = 1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT for I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT and of size y3=ψ2subscript𝑦3superscript𝜓2y_{3}=\psi^{2}italic_y start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT = italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT for I3subscript𝐼3I_{3}italic_I start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT.

Table 2: A hard instance family for PropRemKnap reading one advice bit; see the proof of Theorem 4.9.
x1subscript𝑥1x_{1}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT x2subscript𝑥2x_{2}italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT x3subscript𝑥3x_{3}italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT y2subscript𝑦2y_{2}italic_y start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT y3subscript𝑦3y_{3}italic_y start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT optimal second best ratio
I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT: ψ𝜓\psiitalic_ψ ψ2superscript𝜓2\psi^{2}italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT 1ψ2+ε1superscript𝜓2𝜀1-\psi^{2}+\varepsilon1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_ε ψ𝜓\psiitalic_ψ ψ2superscript𝜓2\psi^{2}italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ψ/ψ2𝜓superscript𝜓2\psi/\psi^{2}italic_ψ / italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT
I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT: ψ𝜓\psiitalic_ψ ψ2superscript𝜓2\psi^{2}italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT 1ψ2+ε1superscript𝜓2𝜀1-\psi^{2}+\varepsilon1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_ε 1ψ21superscript𝜓21-\psi^{2}1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT 1111 2(1ψ2)+ε21superscript𝜓2𝜀2(1-\psi^{2})+\varepsilon2 ( 1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) + italic_ε 1/(2(1ψ2)+ε)121superscript𝜓2𝜀1/(2(1-\psi^{2})+\varepsilon)1 / ( 2 ( 1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) + italic_ε )
I3subscript𝐼3I_{3}italic_I start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT: ψ𝜓\psiitalic_ψ ψ2superscript𝜓2\psi^{2}italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT 1ψ2+ε1superscript𝜓2𝜀1-\psi^{2}+\varepsilon1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_ε ψ2εsuperscript𝜓2𝜀\psi^{2}-\varepsilonitalic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - italic_ε 1111 ψ𝜓\psiitalic_ψ 1/ψ1𝜓1/\psi1 / italic_ψ

For each i{1,2,3}𝑖123i\in\{1,2,3\}italic_i ∈ { 1 , 2 , 3 }, the instance Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT has a unique optimal solution; it contains xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and, except for i=1𝑖1i=1italic_i = 1, additionally yisubscript𝑦𝑖y_{i}italic_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. Table 2 shows the total size for each of these optimal solutions and the second best solution.

Because any two of these three items x1subscript𝑥1x_{1}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, x2subscript𝑥2x_{2}italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, and x3subscript𝑥3x_{3}italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT sum up to over 1, the advice algorithm can keep at most one of them in the knapsack after the presentation of x3subscript𝑥3x_{3}italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT. Moreover, since only one advice bit is given and the three instances are indistinguishable until after the decision on the third item has been taken, there are two instances for which the same item, if any, is kept in the knapsack for the presentation of the potential fourth item. This implies that the algorithm is suboptimal for at least one instance. The second best solutions for I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, and I3subscript𝐼3I_{3}italic_I start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT fill up a fraction ψ𝜓\psiitalic_ψ, 2(1ψ2)+ε21superscript𝜓2𝜀2(1-\psi^{2})+\varepsilon2 ( 1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) + italic_ε, and ψ𝜓\psiitalic_ψ, respectively. Thus, the competitive ratio of cannot be better than the minimum of ψ/ψ2𝜓superscript𝜓2\psi/\psi^{2}italic_ψ / italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT, 1/(2(1ψ2)+ε)121superscript𝜓2𝜀1/(2(1-\psi^{2})+\varepsilon)1 / ( 2 ( 1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) + italic_ε ), and 1/ψ1𝜓1/\psi1 / italic_ψ. Since 2(1ψ2)=ψ21superscript𝜓2𝜓2(1-\psi^{2})=\psi2 ( 1 - italic_ψ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) = italic_ψ, this means the competitivity is 1/(ψ+ε)1𝜓𝜀1/(\psi+\varepsilon)1 / ( italic_ψ + italic_ε ) at best for arbitrarily small ε𝜀\varepsilonitalic_ε.

Note again that an advice bit is at least as powerful as a random bit, hence Theorem 4.9 also improves the best known lower bound of 5/4545/45 / 4 for one random bit due to Han et al. [11, Thm. 8].

4.3 Near Optimality with Constant Advice

Having seen how much advice is necessary for optimality and what the effect of a single advice bit can be, we now address the entire range in between. For this, we prove the following generalization of Theorem 4.9.

Theorem 4.11.

Let an arbitrary integer k>1𝑘1k>1italic_k > 1 be given. No algorithm for PropRemKnap reading at most logk𝑘\log kroman_log italic_k advice bits can achieve a better competitive ratio than 4/(32k+4k(k+1)7)432𝑘4𝑘𝑘174/(3-2k+\sqrt{4k(k+1)-7})4 / ( 3 - 2 italic_k + square-root start_ARG 4 italic_k ( italic_k + 1 ) - 7 end_ARG ).

Proof 4.12.

We generalize the hard instance family from the proof of Theorem 4.9. Let an arbitrary integer k>1𝑘1k>1italic_k > 1 be given and define ζ𝜁\zetaitalic_ζ as the positive root of 2ζ2+(2k3)ζ2(k+1)2superscript𝜁22𝑘3𝜁2𝑘12\zeta^{2}+(2k-3)\zeta-2(k+1)2 italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + ( 2 italic_k - 3 ) italic_ζ - 2 ( italic_k + 1 ), namely ζ=(32k+4k(k+1)7)/4𝜁32𝑘4𝑘𝑘174\zeta=(3-2k+\sqrt{4k(k+1)-7})/4italic_ζ = ( 3 - 2 italic_k + square-root start_ARG 4 italic_k ( italic_k + 1 ) - 7 end_ARG ) / 4. Consider k+1𝑘1k+1italic_k + 1 instances that all start with the same k+1𝑘1k+1italic_k + 1 items of the following, decreasing sizes: first x1=ζsubscript𝑥1𝜁x_{1}=\zetaitalic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_ζ, then xi=ζ2(i2)(1ζ)subscript𝑥𝑖superscript𝜁2𝑖21𝜁x_{i}=\zeta^{2}-(i-2)(1-\zeta)italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - ( italic_i - 2 ) ( 1 - italic_ζ ) for every i{2,,k}𝑖2normal-…𝑘i\in\{2,\dots,k\}italic_i ∈ { 2 , … , italic_k }, and then xk+1=ζ2+(k1)(1ζ)+εsubscript𝑥𝑘1superscript𝜁2𝑘11𝜁𝜀x_{k+1}=\zeta^{2}+(k-1)(1-\zeta)+\varepsilonitalic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + ( italic_k - 1 ) ( 1 - italic_ζ ) + italic_ε for an arbitrary ε𝜀\varepsilonitalic_ε satisfying 0<ε<1ζ0𝜀1𝜁0<\varepsilon<1-\zeta0 < italic_ε < 1 - italic_ζ. The instance I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ends immediately after these common items, whereas the instances Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, for i{2,,k+1}𝑖2normal-…𝑘1i\in\{2,\dots,k+1\}italic_i ∈ { 2 , … , italic_k + 1 }, presents one additional item of size yi=1xisubscript𝑦𝑖1subscript𝑥𝑖y_{i}=1-x_{i}italic_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = 1 - italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT as the final one. There is a unique optimal solution for each instance: For I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, it is to pack the first item of size x1=ζsubscript𝑥1𝜁x_{1}=\zetaitalic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_ζ. For Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT with i>1𝑖1i>1italic_i > 1, it is to pack the item of size xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and the last one of size yi=1xisubscript𝑦𝑖1subscript𝑥𝑖y_{i}=1-x_{i}italic_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = 1 - italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, which sum up to the optimal solution value 1111. Since there are only logk𝑘\log kroman_log italic_k advice bits available to handle the k+1𝑘1k+1italic_k + 1 instances, at least two instances Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and Ijsubscript𝐼𝑗I_{j}italic_I start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT with i<j𝑖𝑗i<jitalic_i < italic_j are processed with the same advice string and thus the same deterministic algorithm. Consider this algorithm and the moment after seeing and taking decisions on the first k+1𝑘1k+1italic_k + 1 items. It is impossible for the algorithm to have more than one of these common items packed since the two smallest of them already have a combined size of xk+xk+1=2ζ2+(2k3)ζ2k+3+ε=1+εsubscript𝑥𝑘subscript𝑥𝑘12superscript𝜁22𝑘3𝜁2𝑘3𝜀1𝜀x_{k}+x_{k+1}=2\zeta^{2}+(2k-3)\zeta-2k+3+\varepsilon=1+\varepsilonitalic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = 2 italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + ( 2 italic_k - 3 ) italic_ζ - 2 italic_k + 3 + italic_ε = 1 + italic_ε. Now, if item i𝑖iitalic_i is packed at the considered moment, the algorithm will perform suboptimally on instance Ijsubscript𝐼𝑗I_{j}italic_I start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. Analogously, if item j𝑗jitalic_j is packed, the performance on instance Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is suboptimal.

Now if suffices to check that the best suboptimal solution has a filling of at most ζ2superscript𝜁2\zeta^{2}italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT for I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, at most ζ𝜁\zetaitalic_ζ for I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, …, Iksubscript𝐼𝑘I_{k}italic_I start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, and at most ζ+ε𝜁𝜀\zeta+\varepsilonitalic_ζ + italic_ε for Ik+1subscript𝐼𝑘1I_{k+1}italic_I start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT. This leads to a performance ratio that is ζ/ζ2=1/ζ𝜁superscript𝜁21𝜁\zeta/\zeta^{2}=1/\zetaitalic_ζ / italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT = 1 / italic_ζ or 1/(ζ+1)1𝜁11/(\zeta+1)1 / ( italic_ζ + 1 ) at best, depending on the concrete algorithm, thus proving the theorem. See Table 3 for an overview of the hard instance family. The best and second best solutions to all instances and their associated performances are listed in Table 4.

Table 3: Hard instance family for PropRemKnap reading at most logk𝑘\log kroman_log italic_k advice bits, where ζ=(32k+4k(k+1)7)/4𝜁32𝑘4𝑘𝑘174\zeta=(3-2k+\sqrt{4k(k+1)-7})/4italic_ζ = ( 3 - 2 italic_k + square-root start_ARG 4 italic_k ( italic_k + 1 ) - 7 end_ARG ) / 4; see the proof of Theorem 4.11.
x1subscript𝑥1x_{1}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT x2subscript𝑥2x_{2}italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT \cdots xksubscript𝑥𝑘x_{k}italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT xk+1subscript𝑥𝑘1x_{k+1}italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT xk+2=yjsubscript𝑥𝑘2subscript𝑦𝑗x_{k+2}=y_{j}italic_x start_POSTSUBSCRIPT italic_k + 2 end_POSTSUBSCRIPT = italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT
I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT: ζ𝜁\zetaitalic_ζ ζ2superscript𝜁2\zeta^{2}italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT \cdots ζ2(k2)(1ζ)superscript𝜁2𝑘21𝜁\zeta^{2}-(k-2)(1-\zeta)italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - ( italic_k - 2 ) ( 1 - italic_ζ ) ζ2(k1)(1ζ)+εsuperscript𝜁2𝑘11𝜁𝜀\zeta^{2}-(k-1)(1-\zeta)+\varepsilonitalic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - ( italic_k - 1 ) ( 1 - italic_ζ ) + italic_ε None
I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT: ζ𝜁\zetaitalic_ζ ζ2superscript𝜁2\zeta^{2}italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT \cdots ζ2(k2)(1ζ)superscript𝜁2𝑘21𝜁\zeta^{2}-(k-2)(1-\zeta)italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - ( italic_k - 2 ) ( 1 - italic_ζ ) ζ2(k1)(1ζ)+εsuperscript𝜁2𝑘11𝜁𝜀\zeta^{2}-(k-1)(1-\zeta)+\varepsilonitalic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - ( italic_k - 1 ) ( 1 - italic_ζ ) + italic_ε 1x21subscript𝑥21-x_{2}1 - italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT
\,\vdots \vdots \vdots \vdots \vdots \vdots \hphantom{1\leavevmode\nobreak\ }\vdots
Ik+1subscript𝐼𝑘1I_{k+1}italic_I start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT: ζ𝜁\zetaitalic_ζ ζ2superscript𝜁2\zeta^{2}italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT \cdots ζ2(k2)(1ζ)superscript𝜁2𝑘21𝜁\zeta^{2}-(k-2)(1-\zeta)italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - ( italic_k - 2 ) ( 1 - italic_ζ ) ζ2(k1)(1ζ)+εsuperscript𝜁2𝑘11𝜁𝜀\zeta^{2}-(k-1)(1-\zeta)+\varepsilonitalic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT - ( italic_k - 1 ) ( 1 - italic_ζ ) + italic_ε 1xk+11subscript𝑥𝑘11-x_{k+1}1 - italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT
Table 4: The values of the optimal and best suboptimal solutions for each instance in the family given in Table 3 and the resulting competitive performance; see the proof of Theorem 4.11.
Optimal value Best suboptimal value Best suboptimal performance
I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT: x1=ζsubscript𝑥1𝜁x_{1}=\zetaitalic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_ζ x2=ζ2subscript𝑥2superscript𝜁2x_{2}=\zeta^{2}italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ζ/ζ2𝜁superscript𝜁2\zeta/\zeta^{2}italic_ζ / italic_ζ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT
I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT: x2+y2=1subscript𝑥2subscript𝑦21x_{2}+y_{2}=1italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + italic_y start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = 1 x1=ζsubscript𝑥1𝜁x_{1}=\zeta\phantom{{}^{2}}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_ζ 1/ζ1𝜁1/\zeta\phantom{{}^{2}}1 / italic_ζ
I3subscript𝐼3I_{3}italic_I start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT: x3+y3=1subscript𝑥3subscript𝑦31x_{3}+y_{3}=1italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT + italic_y start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT = 1 x2+y3=ζsubscript𝑥2subscript𝑦3𝜁x_{2}+y_{3}=\zeta\phantom{{}^{2}}italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + italic_y start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT = italic_ζ 1/ζ1𝜁1/\zeta\phantom{{}^{2}}1 / italic_ζ
\,\vdots \vdots\hphantom{\,\leavevmode\nobreak\ \zeta} \vdots\hphantom{\,\leavevmode\nobreak\ \zeta^{2}} \hphantom{1\,}\vdots\hphantom{\,\zeta^{2}}
Iksubscript𝐼𝑘I_{k}italic_I start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT: xk+yk=1subscript𝑥𝑘subscript𝑦𝑘1x_{k}+y_{k}=1italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_y start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = 1 xk1+yk=ζsubscript𝑥𝑘1subscript𝑦𝑘𝜁x_{k-1}+y_{k}=\zeta\phantom{{}^{2}}italic_x start_POSTSUBSCRIPT italic_k - 1 end_POSTSUBSCRIPT + italic_y start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = italic_ζ 1/ζ1𝜁1/\zeta\phantom{{}^{2}}1 / italic_ζ
Ik+1subscript𝐼𝑘1I_{k+1}italic_I start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT: xk+1+yk+1=1subscript𝑥𝑘1subscript𝑦𝑘11x_{k+1}+y_{k+1}=1italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT + italic_y start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = 1 xk+yk+1=ζεsubscript𝑥𝑘subscript𝑦𝑘1𝜁𝜀x_{k}+y_{k+1}=\zeta-\varepsilonitalic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_y start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = italic_ζ - italic_ε 1/(ζε)1𝜁𝜀1/(\zeta-\varepsilon)1 / ( italic_ζ - italic_ε )

We remark that Theorem 4.11 and its analogue for RemKnap instead of PropRemKnap, Theorem 5.7, improve upon the best known lower bounds implied by Han et al.’s results on the resource buffer model [13, Thms. 17 and 6]. In this model, the online algorithm may use a knapsack of some increased capacity R>1𝑅1R>1italic_R > 1, but only until the instance ends, at which point it has to choose from the reserved items a selection that fits a knapsack of capacity one. A resource buffer of some natural size R𝑅Ritalic_R allows us to simulate any algorithm using up to logR𝑅\log Rroman_log italic_R advice bits: We think of the resource buffer as split into R𝑅Ritalic_R knapsacks of capacity 1111, allowing us to accommodate the items stored by the advice algorithm for every possible advice string simultaneously.

Instantiating Theorem 4.11 with k=21𝑘superscript21k=2^{1}italic_k = 2 start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT, k=22𝑘superscript22k=2^{2}italic_k = 2 start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT, and k=23𝑘superscript23k=2^{3}italic_k = 2 start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT, for example, we obtain the lower bounds

4/(171)4171absent\displaystyle 4/(\sqrt{17}-1)\approx{}4 / ( square-root start_ARG 17 end_ARG - 1 ) ≈ 1.2808,1.2808\displaystyle 1.2808,\ 1.2808 , 4/(1137)41137absent\displaystyle 4/(\sqrt{113}-7)\approx{}4 / ( square-root start_ARG 113 end_ARG - 7 ) ≈ 1.1287,1.1287\displaystyle 1.1287,\ 1.1287 , and 4/(35315)435315absent\displaystyle 4/(\sqrt{353}-15)\approx{}4 / ( square-root start_ARG 353 end_ARG - 15 ) ≈ 1.0630.1.0630\displaystyle 1.0630.1.0630 .
for one, two, and three advice bits, respectively, while the lower bounds provided by Han et al. [13, Thm. 6] for a resource buffer of size R=2k𝑅superscript2𝑘R=2^{k}italic_R = 2 start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT are
6/5=65absent\displaystyle 6/5={}6 / 5 = 1.2,1.2\displaystyle 1.2,1.2 , 10/9109absent\displaystyle 10/9\approx{}10 / 9 ≈ 1.1111,1.1111\displaystyle 1.1111,1.1111 , and 18/171817absent\displaystyle 18/17\approx{}18 / 17 ≈ 1.0588.1.0588\displaystyle 1.0588.1.0588 .

Clearly, the lower bound of Theorem 4.11 tends to 1111 for increasingly large but still constant advice.

With our most surprising result for the proportional knapsack problem, Theorem 4.15, we will prove that the true competitive ratio displays the same general behavior as the lower bound of Theorem 4.11: For any given ε>0𝜀0\varepsilon>0italic_ε > 0, we can guarantee a competitive ratio of 1+ε1𝜀1+\varepsilon1 + italic_ε with a constant number of advice bits. It is of course also possible to derive more specific upper bounds for very few advice bits such as the following one.

Theorem 4.13.

There is a 4/3434/34 / 3-competitive algorithm for PropRemKnap reading two advice bits.

Proof 4.14.

The algorithm operates in one of four modes, depending on the given advice.

We make the following case distinction that primarily depends on how many items falling into the size interval [1/4,3/4]1434[1/4,3/4][ 1 / 4 , 3 / 4 ]—we call them medium items—appear in the optimal solutions.

Strategy One.

This strategy is chosen if there is any item larger than 3/4343/43 / 4 or if there is an optimal solution containing either no or only one medium item. The algorithm maintains one maximal medium item while packing the smaller items greedily. As an exception, when an item larger than 3/4343/43 / 4 appears, it is packed and kept to the end, discarding everything else.

This procedure obviously produces (3/4)34(3/4)( 3 / 4 )-competitive solution if there is an item larger than 3/4343/43 / 4. Otherwise, the knapsack will be filled optimally if all items fit into the knapsack together. In the remaining case, the greedy packing will leave a gap of at most 1/4141/41 / 4 because the algorithm will never displace a medium item in favor of a smaller one, thus removing only items smaller than 1/4141/41 / 4.

Strategy Two.

This strategy can be chosen if there is an optimal solution containing at least three medium items or if the two minimal medium items in the instance have a combined size of 3/4343/43 / 4 or more. The algorithm maintains as long as possible the minimal three medium items from the interval among everything seen so far. If a third medium item does not fit at some point, the algorithm switches to maintaining only the two minimal medium items. This clearly yields a filling of at least 3/4343/43 / 4.

Strategy Three.

This strategy works if there is an optimal solution containing two items from the size interval [1/4,1/2]1412[1/4,1/2][ 1 / 4 , 1 / 2 ]. It maintains two maximal such items, which is always possible, and packs the smaller items greedily. This either yields an optimal solution or one with a gap of at most 3/4343/43 / 4.

Strategy Four.

This strategy is chosen in the remaining case. Specifically, we may now assume that every optimal solution to the given instance contains exactly two medium items, one of which has a size greater than 1/2121/21 / 2.

In this case, the algorithm maintains on the one hand a minimal item and on the other hand a minimal item larger than 1/2121/21 / 2. Clearly, this fills the knapsack to a total size of more than 1/4+1/2=3/41412341/4+1/2=3/41 / 4 + 1 / 2 = 3 / 4.

We now turn to our main result for the proportional knapsack problem, which complements Theorem 4.11 with an upper bound. Theorem 5.9 will generalize this result to the general version where an item’s size may differ from its value, albeit with a far more complicated proof. To make it as easily understandable as possible, we first present here the proof for the simple variant, which introduces the idea of slots that are reserved for items with certain properties. This will serve as a useful foundation for the proof of the general variant, which is also making use of such a slot system, although as merely one besides many more components.

Theorem 4.15.

For any ε>0𝜀0\varepsilon>0italic_ε > 0, there is a strictly (1+ε)1𝜀(1+\varepsilon)( 1 + italic_ε )-competitive algorithm for PropRemKnap reading a constant number of advice bits.

Proof 4.16.

We describe such an algorithm called PropPack; see Algorithm 1 for a pseudo-code implementation. We begin by describing the advice communicated to PropPack with a constant number of bits, then explain how the algorithm operates on this advice, prove that it is correct and terminates, and finally analyze its competitive ratio.

Notions and Notation.

Without loss of generality, we assume that all items have size at most 1 and that ε1/2𝜀12\varepsilon\leq 1/2italic_ε ≤ 1 / 2. We define the constant K=log1ε/2ε/2𝐾subscript1𝜀2𝜀2K=\lceil\log_{1-\varepsilon/2}\varepsilon/2\rceilitalic_K = ⌈ roman_log start_POSTSUBSCRIPT 1 - italic_ε / 2 end_POSTSUBSCRIPT italic_ε / 2 ⌉.

Let an instance with n𝑛nitalic_n items be given. Denote the items in the order of their appearance in the instance by 1,2,,n12𝑛1,2,\dots,n1 , 2 , … , italic_n and denote the size of item i𝑖iitalic_i by s(i)𝑠𝑖s(i)italic_s ( italic_i ). We divide the n𝑛nitalic_n items into small and big ones, with δ=(1ε/2)K𝛿superscript1𝜀2𝐾\delta=(1-\varepsilon/2)^{K}italic_δ = ( 1 - italic_ε / 2 ) start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT serving as the dividing line: Csmall={is(i)δ}subscript𝐶smallconditional-set𝑖𝑠𝑖𝛿C_{\textnormal{small}}=\{\,i\mid s(i)\leq\delta\,\}italic_C start_POSTSUBSCRIPT small end_POSTSUBSCRIPT = { italic_i ∣ italic_s ( italic_i ) ≤ italic_δ } and Cbig={iδ<s(i)}subscript𝐶bigconditional-set𝑖𝛿𝑠𝑖C_{\textnormal{big}}=\{\,i\mid\delta<s(i)\,\}italic_C start_POSTSUBSCRIPT big end_POSTSUBSCRIPT = { italic_i ∣ italic_δ < italic_s ( italic_i ) }. We further partition the big items into the subclasses Ck={i(1ε/2)k<s(i)(1ε/2)k1} for k{1,,K}subscript𝐶𝑘conditional-set𝑖superscript1𝜀2𝑘𝑠𝑖superscript1𝜀2𝑘1 for 𝑘1𝐾C_{k}=\{\,i\mid(1-\varepsilon/2)^{k}<s(i)\leq(1-\varepsilon/2)^{k-1}\,\}\text{ for }k\in\{1,\dots,K\}italic_C start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = { italic_i ∣ ( 1 - italic_ε / 2 ) start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT < italic_s ( italic_i ) ≤ ( 1 - italic_ε / 2 ) start_POSTSUPERSCRIPT italic_k - 1 end_POSTSUPERSCRIPT } for italic_k ∈ { 1 , … , italic_K } . To alleviate the notation, we will often refer to Cksubscript𝐶𝑘C_{k}italic_C start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT as class k𝑘kitalic_k and to Csmallsubscript𝐶smallC_{\textnormal{small}}italic_C start_POSTSUBSCRIPT small end_POSTSUBSCRIPT as class 00. We also use this convention when writing C(i)𝐶𝑖C(i)italic_C ( italic_i ) to indicate the class to which item i𝑖iitalic_i belongs: We have C(i){0,,K}𝐶𝑖0𝐾C(i)\in\{0,\dots,K\}italic_C ( italic_i ) ∈ { 0 , … , italic_K }, with C(i)=0𝐶𝑖0C(i)=0italic_C ( italic_i ) = 0 meaning that iCsmall𝑖subscript𝐶smalli\in C_{\textnormal{small}}italic_i ∈ italic_C start_POSTSUBSCRIPT small end_POSTSUBSCRIPT and C(i)=k0𝐶𝑖𝑘0C(i)=k\neq 0italic_C ( italic_i ) = italic_k ≠ 0 meaning that iCk𝑖subscript𝐶𝑘i\in C_{k}italic_i ∈ italic_C start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT.

The oracle chooses an arbitrary but fixed optimal solution S{1,,n}𝑆1𝑛S\subseteq\{1,\dots,n\}italic_S ⊆ { 1 , … , italic_n }. We denote the partition classes that are naturally induced by this solution by Ssmall=SCsmallsubscript𝑆small𝑆subscript𝐶smallS_{\textnormal{small}}=S\cap C_{\textnormal{small}}italic_S start_POSTSUBSCRIPT small end_POSTSUBSCRIPT = italic_S ∩ italic_C start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, Sbig=SCbigsubscript𝑆big𝑆subscript𝐶bigS_{\textnormal{big}}=S\cap C_{\textnormal{big}}italic_S start_POSTSUBSCRIPT big end_POSTSUBSCRIPT = italic_S ∩ italic_C start_POSTSUBSCRIPT big end_POSTSUBSCRIPT, and Sk=SCksubscript𝑆𝑘𝑆subscript𝐶𝑘S_{k}=S\cap C_{k}italic_S start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = italic_S ∩ italic_C start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT for k{1,,K}𝑘1𝐾k\in\{1,\dots,K\}italic_k ∈ { 1 , … , italic_K }. Let m=|Sbig|𝑚subscript𝑆bigm=|S_{\textnormal{big}}|italic_m = | italic_S start_POSTSUBSCRIPT big end_POSTSUBSCRIPT | be the number of big items in the optimal solution and denote them by i1<<imsubscript𝑖1subscript𝑖𝑚i_{1}<\ldots<i_{m}italic_i start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT < … < italic_i start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT in order of appearance.

Constant Advice.

The oracle communicates to the algorithm a tuple (b1,,bm)subscript𝑏1subscript𝑏𝑚(b_{1},\dots,b_{m})( italic_b start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_b start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ) with the classes of the big items in the chosen optimal solution in order of appearance; that is, we have bj=C(ij)subscript𝑏𝑗𝐶subscript𝑖𝑗b_{j}=C(i_{j})italic_b start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT = italic_C ( italic_i start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) for each j{1,,m}𝑗1𝑚j\in\{1,\dots,m\}italic_j ∈ { 1 , … , italic_m }. We remark that this tuple needs to be encoded in a self-delimiting way. A constant number of bits suffices for this because bjsubscript𝑏𝑗b_{j}italic_b start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is bounded by the constant K𝐾Kitalic_K for every j{1,,m}𝑗1𝑚j\in\{1,\dots,m\}italic_j ∈ { 1 , … , italic_m } and m𝑚mitalic_m is bounded by the constant 1/δ1𝛿1/\delta1 / italic_δ. The latter bound is an immediate consequence of the fact that s(Sbig)1𝑠subscript𝑆big1s(S_{\textnormal{big}})\leq 1italic_s ( italic_S start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ) ≤ 1 and that any big item has a size larger than δ𝛿\deltaitalic_δ.

Algorithm Description.

The algorithm PropPack proceeds in m𝑚mitalic_m phases as follows. In every phase, the algorithm opens a new virtual slot within the knapsack that can store exactly one item at a time; multiple items in succession are allowed, however. The slot opened in phase i𝑖iitalic_i will accommodate items belonging to class bisubscript𝑏𝑖b_{i}italic_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT exclusively; we say that items from this class match slot i𝑖iitalic_i. Slots are never closed, thus there are exactly m𝑚mitalic_m of them in the end. Small items are generally packed in a greedy manner and discarded one by one whenever necessary to pack a big item.

In the first phase, the algorithm rejects all big items until one of class b1subscript𝑏1b_{1}italic_b start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT appears. As soon as this is the case, said item is packed into the first slot, ending the first phase.

In the second phase, the algorithm opens the second slot to pack a matching item, that is, one of class b2subscript𝑏2b_{2}italic_b start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT. It waits for the first item from this class that fits into the knapsack alongside the item in the first slot. As soon as such an item appears, it is packed and the phase ends. In the meantime, whenever an item of class b1subscript𝑏1b_{1}italic_b start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT appears during the second round, the algorithm substitutes it for the one stored in the first slot if and only if this reduces the size of the stored item.

In general, phase i𝑖iitalic_i begins with the opening of slot i𝑖iitalic_i, which is reserved for items of class bisubscript𝑏𝑖b_{i}italic_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. The phase continues until an item appears that both matches the newly opened slot and fits in beside the items currently stored in the previously opened and filled slots without exceeding the capacity. Then this item is packed into the new slot, which ends the phase. During the entire phase, the algorithm maintains in all filled slots the smallest matching items seen so far: Whenever the algorithm is presented with a big item that either it belongs to a class other than bisubscript𝑏𝑖b_{i}italic_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT or does not fit in alongside the items in the previously opened slots, then the new item replaces a largest item in the matching open slots, unless the new item itself is even larger.

The entire time, even after the last phase has terminated, small items are packed greedily and discarded one by one whenever this is necessary to make room for a big item according to the description above. Moreover, we may assume that, whenever a new item has been packed into the knapsack, the algorithm sorts the items in the matching open slots in increasing order. This sorting is not necessary for the algorithm to fulfill its duty, but it facilitates the proof by induction below.

Termination of All Phases.

We need to show that PropPack does in fact finish all m𝑚mitalic_m phases; that is, all m𝑚mitalic_m slots will be filled with a matching item without ever exceeding the knapsack capacity. Consider the big items of the optimal solution, which we denote by u1<<umsubscript𝑢1subscript𝑢𝑚u_{1}<\dots<u_{m}italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT < ⋯ < italic_u start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT in their order of appearance. To ensure the termination of all phases, we prove by induction over im𝑖𝑚i\leq mitalic_i ≤ italic_m that, after processing item uisubscript𝑢𝑖u_{i}italic_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, the first i𝑖iitalic_i slots store items with a total size of s(u1)++s(ui)𝑠subscript𝑢1𝑠subscript𝑢𝑖s(u_{1})+\dots+s(u_{i})italic_s ( italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) + ⋯ + italic_s ( italic_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) or less.

We may start from i=0𝑖0i=0italic_i = 0 as the trivial, if degenerate, base case. For the induction step, assume the hypothesis for i<m𝑖𝑚i<mitalic_i < italic_m and observe that no item in a slot is ever replaced by a larger one. Therefore, the items in the first i𝑖iitalic_i slots still have a total size of at most s(u1)++s(ui)𝑠subscript𝑢1𝑠subscript𝑢𝑖s(u_{1})+\dots+s(u_{i})italic_s ( italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) + ⋯ + italic_s ( italic_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) when ui+1subscript𝑢𝑖1u_{i+1}italic_u start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT is presented.

There are now three possibilities. If slot i+1𝑖1i+1italic_i + 1 has remained closed up to this point, it is now opened and filled with ui+1subscript𝑢𝑖1u_{i+1}italic_u start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT, which fits in because s(u1)++s(ui+1)s(Sbig)1𝑠subscript𝑢1𝑠subscript𝑢𝑖1𝑠subscript𝑆big1s(u_{1})+\dots+s(u_{i+1})\leq s(S_{\textnormal{big}})\leq 1italic_s ( italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) + ⋯ + italic_s ( italic_u start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ) ≤ italic_s ( italic_S start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ) ≤ 1. Otherwise, slot i+1𝑖1i+1italic_i + 1 is already storing an item: If said item is larger than s(ui+1)𝑠subscript𝑢𝑖1s(u_{i+1})italic_s ( italic_u start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ), then ui+1subscript𝑢𝑖1u_{i+1}italic_u start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT replaces either this item or one that is at least as large. During the subsequent sorting, ui+1subscript𝑢𝑖1u_{i+1}italic_u start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT is then moved to slot i+1𝑖1i+1italic_i + 1 or one of the slots from 1111 to i𝑖iitalic_i, which may force some items from slots 1111 through i𝑖iitalic_i into higher slots but never beyond slot i+1𝑖1i+1italic_i + 1. The third possibility is that slot i+1𝑖1i+1italic_i + 1 contains an item of size at most s(ui+1)𝑠subscript𝑢𝑖1s(u_{i+1})italic_s ( italic_u start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ) already. We immediately obtain the induction claim for i+1𝑖1i+1italic_i + 1 in all three cases.

Competitive Analysis.

We still denote by S𝑆Sitalic_S the optimal solution that served as the basis for the given advice, by T𝑇Titalic_T the final output of the online algorithm PropPack (Algorithm 1), and the respective partition classes by Ssmallsubscript𝑆smallS_{\textnormal{small}}italic_S start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, Sbigsubscript𝑆bigS_{\textnormal{big}}italic_S start_POSTSUBSCRIPT big end_POSTSUBSCRIPT, Sksubscript𝑆𝑘S_{k}italic_S start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT and Tsmallsubscript𝑇smallT_{\textnormal{small}}italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, Tbigsubscript𝑇bigT_{\textnormal{big}}italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT, and Tksubscript𝑇𝑘T_{k}italic_T start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT.

Since PropPack opens one slot for each big item in the optimal solution T𝑇Titalic_T and fills it with an item from the same subclass, as proved above, we have |Sk|=|Tk|subscript𝑆𝑘subscript𝑇𝑘|S_{k}|=|T_{k}|| italic_S start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT | = | italic_T start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT | for every k{1,,K}𝑘1𝐾k\in\{1,\dots,K\}italic_k ∈ { 1 , … , italic_K }. Moreover, the sizes within a subclass Cksubscript𝐶𝑘C_{k}italic_C start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT vary by a factor of at most 1ε/21𝜀21-\varepsilon/21 - italic_ε / 2; this means that we can bound both s(Sbig)𝑠subscript𝑆bigs(S_{\textnormal{big}})italic_s ( italic_S start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ) and s(Tbig)𝑠subscript𝑇bigs(T_{\textnormal{big}})italic_s ( italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ) from below by L=k=1K|Sk|(1ε/2)k𝐿superscriptsubscript𝑘1𝐾subscript𝑆𝑘superscript1𝜀2𝑘L=\sum_{k=1}^{K}|S_{k}|(1-\varepsilon/2)^{k}italic_L = ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT | italic_S start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT | ( 1 - italic_ε / 2 ) start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT and from above by L/(1ε/2)𝐿1𝜀2L/(1-\varepsilon/2)italic_L / ( 1 - italic_ε / 2 ). We conclude s(Tbig)s(Sbig)(1ε/2)𝑠subscript𝑇big𝑠subscript𝑆big1𝜀2s(T_{\textnormal{big}})\geq s(S_{\textnormal{big}})\cdot(1-\varepsilon/2)italic_s ( italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ) ≥ italic_s ( italic_S start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ) ⋅ ( 1 - italic_ε / 2 ).

Furthermore, since small items are packed greedily and only discarded one by one whenever necessary to make room for the big items, we will not lose much from their side either. If the presented small items have a total size of at most 1L/(1ε/2)1𝐿1𝜀21-L/(1-\varepsilon/2)1 - italic_L / ( 1 - italic_ε / 2 ), none is ever discarded. In this case, we have s(Tsmall)s(Ssmall)𝑠subscript𝑇small𝑠subscript𝑆smalls(T_{\textnormal{small}})\geq s(S_{\textnormal{small}})italic_s ( italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) ≥ italic_s ( italic_S start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) and thus immediately s(T)s(S)(1ε/2)𝑠𝑇𝑠𝑆1𝜀2s(T)\geq s(S)\cdot(1-\varepsilon/2)italic_s ( italic_T ) ≥ italic_s ( italic_S ) ⋅ ( 1 - italic_ε / 2 ). If small items are discarded, however, the worst case is the following type of instance: It starts with only small items of the largest possible size δ𝛿\deltaitalic_δ, some of which are then discarded to accommodate big items with sizes right at the upper limit for the classes indicated by the advice, leaving a gap of almost δ𝛿\deltaitalic_δ, follows up with slightly smaller big items that are in the optimal solution and would not have lead to any discarded small items, and finally presents big items at the lower end of the size span, replacing all previously packed big items.

Even in this worst case, the algorithm remains (1ε/2)1𝜀2(1-\varepsilon/2)( 1 - italic_ε / 2 )-competitive on the big items and detracting the largest possible loss of δ𝛿\deltaitalic_δ on the small items yields s(T)s(S)(1ε/2)δ𝑠𝑇𝑠𝑆1𝜀2𝛿s(T)\geq s(S)\cdot(1-\varepsilon/2)-\deltaitalic_s ( italic_T ) ≥ italic_s ( italic_S ) ⋅ ( 1 - italic_ε / 2 ) - italic_δ. By the definition of δ𝛿\deltaitalic_δ and K𝐾Kitalic_K and due to the simple fact that s(S)𝑠𝑆s(S)italic_s ( italic_S ) is at most 1111, we have δ=(1ε/2)Kε/2s(S)ε/2𝛿superscript1𝜀2𝐾𝜀2𝑠𝑆𝜀2\delta=(1-\varepsilon/2)^{K}\leq\varepsilon/2\leq s(S)\cdot\varepsilon/2italic_δ = ( 1 - italic_ε / 2 ) start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT ≤ italic_ε / 2 ≤ italic_s ( italic_S ) ⋅ italic_ε / 2. This implies s(T)/s(S)1ε𝑠𝑇𝑠𝑆1𝜀s(T)/s(S)\geq 1-\varepsilonitalic_s ( italic_T ) / italic_s ( italic_S ) ≥ 1 - italic_ε, as desired.

Algorithm 1 000superscript0superscript000^{0^{0}}0 start_POSTSUPERSCRIPT 0 start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT end_POSTSUPERSCRIPTPropPack

Parameter: Any ε(0,1/2]𝜀012\varepsilon\in(0,1/2]italic_ε ∈ ( 0 , 1 / 2 ].

Online Input: A sequence I=(1,,n)𝐼1𝑛I=(1,\dots,n)italic_I = ( 1 , … , italic_n ) of n𝑛nitalic_n items with sizes (s1,,sn)subscript𝑠1subscript𝑠𝑛(s_{1},\dots,s_{n})( italic_s start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_s start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT ).

Online Output: A (1+ε)1𝜀(1+\varepsilon)( 1 + italic_ε )-competitive packing T=TsmallTbig𝑇subscript𝑇smallsubscript𝑇bigT=T_{\textnormal{small}}\cup T_{\textnormal{big}}italic_T = italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ∪ italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT.

Advice: The sequence B=(b1,,bm)𝐵subscript𝑏1subscript𝑏𝑚B=(b_{1},\dots,b_{m})italic_B = ( italic_b start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_b start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ), where m𝑚mitalic_m is the number of big items in a fixed optimal solution and bjsubscript𝑏𝑗b_{j}italic_b start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is the class of the j𝑗jitalic_jth big item appearing in it.

Algorithm:

1:k𝒏𝒆𝒙𝒕(B)𝑘𝒏𝒆𝒙𝒕𝐵k\leftarrow\textbf{next}(B)italic_k ← next ( italic_B ) normal-▷\triangleright Initialize k𝑘kitalic_k to class of first big item to be packed.
2:Tsmallsubscript𝑇smallT_{\textnormal{small}}\leftarrow\emptysetitalic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ← ∅ normal-▷\triangleright Initialize Tsmallsubscript𝑇smallT_{\textnormal{small}}italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, set of packed small items, to the empty set.
3:Tbigsubscript𝑇bigT_{\textnormal{big}}\leftarrow\emptysetitalic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ← ∅ normal-▷\triangleright Initialize Tbigsubscript𝑇bigT_{\textnormal{big}}italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT, set of packed big items, to the empty set.
4:for i𝑖iitalic_i in I𝐼Iitalic_I  normal-▷\triangleright For each new item in order of appearance do the following:
5:     if C(i)=0𝐶𝑖0C(i)=0italic_C ( italic_i ) = 0  normal-▷\triangleright If the new item is small, then check if it …
6:          if s(TsmallTbig{i})1𝑠subscript𝑇smallsubscript𝑇big𝑖1s(T_{\textnormal{small}}\cup T_{\textnormal{big}}\cup\{i\})\leq 1italic_s ( italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ∪ italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ∪ { italic_i } ) ≤ 1 normal-▷\triangleright … fits in beside everything currently packed; …
7:               TsmallTsmall{i}subscript𝑇smallsubscript𝑇small𝑖T_{\textnormal{small}}\leftarrow T_{\textnormal{small}}\cup\{i\}italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ← italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ∪ { italic_i } normal-▷\triangleright … if it does, then pack it.           
8:     else if C(i)=k𝐶𝑖𝑘C(i)=kitalic_C ( italic_i ) = italic_k and s(Tbig{i})1𝑠subscript𝑇big𝑖1s(T_{\textnormal{big}}\cup\{i\})\leq 1italic_s ( italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ∪ { italic_i } ) ≤ 1  normal-▷\triangleright If big item of advised class can be fit in, …
9:          while s(TsmallTbig{i})>1𝑠subscript𝑇smallsubscript𝑇big𝑖1s(T_{\textnormal{small}}\cup T_{\textnormal{big}}\cup\{i\})>1italic_s ( italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ∪ italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ∪ { italic_i } ) > 1  normal-▷\triangleright … then, until it actually fits, …
10:               𝑝𝑜𝑝(Tsmall)𝑝𝑜𝑝subscript𝑇small\textrm{pop}(T_{\textnormal{small}})pop ( italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) normal-▷\triangleright … greedily discard small items one by one.           
11:          TbigTbig{i}subscript𝑇bigsubscript𝑇big𝑖T_{\textnormal{big}}\leftarrow T_{\textnormal{big}}\cup\{i\}italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ← italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ∪ { italic_i } normal-▷\triangleright Now that it actually fits, pack the new big item.
12:          k𝒏𝒆𝒙𝒕(B)𝑘𝒏𝒆𝒙𝒕𝐵k\leftarrow\textbf{next}(B)italic_k ← next ( italic_B ) normal-▷\triangleright Update k𝑘kitalic_k to class of the next item advised to be packed.
13:     elsenormal-▷\triangleright Among big new item and kept ones of same class, remove largest one and …
14:          Tbig(Tbig{i})argmax{s(j)j{i}(CC(i)Tbig)}subscript𝑇bigsubscript𝑇big𝑖conditional𝑠𝑗𝑗𝑖subscript𝐶𝐶𝑖subscript𝑇bigT_{\textnormal{big}}\leftarrow(T_{\textnormal{big}}\cup\{i\})\smallsetminus% \arg\max\{s(j)\mid j\in\{i\}\cup(C_{C(i)}\cap T_{\textnormal{big}})\}italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ← ( italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ∪ { italic_i } ) ∖ roman_arg roman_max { italic_s ( italic_j ) ∣ italic_j ∈ { italic_i } ∪ ( italic_C start_POSTSUBSCRIPT italic_C ( italic_i ) end_POSTSUBSCRIPT ∩ italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT ) } normal-▷\triangleright … pack the rest.      
15:return TsmallTbigsubscript𝑇smallsubscript𝑇bigT_{\textnormal{small}}\cup T_{\textnormal{big}}italic_T start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ∪ italic_T start_POSTSUBSCRIPT big end_POSTSUBSCRIPT normal-▷\triangleright Return the current solution after processing the entire input.

5 Results for General Removable Knapsack

First, we note that all lower bounds for the proportional removable knapsack problem carry over to the general removable knapsack problem, in particular Theorem 4.5.

Iwama and Zhang [18] have shown that the competitive ratio of RemKnap is unbounded without advice. This can be seen using an interactive instance that starts with an item (1,1)11(1,1)( 1 , 1 ) and then presents items (ε2,ε)superscript𝜀2𝜀(\varepsilon^{2},\varepsilon)( italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT , italic_ε ) repeatedly, up to 1/ε21superscript𝜀21/\varepsilon^{2}1 / italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT times, until one is packed, at which point the instance ends.

The following two theorems show RemKnap’s competitivity for one advice bit to be exactly 2222.

The existence of a 2222-competitive algorithm already follows from a result by Han et al. [11, Thm. 9], who proved the statement even for a single random bit instead of an advice bit. We prove Theorem 5.1 by describing a concrete advice algorithm.

Theorem 5.1.

There is a 2222-competitive algorithm for RemKnap reading only a single advice bit.

Proof 5.2.

The single advice bit indicates whether the instance contains an item worth at least half of the optimal solution value. If so, the algorithm greedily packs the most valuable item. Otherwise, it packs in a yield-greedy manner while ignoring any items larger than 1/2121/21 / 2. If some optimal solution contains some item larger than 1/2121/21 / 2, then the rest of this solution is smaller than 1/2121/21 / 2 and worth at least half of the optimal solution value. The yield-greedy algorithm achieves at least this value: Either it packs all items up to size 1/2121/21 / 2 or, when having to discard such an item, leaves a gap smaller than 1/2121/21 / 2 while the rest is filled with the best possible yield.

We now provide the matching lower bound for Theorem 5.1.

Theorem 5.3.

No algorithm for RemKnap reading only a single advice bit can have a competitive ratio better than 2222.

Proof 5.4.

Fix an arbitrary positive ε<1/2𝜀12\varepsilon<1/2italic_ε < 1 / 2 such that k=1/ε𝑘1𝜀k=1/\varepsilonitalic_k = 1 / italic_ε is an integer. We describe an adversarial instance family on which no algorithm with a single advice bit can achieve a competitive ratio better than 2(1ε)21𝜀2(1-\varepsilon)2 ( 1 - italic_ε ).

The instance will present some subset of the following items:

xi=subscript𝑥𝑖\displaystyle x_{i}\quad=italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = (1iε3,\displaystyle(1-i\varepsilon^{3},\ ( 1 - italic_i italic_ε start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT , 2iε)\displaystyle 2-i\varepsilon)2 - italic_i italic_ε ) for i{0,1,,k},for 𝑖01𝑘\displaystyle\text{ for }i\in\{0,1,\dots,k\},for italic_i ∈ { 0 , 1 , … , italic_k } ,
xi=superscriptsubscript𝑥𝑖\displaystyle x_{i}^{\prime}\quad=italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = (iε3,\displaystyle(i\varepsilon^{3},\ ( italic_i italic_ε start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT , 2iε+ε)\displaystyle 2-i\varepsilon+\varepsilon)2 - italic_i italic_ε + italic_ε ) for i{1,2,,k}, andfor 𝑖12𝑘 and\displaystyle\text{ for }i\in\{1,2,\dots,k\},\text{ and }for italic_i ∈ { 1 , 2 , … , italic_k } , and
yj=subscript𝑦𝑗\displaystyle y_{j}\quad=italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT = (ε,\displaystyle(\varepsilon,\ ( italic_ε , 4ε)\displaystyle 4\varepsilon)4 italic_ε ) for j{1,2,,k}.for 𝑗12𝑘\displaystyle\text{ for }j\in\{1,2,\dots,k\}.for italic_j ∈ { 1 , 2 , … , italic_k } .

The exact subset and order of presentation depends on the operating advice algorithm and will be explained below.

We begin by making some simple observations. The items x0,x1,,xksubscript𝑥0subscript𝑥1normal-…subscript𝑥𝑘x_{0},x_{1},\dots,x_{k}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT decrease in both size and value. The smallest of them has still size 1ε21superscript𝜀21-\varepsilon^{2}1 - italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT, thus it is impossible to fit two of them into the knapsack together. The same is true for combining any item xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT with any item yjsubscript𝑦𝑗y_{j}italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, together the exceed the knapsack capacity. Finally, an item xisuperscriptsubscript𝑥𝑖normal-′x_{i}^{\prime}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT fits together with xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT perfectly, but not with any of the items x0,x1,,xi1subscript𝑥0subscript𝑥1normal-…subscript𝑥𝑖1x_{0},x_{1},\dots,x_{i-1}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_x start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT.

We arrange the items along the axes of a (k+1)×k𝑘1𝑘(k+1)\times k( italic_k + 1 ) × italic_k grid as shown in Figure 3. Every instance in the hard instance family can be represented by a directed path in this grid that starts at the top left corner, only moves down or right from there, and stops at the latest when reaching either the bottom or right border of the grid. Figure 3 shows one possible path.

We can read a given path as follows. All instances start by presenting the two items x0subscript𝑥0x_{0}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and y1subscript𝑦1y_{1}italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT corresponding to the corner (x0,y1)subscript𝑥0subscript𝑦1(x_{0},y_{1})( italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ). When a new coordinate along the x𝑥xitalic_x-axis or y𝑦yitalic_y-axis is reached, the corresponding item is presented. Thus, the path moving down means presenting the next item in the sequence x0,x1,,xksubscript𝑥0subscript𝑥1normal-…subscript𝑥𝑘x_{0},x_{1},\dots,x_{k}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, and analogously for moving to the right and the sequence y1,y2,,yksubscript𝑦1subscript𝑦2normal-…subscript𝑦𝑘y_{1},y_{2},\dots,y_{k}italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_y start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT. If the path ends at (xi,yj)subscript𝑥𝑖subscript𝑦𝑗(x_{i},y_{j})( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) with i<k𝑖𝑘i<kitalic_i < italic_k and j<k𝑗𝑘j<kitalic_j < italic_k—that is, before reaching the grid’s bottom or right border—then the instance concludes with xksuperscriptsubscript𝑥𝑘normal-′x_{k}^{\prime}italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT as an additional final item. If the path reaches the bottom or right end, the instance ends without such an additional item.

y1subscript𝑦1y_{1}italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTy2subscript𝑦2y_{2}italic_y start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPTy3subscript𝑦3y_{3}italic_y start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPTyjsubscript𝑦𝑗y_{j}italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPTyk1subscript𝑦𝑘1y_{k-1}italic_y start_POSTSUBSCRIPT italic_k - 1 end_POSTSUBSCRIPTyksubscript𝑦𝑘y_{k}italic_y start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT======\cdots\cdots======(ε,4ε)𝜀4𝜀(\varepsilon,4\varepsilon)( italic_ε , 4 italic_ε )(1,2)=x012subscript𝑥0(1,2)=x_{0\hphantom{{}-1}}( 1 , 2 ) = italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT(1ε3,2ε)=x11superscript𝜀32𝜀subscript𝑥1(1-\varepsilon^{3},2-\varepsilon)=x_{1\hphantom{{}-1}}( 1 - italic_ε start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT , 2 - italic_ε ) = italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT(12ε3,22ε)=x212superscript𝜀322𝜀subscript𝑥2(1-2\varepsilon^{3},2-2\varepsilon)=x_{2\hphantom{{}-1}}( 1 - 2 italic_ε start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT , 2 - 2 italic_ε ) = italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT(1iε3,2iε)=xi1𝑖superscript𝜀32𝑖𝜀subscript𝑥𝑖(1-i\varepsilon^{3},2-i\varepsilon)=x_{i\hphantom{{}-1}}( 1 - italic_i italic_ε start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT , 2 - italic_i italic_ε ) = italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT(1ε2+ε3,1+ε)=xk11superscript𝜀2superscript𝜀31𝜀subscript𝑥𝑘1(1-\varepsilon^{2}+\varepsilon^{3},1+\varepsilon)=x_{k-1}( 1 - italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_ε start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT , 1 + italic_ε ) = italic_x start_POSTSUBSCRIPT italic_k - 1 end_POSTSUBSCRIPT(1ε2,1)=xk1superscript𝜀21subscript𝑥𝑘(1-\varepsilon^{2},1)=x_{k\hphantom{{}-1}}( 1 - italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT , 1 ) = italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT\vdots\vdots
Figure 3: The grid described in the proof of Theorem 5.3. The directed path represents the instance that presents the items x0,y1,y2,x1,x2,y3,y4,,yj,x3,x4,,xksubscript𝑥0subscript𝑦1subscript𝑦2subscript𝑥1subscript𝑥2subscript𝑦3subscript𝑦4normal-…subscript𝑦𝑗subscript𝑥3subscript𝑥4normal-…subscript𝑥𝑘x_{0},y_{1},y_{2},x_{1},x_{2},y_{3},y_{4},\dots,y_{j},x_{3},x_{4},\dots,x_{k}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT , … , italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT , … , italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT in this order.

We now describe how the path is determined by the actions of the advice algorithm. Note that an algorithm with a single advice bit can be interpreted as two deterministic algorithms with the advice bit determining which algorithm is executed on any given instance. From (xi,yj)subscript𝑥𝑖subscript𝑦𝑗(x_{i},y_{j})( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) with i<k𝑖𝑘i<kitalic_i < italic_k and j<k𝑗𝑘j<kitalic_j < italic_k, the path continues as follows.

Case 1.

If both algorithms have discarded yjsubscript𝑦𝑗y_{j}italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, then it goes to the right.

Case 2.

If one algorithm has yjsubscript𝑦𝑗y_{j}italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT in its reserve and the other xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, the path continues downward.

Case 3.

If one algorithm has yjsubscript𝑦𝑗y_{j}italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT in its reserve, but neither has kept xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, then the path stops.

We make two observations. First, at any point (xi,yj)subscript𝑥𝑖subscript𝑦𝑗(x_{i},y_{j})( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ), the two algorithms may have yjsubscript𝑦𝑗y_{j}italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT in their reserve, but no other item from y1,y2,,yksubscript𝑦1subscript𝑦2normal-…subscript𝑦𝑘y_{1},y_{2},\dots,y_{k}italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_y start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT. This is because the path is moving right—and thus the instance presenting an item in this sequence—only after its predecessor has been discarded by both algorithms.

Second, when arriving at (xi,yj)subscript𝑥𝑖subscript𝑦𝑗(x_{i},y_{j})( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ), one of the algorithms may still have xi1subscript𝑥𝑖1x_{i-1}italic_x start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT in its reserve, but neither algorithm will have kept any of the previous items x0,,xi2subscript𝑥0normal-…subscript𝑥𝑖2x_{0},\dots,x_{i-2}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , … , italic_x start_POSTSUBSCRIPT italic_i - 2 end_POSTSUBSCRIPT. This is because the path was able to move down to the current x𝑥xitalic_x-coordinate only if one algorithm has had xi1subscript𝑥𝑖1x_{i-1}italic_x start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT in its reserve and the other some item yjsubscript𝑦superscript𝑗normal-′y_{j^{\prime}}italic_y start_POSTSUBSCRIPT italic_j start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, which excludes any third item from x0,,xi2subscript𝑥0normal-…subscript𝑥𝑖2x_{0},\dots,x_{i-2}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , … , italic_x start_POSTSUBSCRIPT italic_i - 2 end_POSTSUBSCRIPT.

We consider the three ways that a path representing an instance can end: at the right border, at the bottom edge, or anywhere else.

Case 1.

If the path ends at the right border, the optimal solution consists of the entire sequence y1,y2,,yksubscript𝑦1subscript𝑦2subscript𝑦𝑘y_{1},y_{2},\dots,y_{k}italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_y start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT with total size kε=1𝑘𝜀1k\cdot\varepsilon=1italic_k ⋅ italic_ε = 1 and total value k4ε=4𝑘4𝜀4k\cdot 4\varepsilon=4italic_k ⋅ 4 italic_ε = 4. The two deterministic algorithms, in contrast, have discarded all items in this optimal solution but possibly yksubscript𝑦𝑘y_{k}italic_y start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT. Among yksubscript𝑦𝑘y_{k}italic_y start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT and x0,x1,,xksubscript𝑥0subscript𝑥1subscript𝑥𝑘x_{0},x_{1},\dots,x_{k}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, which might have been presented, no two fit into a knapsack of capacity 1 together, thus the best feasible solution for the advice algorithm is taking the single most valuable item x0subscript𝑥0x_{0}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT with a value of 2222. The competitive performance of the algorithm is 4/2=24224/2=24 / 2 = 2 in this case.

Case 2.

If the path reaches the bottom, this means that the last move was downward; thus one algorithm has kept xk1subscript𝑥𝑘1x_{k-1}italic_x start_POSTSUBSCRIPT italic_k - 1 end_POSTSUBSCRIPT in its reserve and the other yjsubscript𝑦𝑗y_{j}italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. Therefore, only the three singleton solutions consisting of xk1subscript𝑥𝑘1x_{k-1}italic_x start_POSTSUBSCRIPT italic_k - 1 end_POSTSUBSCRIPT, xksubscript𝑥𝑘x_{k}italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, and yjsubscript𝑦𝑗y_{j}italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, respectively, are attainable by the advice algorithm. Among these, the first option is the best with a value of 1+ε1𝜀1+\varepsilon1 + italic_ε. The optimum would have been to keep x0subscript𝑥0x_{0}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT with a value of 2222, however, resulting in a competitive performance of 2/(1+ε)21𝜀2/(1+\varepsilon)2 / ( 1 + italic_ε ) or worse.

Case 3.

Finally, the path may stop at some point (xi,yj)subscript𝑥𝑖subscript𝑦𝑗(x_{i},y_{j})( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) with i<k𝑖𝑘i<kitalic_i < italic_k and j<k𝑗𝑘j<kitalic_j < italic_k. In this case, both algorithms have discarded xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and, as observed in the beginning, all previously presented items except for xi1subscript𝑥𝑖1x_{i-1}italic_x start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT and yjsubscript𝑦𝑗y_{j}italic_y start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. Thus, when the final item xisuperscriptsubscript𝑥𝑖x_{i}^{\prime}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT is presented, the best option for the advice algorithm is the singleton solution with the item xi1subscript𝑥𝑖1x_{i-1}italic_x start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT of value 2(i1)ε2𝑖1𝜀2-(i-1)\varepsilon2 - ( italic_i - 1 ) italic_ε. The optimal solution, in contrast, can combine the two items xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and xisuperscriptsubscript𝑥𝑖x_{i}^{\prime}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT of complementing sizes and a total value of 2(2iε)+ε=2(2(i1)ε)ε22𝑖𝜀𝜀22𝑖1𝜀𝜀2(2-i\varepsilon)+\varepsilon=2(2-(i-1)\varepsilon)-\varepsilon2 ( 2 - italic_i italic_ε ) + italic_ε = 2 ( 2 - ( italic_i - 1 ) italic_ε ) - italic_ε. The resulting competitive performance is 2ε/(2(i1)ε)2ε/(2(k1)ε)2ε2𝜀2𝑖1𝜀2𝜀2𝑘1𝜀2𝜀2-\varepsilon/(2-(i-1)\varepsilon)\leq 2-\varepsilon/(2-(k-1)\varepsilon)\leq 2-\varepsilon2 - italic_ε / ( 2 - ( italic_i - 1 ) italic_ε ) ≤ 2 - italic_ε / ( 2 - ( italic_k - 1 ) italic_ε ) ≤ 2 - italic_ε.

Overall, the advice algorithm’s competitive ratio cannot be better than

min{2,21+ε,2ε}22ε,221𝜀2𝜀22𝜀\min\big{\{}2,\frac{2}{1+\varepsilon},2-\varepsilon\big{\}}\geq 2-2\varepsilon,roman_min { 2 , divide start_ARG 2 end_ARG start_ARG 1 + italic_ε end_ARG , 2 - italic_ε } ≥ 2 - 2 italic_ε ,

which tends to 2222 for decreasing ε𝜀\varepsilonitalic_ε, thus proving the theorem.

Advice being more powerful than randomness, Theorem 5.3 also closes the remaining gap for barely random algorithms by lifting the previously best known lower bound by Han et al. [11, Thm. 12] from 1+1/e1.36711𝑒1.3671+1/e\approx 1.3671 + 1 / italic_e ≈ 1.367 to 2222.

The analysis of the hard instance presented in the proof of Theorem 5.3 could be adapted to the case of more than one advice bit. Two advice bits would mean that the oracle can provide to the algorithm one out of four advice strings instead of the two advice strings possible with one bit. We may also consider an intermediate advice algorithm limited to three advice strings, which corresponds to log33\log 3roman_log 3 advice bits. Such an algorithm cannot achieve a competitive ratio better than 2/Φ=4/(1+5)1.23612Φ4151.23612/\Phi=4/(1+\sqrt{5})\approx 1.23612 / roman_Φ = 4 / ( 1 + square-root start_ARG 5 end_ARG ) ≈ 1.2361 since it is forced to use one of the three advice strings to keep the most valuable item x0subscript𝑥0x_{0}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, one to pack the items y1,,yksubscript𝑦1subscript𝑦𝑘y_{1},\dots,y_{k}italic_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_y start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT yield-greedily, and one to keep the xjsubscript𝑥𝑗x_{j}italic_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT with the value Φ1.618Φ1.618\Phi\approx 1.618roman_Φ ≈ 1.618, resulting in a competitive ratio of 2/Φ=2Φ/(1+Φ)2Φ2Φ1Φ2/\Phi=2\Phi/(1+\Phi)2 / roman_Φ = 2 roman_Φ / ( 1 + roman_Φ ).

This approach deteriorates too quickly, however. Adapting Theorem 4.11 to the case of PropRemKnap is the better choice; this results in Theorem 5.7, which already yields a better bound in the case of three advice strings, that is, for k=3𝑘3k=3italic_k = 3. For increased accessibility, we first provide an instantiation for the case of a single advice bit, namely k=2𝑘2k=2italic_k = 2.

Theorem 5.5.

No algorithm for RemKnap reading only a single advice bit can have a better competitive ratio than (1+3)/21.366031321.36603(1+\sqrt{3})/2\approx 1.36603( 1 + square-root start_ARG 3 end_ARG ) / 2 ≈ 1.36603.

Proof 5.6.

The proof is similar to the one of Theorem 4.9 but takes advantage of the fact that the sizes and values of the items can be chosen independently. Let η=(31)/20.366025𝜂3120.366025\eta=(\sqrt{3}-1)/2\approx 0.366025italic_η = ( square-root start_ARG 3 end_ARG - 1 ) / 2 ≈ 0.366025 and let an algorithm for general removable knapsack reading only a single advice bit be given. Consider the three instances displayed in Table 5, which all start with the same three items.

Table 5: Hard instance for an algorithm for RemKnap reading one advice bit, where η=(31)/2𝜂312\eta=(\sqrt{3}-1)/2italic_η = ( square-root start_ARG 3 end_ARG - 1 ) / 2 satisfies 1/(2η)=1+η=(1+3)/21.3660312𝜂1𝜂1321.366031/(2\eta)=1+\eta=(1+\sqrt{3})/2\approx 1.366031 / ( 2 italic_η ) = 1 + italic_η = ( 1 + square-root start_ARG 3 end_ARG ) / 2 ≈ 1.36603; see the proof of Theorem 5.5.
x1subscript𝑥1x_{1}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT x2subscript𝑥2x_{2}italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT x3subscript𝑥3x_{3}italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT x4subscript𝑥4x_{4}italic_x start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT x4superscriptsubscript𝑥4x_{4}^{\prime}italic_x start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT optimal suboptimal ratio
I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT: (1,1)11(1,1)( 1 , 1 ) (0.9,2η)0.92𝜂(0.9,2\eta)( 0.9 , 2 italic_η ) (0.8,η)0.8𝜂(0.8,\eta)( 0.8 , italic_η ) 1111 2η2𝜂2\eta2 italic_η 1/2η12𝜂1/2\eta1 / 2 italic_η
I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT: (1,1)11(1,1)( 1 , 1 ) (0.9,2η)0.92𝜂(0.9,2\eta)( 0.9 , 2 italic_η ) (0.8,η)0.8𝜂(0.8,\eta)( 0.8 , italic_η ) (0.1,1η)0.11𝜂(0.1,1-\eta)( 0.1 , 1 - italic_η ) 1+η1𝜂1+\eta1 + italic_η 1111 1+η1𝜂1+\eta1 + italic_η
I3subscript𝐼3I_{3}italic_I start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT: (1,1)11(1,1)( 1 , 1 ) (0.9,2η)0.92𝜂(0.9,2\eta)( 0.9 , 2 italic_η ) (0.8,η)0.8𝜂(0.8,\eta)( 0.8 , italic_η ) (0.2,1)0.21(0.2,1)( 0.2 , 1 ) 1+η1𝜂1+\eta1 + italic_η 1111 1+η1𝜂1+\eta1 + italic_η

For each i{1,2,3}𝑖123i\in\{1,2,3\}italic_i ∈ { 1 , 2 , 3 }, the instance Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT has a unique optimal solution; it contains xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT plus the last fourth item if it exists. Table 5 shows the total size for each of these optimal solutions and the second best solution.

Because the sizes of any two of these three items x1subscript𝑥1x_{1}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, x2subscript𝑥2x_{2}italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, and x3subscript𝑥3x_{3}italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT sum up to over 1, the algorithm can have at most one of them in the knapsack after being offered x3subscript𝑥3x_{3}italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT. Moreover, since we have only one advice bit but three instances, there are two instances for which the algorithm has packed the same item right before the potential presentation of the fourth item. This implies that the algorithm is suboptimal for at least one instance, thus its competitive ratio cannot be better than 1/(2η)=1+η=(1+3)/212𝜂1𝜂1321/(2\eta)=1+\eta=(1+\sqrt{3})/21 / ( 2 italic_η ) = 1 + italic_η = ( 1 + square-root start_ARG 3 end_ARG ) / 2.

Theorem 5.7.

Let an arbitrary integer k>1𝑘1k>1italic_k > 1 be given. No algorithm for RemKnap reading at most logk𝑘\log kroman_log italic_k advice bits can achieve a better competitive ratio than 1/2+1/4+1/k12141𝑘1/2+\sqrt{1/4+1/k}1 / 2 + square-root start_ARG 1 / 4 + 1 / italic_k end_ARG.

Table 6: A hard instance family for RemKnap reading at most logk𝑘\log kroman_log italic_k advice bits; see the proof of Theorem 5.7. Only the values of the items are given, using ξ=(32k+4k(k+1)7)/4𝜉32𝑘4𝑘𝑘174\xi=(3-2k+\sqrt{4k(k+1)-7})/4italic_ξ = ( 3 - 2 italic_k + square-root start_ARG 4 italic_k ( italic_k + 1 ) - 7 end_ARG ) / 4; the sizes can be chosen arbitrarily satisfying 1s1>s2>>sk>sk+1>1/21subscript𝑠1subscript𝑠2normal-⋯subscript𝑠𝑘subscript𝑠𝑘1121\geq s_{1}>s_{2}>\dots>s_{k}>s_{k+1}>1/21 ≥ italic_s start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT > italic_s start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT > ⋯ > italic_s start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT > italic_s start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT > 1 / 2 and sk+2=1sjsubscript𝑠𝑘21subscript𝑠𝑗s_{k+2}=1-s_{j}italic_s start_POSTSUBSCRIPT italic_k + 2 end_POSTSUBSCRIPT = 1 - italic_s start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT in instance Ijsubscript𝐼𝑗I_{j}italic_I start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT.
v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT v2subscript𝑣2v_{2}italic_v start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT \cdots vksubscript𝑣𝑘v_{k}italic_v start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT vk+1subscript𝑣𝑘1v_{k+1}italic_v start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT   vk+2subscript𝑣𝑘2v_{k+2}italic_v start_POSTSUBSCRIPT italic_k + 2 end_POSTSUBSCRIPT
I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT: 1111 1/ξ1𝜉1/\xi1 / italic_ξ \cdots 1/ξ(k2)(ξ1)1𝜉𝑘2𝜉11/\xi-(k-2)(\xi-1)1 / italic_ξ - ( italic_k - 2 ) ( italic_ξ - 1 ) 1/ξ(k1)(ξ1)1𝜉𝑘1𝜉11/\xi-(k-1)(\xi-1)1 / italic_ξ - ( italic_k - 1 ) ( italic_ξ - 1 ) 0
I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT: 1111 1/ξ1𝜉1/\xi1 / italic_ξ \cdots 1/ξ(k2)(ξ1)1𝜉𝑘2𝜉11/\xi-(k-2)(\xi-1)1 / italic_ξ - ( italic_k - 2 ) ( italic_ξ - 1 ) 1/ξ(k1)(ξ1)1𝜉𝑘1𝜉11/\xi-(k-1)(\xi-1)1 / italic_ξ - ( italic_k - 1 ) ( italic_ξ - 1 ) ξv2𝜉subscript𝑣2\xi-v_{2}italic_ξ - italic_v start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT
\,\vdots \vdots \vdots \vdots \vdots \vdots \hphantom{1\leavevmode\nobreak\ }\vdots
Ik+1subscript𝐼𝑘1I_{k+1}italic_I start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT: 1111 1/ξ1𝜉1/\xi1 / italic_ξ \cdots 1/ξ(k2)(ξ1)1𝜉𝑘2𝜉11/\xi-(k-2)(\xi-1)1 / italic_ξ - ( italic_k - 2 ) ( italic_ξ - 1 ) 1/ξ(k1)(ξ1)1𝜉𝑘1𝜉11/\xi-(k-1)(\xi-1)1 / italic_ξ - ( italic_k - 1 ) ( italic_ξ - 1 ) ξvk+1𝜉subscript𝑣𝑘1\xi-v_{k+1}italic_ξ - italic_v start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT
Table 7: The values of the optimal and best suboptimal solutions for each instance in the family given in Table 6 and the resulting competitive performance; see the proof of Theorem 5.7.
Optimal value Best suboptimal value Best suboptimal performance
I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT: v1=1subscript𝑣11v_{1}=1italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = 1 v2=1/ξsubscript𝑣21𝜉v_{2}=1/\xiitalic_v start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = 1 / italic_ξ ξ𝜉\xiitalic_ξ
I2subscript𝐼2I_{2}italic_I start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT: v2+v2=ξsubscript𝑣2superscriptsubscript𝑣2𝜉v_{2}+v_{2}^{\prime}=\xiitalic_v start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + italic_v start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = italic_ξ v1=v3+v2=1subscript𝑣1subscript𝑣3superscriptsubscript𝑣21v_{1}=v_{3}+v_{2}^{\prime}=1italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_v start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT + italic_v start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = 1 ξ𝜉\xiitalic_ξ
I3subscript𝐼3I_{3}italic_I start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT: v3+v3=ξsubscript𝑣3superscriptsubscript𝑣3𝜉v_{3}+v_{3}^{\prime}=\xiitalic_v start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT + italic_v start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = italic_ξ v1=v4+v3=1subscript𝑣1subscript𝑣4superscriptsubscript𝑣31v_{1}=v_{4}+v_{3}^{\prime}=1italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_v start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT + italic_v start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = 1 ξ𝜉\xiitalic_ξ
\,\vdots \vdots\hphantom{\,\leavevmode\nobreak\ \xi} \vdots\hphantom{\,\leavevmode\nobreak\ \xi} \vdots\hphantom{\,\xi}
Iksubscript𝐼𝑘I_{k}italic_I start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT: vk+vk=ξsubscript𝑣𝑘superscriptsubscript𝑣𝑘𝜉v_{k}+v_{k}^{\prime}=\xiitalic_v start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_v start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = italic_ξ v1=vk+vk1=1subscript𝑣1subscript𝑣𝑘superscriptsubscript𝑣𝑘11v_{1}=v_{k}+v_{k-1}^{\prime}=1italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = italic_v start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_v start_POSTSUBSCRIPT italic_k - 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = 1 ξ𝜉\xiitalic_ξ
Ik+1subscript𝐼𝑘1I_{k+1}italic_I start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT: vk+1+vk+1=ξsubscript𝑣𝑘1superscriptsubscript𝑣𝑘1𝜉v_{k+1}+v_{k+1}^{\prime}=\xiitalic_v start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT + italic_v start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = italic_ξ vk+1+vk=1subscript𝑣𝑘1superscriptsubscript𝑣𝑘1v_{k+1}+v_{k}^{\prime}=1italic_v start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT + italic_v start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = 1 ξ𝜉\xiitalic_ξ
Proof 5.8.

Let an arbitrary integer k>1𝑘1k>1italic_k > 1 be given and define ξ𝜉\xiitalic_ξ as the unique positive solution of 1/ξ=k(ξ1)1𝜉𝑘𝜉11/\xi=k(\xi-1)1 / italic_ξ = italic_k ( italic_ξ - 1 ), namely ξ=1/2+1/4+1/k𝜉12141𝑘\xi=1/2+\sqrt{1/4+1/k}italic_ξ = 1 / 2 + square-root start_ARG 1 / 4 + 1 / italic_k end_ARG. Consider k+1𝑘1k+1italic_k + 1 instances that all start with the same k+1𝑘1k+1italic_k + 1 items of the following, decreasing values: v1=1subscript𝑣11v_{1}=1italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = 1 and vi=1/ξ(i2)(ξ1)subscript𝑣𝑖1𝜉𝑖2𝜉1v_{i}=1/\xi-(i-2)(\xi-1)italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = 1 / italic_ξ - ( italic_i - 2 ) ( italic_ξ - 1 ) for every i{2,,k+1}𝑖2normal-…𝑘1i\in\{2,\dots,k+1\}italic_i ∈ { 2 , … , italic_k + 1 }. Note that vk+1=ξ1subscript𝑣𝑘1𝜉1v_{k+1}=\xi-1italic_v start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = italic_ξ - 1. The sizes can be chosen arbitrarily satisfying 1s1>s2>>sk>sk+1>1/21subscript𝑠1subscript𝑠2normal-⋯subscript𝑠𝑘subscript𝑠𝑘1121\geq s_{1}>s_{2}>\dots>s_{k}>s_{k+1}>1/21 ≥ italic_s start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT > italic_s start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT > ⋯ > italic_s start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT > italic_s start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT > 1 / 2.

The instance I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ends immediately after these common items, whereas the instance Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, for i{2,,k+1}𝑖2normal-…𝑘1i\in\{2,\dots,k+1\}italic_i ∈ { 2 , … , italic_k + 1 }, presents a complement to item i𝑖iitalic_i, namely an item of size si=1sisuperscriptsubscript𝑠𝑖normal-′1subscript𝑠𝑖s_{i}^{\prime}=1-s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = 1 - italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and value vi=ξvisuperscriptsubscript𝑣𝑖normal-′𝜉subscript𝑣𝑖v_{i}^{\prime}=\xi-v_{i}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = italic_ξ - italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT as the final one. There is a unique optimal solution for each instance: For I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, it is to pack the first item, which has value v1=1subscript𝑣11v_{1}=1italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = 1. For Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT with i>1𝑖1i>1italic_i > 1, it is to pack item i𝑖iitalic_i and its complement, which sum up to the optimal solution value ξ𝜉\xiitalic_ξ. Since there are only logk𝑘\log kroman_log italic_k advice bits available to handle the k+1𝑘1k+1italic_k + 1 instances, at least two instances Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and Ijsubscript𝐼𝑗I_{j}italic_I start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT with i<j𝑖𝑗i<jitalic_i < italic_j are processed with the same advice string and thus by the same deterministic algorithm. Consider this algorithm and the moment after seeing and taking decisions on the first k+1𝑘1k+1italic_k + 1 items. It is impossible for the algorithm to have more than one of these common items packed since all of these items are larger than 1/2121/21 / 2. Now, if item i𝑖iitalic_i is packed at the considered moment, the algorithm will perform suboptimally on instance Ijsubscript𝐼𝑗I_{j}italic_I start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. Analogously, if item j𝑗jitalic_j is packed, the performance on instance Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is suboptimal.

Now if suffices to check that the best suboptimal solution has a value of at most 1/ξ1𝜉1/\xi1 / italic_ξ for I1subscript𝐼1I_{1}italic_I start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and at most 1111 for the other instances. This leads to a performance ratio of ξ𝜉\xiitalic_ξ, thus proving the theorem. See Table 6 for an overview of the hard instance family. The best and second best solutions to all instances and their associated performances are listed in Table 7.

We point out again that Theorem 5.7 slightly improves over the lower bounds known from the resource buffer model by Han et al. [13, Thm. 6]. Specifically, we can choose k=21𝑘superscript21k=2^{1}italic_k = 2 start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT, k=22𝑘superscript22k=2^{2}italic_k = 2 start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT, and k=23𝑘superscript23k=2^{3}italic_k = 2 start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT, for example, we obtain the lower bounds

1+32132absent\displaystyle\frac{1+\sqrt{3}}{2}\approx{}divide start_ARG 1 + square-root start_ARG 3 end_ARG end_ARG start_ARG 2 end_ARG ≈ 1.3660,1.3660\displaystyle 1.3660,\quad1.3660 , 1+22122absent\displaystyle\frac{1+\sqrt{2}}{2}\approx{}divide start_ARG 1 + square-root start_ARG 2 end_ARG end_ARG start_ARG 2 end_ARG ≈ 1.2071,1.2071\displaystyle 1.2071,\quad1.2071 , and 1+3/221322absent\displaystyle\frac{1+\sqrt{3/2}}{2}\approx{}divide start_ARG 1 + square-root start_ARG 3 / 2 end_ARG end_ARG start_ARG 2 end_ARG ≈ 1.1124.1.1124\displaystyle 1.1124.1.1124 .
for one, two, and three advice bits, respectively. The corresponding lower bounds by Han et al. for a resource buffer of size R=2k𝑅superscript2𝑘R=2^{k}italic_R = 2 start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT are
4/343absent\displaystyle 4/3\approx{}4 / 3 ≈ 1.3333,1.3333\displaystyle 1.3333,1.3333 , 6/5=65absent\displaystyle 6/5={}6 / 5 = 1.2,1.2\displaystyle 1.2,1.2 , and 10/9109absent\displaystyle 10/9\approx{}10 / 9 ≈ 1.1111.1.1111\displaystyle 1.1111.1.1111 .

We now move on to the core result of this paper, proving that a constant amount of advice bits is sufficient to reach a near-optimal competitive ratio not only for the proportional but even for the general removable knapsack problem. This will complete the picture of the global advice behavior of the online knapsack problem with removability outlined in Figure 1.

We first point out that algorithm PropPack (Algorithm 1) generally does not work on instances where the value of an item can vary independently of its size, as seen by the following counterexample: Assume that 1/2121/21 / 2 lies in the interior of some size class and choose an ε>0𝜀0\varepsilon>0italic_ε > 0 such that 1/2+ε12𝜀1/2+\varepsilon1 / 2 + italic_ε and 1/2ε12𝜀1/2-\varepsilon1 / 2 - italic_ε are still in the same class. Present two items (1/2+ε,2)12𝜀2(1/2+\varepsilon,2)( 1 / 2 + italic_ε , 2 ) and (1/2,1)121(1/2,1)( 1 / 2 , 1 ). If the algorithm picks the first one, (1/2,2)122(1/2,2)( 1 / 2 , 2 ) is presented as the last item; otherwise, the instance ends with the item (1/2ε,1)12𝜀1(1/2-\varepsilon,1)( 1 / 2 - italic_ε , 1 ). In both cases, the algorithm achieves a total value of 2222, whereas the optimum is 3333. The advice does not help us to distinguish the two cases, it only tells us that the optimal solution contains two items from the class. Clearly, we have to adapt the algorithm to take the value of the items into account somehow. A major obstacle is that the online algorithm has no bound on the values of appearing items, thus the algorithm has no way of reconstructing the constantly many value classes used by the oracle just from the parameter ε𝜀\varepsilonitalic_ε.

Moreover, the proof of Theorem 4.15 cannot be adapted for the general case in any simple way. Using only classes based on size, it is impossible for the algorithm to know, when maintaining an item in slot, how to balance minimizing the size against maximizing the value. On the one hand, if the size is not minimized, then the excess size may prevent other slots from being filled. On the other hand, not maximizing the values, the algorithm may incur an arbitrarily high loss because the potential values of items cannot be bounded. This is also the reason why simple value classes do not work either. The algorithm does not know the maximal value occurring in the instance until it has ended and can therefore not use it as a reference point, in contrast to the size classes that can be chosen relative to the known knapsack capacity.

A first step toward solving these issues is the definition of dynamic value classes that are anchored to both the value of the first item appearing in the instance and to the optimal solution value. The latter is of course also unknown to the algorithm until the instance ends. However, we are able to define our classes with some additional properties that enable our algorithm to compute at any point useful provisional bounds on the optimal solution value. These bounds will either turn out to be valid or the algorithm is able to notice that they are off just in time to adjust and take a fresh start before having lost too much due to bad decisions. The adversary may foil the algorithm over and over, forcing it to abandon its plans and adjust the bounds arbitrarily often.

To properly deal with these repeated resets, we develop a level system. One major challenge is to square the level system with some sort of slot system as used by the algorithm for the proportional case. We manage to do this by introducing the concept of a virtual algorithm, which has the special, even though only imagined, capability of kee** one item in a splitting slot and use arbitrary fractions of the item stored in it. We then describe an actual algorithm that tries to equal the idealized performance of the virtual algorithm without making use of the splitting slot. While it cannot quite achieve this, it will fare well enough in the end. Having one algorithm emulating another, we are going to prove the claimed competitivity in two stages, first for the virtual version and then for the actual algorithm.

This split analysis presents several further challenges, for example, a desynchronization of the current phase and the number of slots filled by the algorithm, which coincided in the proportional case. The necessary adaptations entail a number of further challenges, for example a judicious handling of the paltry items, which are worth almost nothing individually, yet may be too numerous to neglect. In fact, the algorithm will need to partition the items not only by their value but simultaneously by their size as well.

Overcoming these and a few other obstacles, we are able to prove our final theorem.

Theorem 5.9.

For any ε>0𝜀0\varepsilon>0italic_ε > 0, there is a strictly (1+ε)1𝜀(1+\varepsilon)( 1 + italic_ε )-competitive algorithm for RemKnap reading a constant number of advice bits.

Proof 5.10.

Proving this theorem requires far more effort than what was necessary for its proportional counterpart Theorem 4.15, where an item’s value is always identical to its size. Having explained already why any straightforward adaption of the substantially simpler approach for the proportional variant is impossible, we now provide a high-level outline of the proof. Then, we introduce some notions and notation necessary to describe what advice the oracle is communicating to the algorithm, and show that encoding this advice is possible with a constant number of bits. Then, we describe the algorithm and how it is using the advice; see Algorithm 2 for an implementation in pseudo-code. Finally, we use two proofs by induction to show that the algorithm’s online output successfully maintains some properties, which help us to conclude the proof by bounding the competitive ratio.

Outline

As announced, we first provide a high-level outline of the workings of the advice algorithm.

The oracle chooses an arbitrary optimal solution S𝑆Sitalic_S and, based on its value v(S)𝑣𝑆v(S)italic_v ( italic_S ), partitions the items of the instance into precious and paltry ones; the paltry ones are those worth less than εpaltryv(S)subscript𝜀paltry𝑣𝑆\varepsilon_{\textnormal{paltry}}\cdot v(S)italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ⋅ italic_v ( italic_S ) for a suitable εpaltry>0subscript𝜀paltry0\varepsilon_{\textnormal{paltry}}>0italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT > 0. The precious items are further split into finitely many classes such that the item values within any class are at most some factor 1εspread1subscript𝜀spread1-\varepsilon_{\textnormal{spread}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT apart from each other.

The advice will encode exactly the classes of the precious items from the optimal solution S𝑆Sitalic_S in their order of appearance; the goal is to ensure that the algorithm packs just as many precious items from each class as the optimal solution does, thus achieving a competitive factor of 1/(1εspread)11subscript𝜀spread1/(1-\varepsilon_{\textnormal{spread}})1 / ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) on these items. Assuming that the algorithm knows the exact value ranges of each class, it can achieve this using a system of slots, which will be filled with precious items in two stages: first just virtually—assuming the algorithm were able to do certain things that are in fact impossible—and then also actually at some point. Each virtual filling of a slot starts a new phase of the algorithm.

However, the algorithm knows only the target value but nothing about the size of the items belonging into each slot; it is necessary to prove that despite this, the algorithm is able to fill the slots in the right order without blocking important items yet to come.

And there is another problem: It is even impossible for the oracle to communicate to the algorithm the exact value range of each class with a constant amount of advice since there is no bound on the potential values occurring in an instance. Instead, the value ranges will be described in relation to the value of the first item of the instance, and merely modulo some constant factor. The algorithm will then operate under the assumption that the first item is a precious one, in which case all of the above will work out. Since the algorithm cannot know for sure which items are precious, it divides them into presumably precious and provenly paltry ones according to some computations based on the advice and the instance seen so far. If the algorithm’s assumption is mistaken, it is able to recognize this just in time by continually comparing the best solution realizable with the already presented items—whether they have been accepted or not—to a rather intricate estimate for the optimal solution value v(S)𝑣𝑆v(S)italic_v ( italic_S ). Once the algorithm discovers its mistake, it resets with a revised set of assumptions on the value ranges; we say that the algorithm levels up. This is done such that the algorithm can go through arbitrarily many levels, resetting and taking a fresh start as often as necessary without incurring more than a negligible value loss.

The algorithm also needs to take care of the paltry items, which might constitute a considerable part of the optimal solution if there are sufficiently many of them. The algorithm is packing the paltry items in a somewhat inhibited greedy manner that optimizes the value-to-size ratio, which we also call yield. The volume taken up by the paltry items will be restricted sufficiently to guarantee that the precious items can always fill their slots, but not as severely as to lose too much value on the paltry items. The right volume restrictions in each phase of the algorithm are communicated via a constant amount of advice as well. Again, this cannot happen directly, since the right volume range might be infinitesimally small. Instead, the volume is controlled indirectly, via bounds not on some size but instead on the value that is provided by the paltry items packed before filling the current slot with a precious item.

Communicating the necessary volumes in this way is possible only up to some precision εroundsubscript𝜀round\varepsilon_{\textnormal{round}}italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT, and an overestimation could mean the loss of a crucial precious item. If we always round down, then this cannot happen, but the algorithm might reject some paltry item it should have kept for a selection of maximum yield. This is negligible if it happens only once, but we cannot tolerate taking such a loss in every phase, with every new volume bound. The solution is to analyze the situation using a special splitting slot, which can accommodate one paltry item at the time outside of the knapsack. We imagine the splitting slot lending us from the item stored in it any desired fraction at any time—just always the same fraction of the value and size. We refer to the item currently stored in the splitting slot as the split item. We will consider an algorithm that maintains a split item of highest yield after the remaining paltry items kept in the knapsack. This imaginary algorithm is an antecedent to our real advice algorithm, which builds on it but cannot actually split any items of course; we refer to the purely hypothetical precursor as the virtual version of our actual algorithm.

The actual algorithm will mimic the virtual version as closely as possible and deliver a result that is only marginally worse. Whenever the virtual version splits an item, the actual algorithm needs to decide whether to discard this item or store it completely. The challenge is to take the right decisions to allow for all slots to be filled in time and also avoid an undue accumulation of losses by passing on too many split items.

The advice helps the actual algorithm by indicating for every phase whether an item stored in the splitting slot by the virtual version is to be packed or discarded. This is done in such a way that in the end, the actual algorithm will have relinquished only the value of a single paltry item, namely the one kept in the splitting slot when the instance ends.

Packing entire items from the splitting slot comes with problems on its own; these paltry items might block for the actual algorithm some precious items that are packed by the virtual version. This problem is addressed by further advice to the algorithm on how to prioritize the packing of precious versus paltry items in each phase. This advice, telling the algorithm when to actualize a virtual packing of an item, is based on the solution that the virtual version would eventually produce if it existed. The virtual version does not depend on the actual algorithm and has no need for the part of the advice on actualization, which avoids any circular reasoning.

There are a few more technical issues to be dealt with, for example the special case that the precious items contribute only marginally to the value of the optimal solution. This undermines the estimates for the optimal solution value, is thus flagged by a dedicated advice bit bsmallsubscript𝑏smallb_{\textnormal{small}}italic_b start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, and handled by switching from the elaborate value-based limits that dampen the general yield-greedy strategy to a simpler size-sensitive strategy.

\cdotsV3subscript𝑉3V_{-3}italic_V start_POSTSUBSCRIPT - 3 end_POSTSUBSCRIPTV2subscript𝑉2V_{-2}italic_V start_POSTSUBSCRIPT - 2 end_POSTSUBSCRIPTV1subscript𝑉1V_{-1}italic_V start_POSTSUBSCRIPT - 1 end_POSTSUBSCRIPTV0subscript𝑉0V_{0}italic_V start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPTV1subscript𝑉1V_{1}italic_V start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTV2subscript𝑉2V_{2}italic_V start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPTV3subscript𝑉3V_{3}italic_V start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPTV4subscript𝑉4V_{4}italic_V start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPTV5subscript𝑉5V_{5}italic_V start_POSTSUBSCRIPT 5 end_POSTSUBSCRIPTV6subscript𝑉6V_{6}italic_V start_POSTSUBSCRIPT 6 end_POSTSUBSCRIPTV7subscript𝑉7V_{7}italic_V start_POSTSUBSCRIPT 7 end_POSTSUBSCRIPTV8subscript𝑉8V_{8}italic_V start_POSTSUBSCRIPT 8 end_POSTSUBSCRIPTV9subscript𝑉9V_{9}italic_V start_POSTSUBSCRIPT 9 end_POSTSUBSCRIPTV10subscript𝑉10V_{10}italic_V start_POSTSUBSCRIPT 10 end_POSTSUBSCRIPTV11subscript𝑉11V_{11}italic_V start_POSTSUBSCRIPT 11 end_POSTSUBSCRIPTV12subscript𝑉12V_{12}italic_V start_POSTSUBSCRIPT 12 end_POSTSUBSCRIPTV13subscript𝑉13V_{13}italic_V start_POSTSUBSCRIPT 13 end_POSTSUBSCRIPTV14subscript𝑉14V_{14}italic_V start_POSTSUBSCRIPT 14 end_POSTSUBSCRIPTV15subscript𝑉15V_{15}italic_V start_POSTSUBSCRIPT 15 end_POSTSUBSCRIPTV16subscript𝑉16V_{16}italic_V start_POSTSUBSCRIPT 16 end_POSTSUBSCRIPT\cdotsW0subscript𝑊0W_{0}italic_W start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPTW1subscript𝑊1W_{1}italic_W start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTW2subscript𝑊2W_{2}italic_W start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPTW3subscript𝑊3W_{3}italic_W start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPTW4subscript𝑊4W_{4}italic_W start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPTv1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPTvisubscript𝑣𝑖v_{i}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPTv(S)𝑣𝑆v(S)italic_v ( italic_S )ptpaltry andprovenly paltryptpaltry butpresumablypreciousptprecious
Figure 4: A schematic illustration showing some of the infinitely many classes Vksubscript𝑉𝑘V_{k}italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT and comboclasses Wksubscript𝑊𝑘W_{k}italic_W start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT used in the proof of Theorem 5.9. The x𝑥xitalic_x-axis shows the value ranges of the items contained in each class; it has logarithmic scale. We have 00 infinitely far to the left and \infty infinitely far to the right. Each class Vksubscript𝑉𝑘V_{k}italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT covers values that spread across a factor of 1εspread1subscript𝜀spread1-\varepsilon_{\textnormal{spread}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT, which is the unit length in the logarithmic scale. The comboclasses are K=4𝐾4K=4italic_K = 4 units wide, and there are K=4𝐾4K=4italic_K = 4 modulo classes. The modulo class M2subscript𝑀2M_{2}italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT is shaded in gray; this is the modulo class containing the first item, which has value v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. The scale is shifted such that the following three properties are satisfied: The value v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT of the first item lies right at the top end of its class (i.e., the right end in this illustration), the class of the first item is part of the comboclass W1subscript𝑊1W_{1}italic_W start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, and the optimal solution value v(S)𝑣𝑆v(S)italic_v ( italic_S ) lies somewhere in the highest class of its comboclass, namely in the modulo class M0subscript𝑀0M_{0}italic_M start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. The position of the optimal solution value determines what we call precious and paltry. The highest value achievable with the items seen so far, represented by visubscript𝑣𝑖v_{i}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT in the example, determines what we call presumably precious and provenly paltry.

Notions and Notation

We make the same assumptions as in the proof of Theorem 4.15 for the proportional problem: The knapsack has capacity 1111, all items have size at most 1111, and ε1/2𝜀12\varepsilon\leq 1/2italic_ε ≤ 1 / 2. Again, we denote the items in the order of their appearance in the instance by 1,2,,n12𝑛1,2,\dots,n1 , 2 , … , italic_n. We write si=s(i)subscript𝑠𝑖𝑠𝑖s_{i}=s(i)italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_s ( italic_i ) and vi=v(i)subscript𝑣𝑖𝑣𝑖v_{i}=v(i)italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_v ( italic_i ) for the size and value of item i𝑖iitalic_i, respectively.

To make to proof more understandable, we use the four constants εsmallsubscript𝜀small\varepsilon_{\textnormal{small}}italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, εpaltrysubscript𝜀paltry\varepsilon_{\textnormal{paltry}}italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT, εspreadsubscript𝜀spread\varepsilon_{\textnormal{spread}}italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT, and εroundsubscript𝜀round\varepsilon_{\textnormal{round}}italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT, which all depend only on the given parameter ε𝜀\varepsilonitalic_ε but are used in different roles. They need to satisfy several inequalities; a concrete list of possible choices is εsmall=ε/23subscript𝜀small𝜀superscript23\varepsilon_{\textnormal{small}}=\varepsilon/2^{3}italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT = italic_ε / 2 start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT, εpaltry=ε2/25subscript𝜀paltrysuperscript𝜀2superscript25\varepsilon_{\textnormal{paltry}}=\varepsilon^{2}/2^{5}italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT = italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 5 end_POSTSUPERSCRIPT, εspread=ε4/214subscript𝜀spreadsuperscript𝜀4superscript214\varepsilon_{\textnormal{spread}}=\varepsilon^{4}/2^{14}italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT = italic_ε start_POSTSUPERSCRIPT 4 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 14 end_POSTSUPERSCRIPT, and εround=ε6/220subscript𝜀roundsuperscript𝜀6superscript220\varepsilon_{\textnormal{round}}=\varepsilon^{6}/2^{20}italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT = italic_ε start_POSTSUPERSCRIPT 6 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 20 end_POSTSUPERSCRIPT.

The oracle begins by computing an arbitrary optimal solution S𝑆Sitalic_S. In contrast to the proof for the proportional analogue of our theorem, not just the advice but also the constructed classes depend on S𝑆Sitalic_S and the instance as well. Specifically, the oracle uses the value v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT of the first item in the instance and the optimal solution value v(S)𝑣𝑆v(S)italic_v ( italic_S ) to partition all items into the bi-infinite sequence of value classes

Vk={i{1,,n}|log1εspreadv1vi+K(log1εspreadv1v(S)modK)=k}subscript𝑉𝑘conditional-set𝑖1𝑛subscript1subscript𝜀spreadsubscript𝑣1subscript𝑣𝑖𝐾modulosubscript1subscript𝜀spreadsubscript𝑣1𝑣𝑆𝐾𝑘V_{k}=\Big{\{}\,i\in\{1,\dots,n\}\ \Big{|}\ \Big{\lceil}\log_{1-\varepsilon_{% \textnormal{spread}}}\frac{v_{1}}{v_{i}}\Big{\rceil}+K-\Big{(}\Big{\lceil}\log% _{1-\varepsilon_{\textnormal{spread}}}\frac{v_{1}}{v(S)}\Big{\rceil}\bmod{K}% \Big{)}=k\,\Big{\}}italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = { italic_i ∈ { 1 , … , italic_n } | ⌈ roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT divide start_ARG italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT end_ARG start_ARG italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG ⌉ + italic_K - ( ⌈ roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT divide start_ARG italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT end_ARG start_ARG italic_v ( italic_S ) end_ARG ⌉ roman_mod italic_K ) = italic_k }

for every integer index k𝑘kitalic_k, with K=log1εspreadεpaltry+1𝐾subscript1subscript𝜀spreadsubscript𝜀paltry1K=\big{\lceil}\log_{1-\varepsilon_{\textnormal{spread}}}\varepsilon_{% \textnormal{paltry}}\big{\rceil}+1italic_K = ⌈ roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ⌉ + 1 being a constant for any parameter ε𝜀\varepsilonitalic_ε.

Claim 1.

These classes are constructed such that they simultaneously satisfy the following four properties, which are straightforward to verify and will prove crucial later on.

  1. 1.

    Each class contains only items whose values lie within an interval spanning a factor of 1εspread1subscript𝜀spread1-\varepsilon_{\textnormal{spread}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT from the upper to the lower interval end.

  2. 2.

    The value v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT of the first item marks the upper end point of the value interval of the class containing this first item.

  3. 3.

    The first item is contained in one of the classes V1,,VKsubscript𝑉1subscript𝑉𝐾V_{1},\dots,V_{K}italic_V start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_V start_POSTSUBSCRIPT italic_K end_POSTSUBSCRIPT.

  4. 4.

    The index of the class whose interval contains the optimal solution value v(S)𝑣𝑆v(S)italic_v ( italic_S ) is a multiple of K𝐾Kitalic_K.

Proof 5.11.

For the first property, it we observe that the item value visubscript𝑣𝑖v_{i}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT only occurs once in the entire definition of Vksubscript𝑉𝑘V_{k}italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, namely within the first summand log1εspread(v1/vi)subscript1subscript𝜀spreadsubscript𝑣1subscript𝑣𝑖\lceil\log_{1-\varepsilon_{\textnormal{spread}}}(v_{1}/v_{i})\rceil⌈ roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT ( italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT / italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ⌉ as a factor in the argument of the logarithm. Since log1εspread(v1/vi)=(log1εspreadv1)log1εspreadvisubscript1subscript𝜀spreadsubscript𝑣1subscript𝑣𝑖subscript1subscript𝜀spreadsubscript𝑣1subscript1subscript𝜀spreadsubscript𝑣𝑖\log_{1-\varepsilon_{\textnormal{spread}}}(v_{1}/v_{i})=(\log_{1-\varepsilon_{% \textnormal{spread}}}v_{1})-\log_{1-\varepsilon_{\textnormal{spread}}}v_{i}roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT ( italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT / italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) = ( roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) - roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, this term decreases by 1111 if visubscript𝑣𝑖v_{i}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is replaced by vi=vi(1εspread)superscriptsubscript𝑣𝑖normal-′subscript𝑣𝑖1subscript𝜀spreadv_{i}^{\prime}=v_{i}(1-\varepsilon_{\textnormal{spread}})italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ). Thus the values of items in any given class can span factor of up to 1εspread1subscript𝜀spread1-\varepsilon_{\textnormal{spread}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT but never more.

To verify the second property, we observe that log1εspread(v1/vi)subscript1subscript𝜀spreadsubscript𝑣1subscript𝑣𝑖\log_{1-\varepsilon_{\textnormal{spread}}}(v_{1}/v_{i})roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT ( italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT / italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) is zero for vi=v1subscript𝑣𝑖subscript𝑣1v_{i}=v_{1}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT but positive whenever vi>v1subscript𝑣𝑖subscript𝑣1v_{i}>v_{1}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT > italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and thus v1/vi<1subscript𝑣1subscript𝑣𝑖1v_{1}/v_{i}<1italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT / italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT < 1. Note that the logarithm base 1εspread1subscript𝜀spread1-\varepsilon_{\textnormal{spread}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT is smaller than 1111.

The third property follows again due to the first summand vanishing for vi=v1subscript𝑣𝑖subscript𝑣1v_{i}=v_{1}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. This leaves the class index k𝑘kitalic_k equal to 0+Kj0𝐾𝑗0+K-j0 + italic_K - italic_j, where j=log1εspread(v1/v(S))𝑗subscript1subscript𝜀spreadsubscript𝑣1𝑣𝑆j=\lceil\log_{1-\varepsilon_{\textnormal{spread}}}(v_{1}/v(S))\rceilitalic_j = ⌈ roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT ( italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT / italic_v ( italic_S ) ) ⌉ is an integer taken modulo K𝐾Kitalic_K, meaning that we have j{0,1,,K1}𝑗01normal-…𝐾1j\in\{0,1,\dots,K-1\}italic_j ∈ { 0 , 1 , … , italic_K - 1 } and thus k{1,,K}𝑘1normal-…𝐾k\in\{1,\dots,K\}italic_k ∈ { 1 , … , italic_K }.

Finally, for the fourth and last property, it suffices to set vi=v(S)subscript𝑣𝑖𝑣𝑆v_{i}=v(S)italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_v ( italic_S ) and see that the minuend becomes identical to the first summand, except for being taken modulo K𝐾Kitalic_K, meaning that they combine to a multiple of K𝐾Kitalic_K.

For every k{0,,K1}𝑘0𝐾1k\in\{0,\dots,K-1\}italic_k ∈ { 0 , … , italic_K - 1 }, we define the modulo class Mk=j=VjKksubscript𝑀𝑘superscriptsubscript𝑗subscript𝑉𝑗𝐾𝑘M_{k}=\bigcup_{j=-\infty}^{\infty}V_{jK-k}italic_M start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = ⋃ start_POSTSUBSCRIPT italic_j = - ∞ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_V start_POSTSUBSCRIPT italic_j italic_K - italic_k end_POSTSUBSCRIPT, consisting of every K𝐾Kitalic_Kth class. There are exactly K𝐾Kitalic_K distinct modulo classes, namely M0,M1,,MK1subscript𝑀0subscript𝑀1subscript𝑀𝐾1M_{0},M_{1},\dots,M_{K-1}italic_M start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_M start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_M start_POSTSUBSCRIPT italic_K - 1 end_POSTSUBSCRIPT; each corresponds to one of the possible values of the modulo term in the definition of Vksubscript𝑉𝑘V_{k}italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT. We could also have defined Mksubscript𝑀𝑘M_{k}italic_M start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT as j=VjK+ksuperscriptsubscript𝑗subscript𝑉𝑗𝐾𝑘\bigcup_{j=-\infty}^{\infty}V_{jK+k}⋃ start_POSTSUBSCRIPT italic_j = - ∞ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_V start_POSTSUBSCRIPT italic_j italic_K + italic_k end_POSTSUBSCRIPT, but using VjKksubscript𝑉𝑗𝐾𝑘V_{jK-k}italic_V start_POSTSUBSCRIPT italic_j italic_K - italic_k end_POSTSUBSCRIPT instead of VjK+ksubscript𝑉𝑗𝐾𝑘V_{jK+k}italic_V start_POSTSUBSCRIPT italic_j italic_K + italic_k end_POSTSUBSCRIPT will turn out to be more convenient later on.

Beside the K𝐾Kitalic_K modulo classes we define an infinite number of comboclasses. For every integer k𝑘kitalic_k, comboclass Wk=j=0K1VkKjsubscript𝑊𝑘superscriptsubscript𝑗0𝐾1subscript𝑉𝑘𝐾𝑗W_{k}=\bigcup_{j=0}^{K-1}V_{kK-j}italic_W start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = ⋃ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_K - 1 end_POSTSUPERSCRIPT italic_V start_POSTSUBSCRIPT italic_k italic_K - italic_j end_POSTSUBSCRIPT comprises K𝐾Kitalic_K consecutive classes. This definition is again optimized for notational convenience in the remainder of this paper, which is also the reason for including into definition of Vksubscript𝑉𝑘V_{k}italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT the middle summand K𝐾Kitalic_K. For example, we can now reformulate the third and fourth property more succinctly as follows: Item 1111 is contained comboclass W1subscript𝑊1W_{1}italic_W start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, and v(S)𝑣𝑆v(S)italic_v ( italic_S ) belongs to modulo class M0subscript𝑀0M_{0}italic_M start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT.

For any item i𝑖iitalic_i, we write V(i)𝑉𝑖V(i)italic_V ( italic_i ), M(i)𝑀𝑖M(i)italic_M ( italic_i ), and W(i)𝑊𝑖W(i)italic_W ( italic_i ) to indicate the class, modulo class, and comboclass in which item i𝑖iitalic_i lies. Thus, V(i)𝑉𝑖V(i)italic_V ( italic_i ) is the integer k𝑘kitalic_k such that iVk𝑖subscript𝑉𝑘i\in V_{k}italic_i ∈ italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, analogously W(i)𝑊𝑖W(i)italic_W ( italic_i ) is the integer k𝑘kitalic_k satisfying iWk𝑖subscript𝑊𝑘i\in W_{k}italic_i ∈ italic_W start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, and finally M(i)𝑀𝑖M(i)italic_M ( italic_i ) is the integer k𝑘kitalic_k satisfying iMk𝑖subscript𝑀𝑘i\in M_{k}italic_i ∈ italic_M start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT. Note that by their definitions these three terms satisfy the general relation V(i)=W(i)KM(i)𝑉𝑖𝑊𝑖𝐾𝑀𝑖V(i)=W(i)\cdot K-M(i)italic_V ( italic_i ) = italic_W ( italic_i ) ⋅ italic_K - italic_M ( italic_i ) for any item i𝑖iitalic_i.

An item can be at most as valuable as the entire optimal solution. The comboclass that would contain such a potential item, namely the one with index W(v(S))𝑊𝑣𝑆W(v(S))italic_W ( italic_v ( italic_S ) ), is called precious. The K𝐾Kitalic_K classes comprising the precious comboclass and all the items contained in it are called precious as well. The remaining items are called paltry. In the natural way, we denote the sets of precious and paltry items by Vprecioussubscript𝑉preciousV_{\textnormal{precious}}italic_V start_POSTSUBSCRIPT precious end_POSTSUBSCRIPT and Vpaltrysubscript𝑉paltryV_{\textnormal{paltry}}italic_V start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT, respectively.

We now refer to Figure 4, which illustrates the value ranges of the classes, comboclasses, and modulo classes and shows which are considered paltry and precious, respectively. The notions of provenly paltry and presumably precious, which also appear in this figure, will only be defined during the discussion of the so-called level system further down.

Using Figure 4, it is also simple to verify the following. The highest class that could contain any paltry item is V(W(v(S))1)Ksubscript𝑉𝑊𝑣𝑆1𝐾V_{(W(v(S))-1)K}italic_V start_POSTSUBSCRIPT ( italic_W ( italic_v ( italic_S ) ) - 1 ) italic_K end_POSTSUBSCRIPT, and it is separated from VW(v(S))Ksubscript𝑉𝑊𝑣𝑆𝐾V_{W(v(S))K}italic_V start_POSTSUBSCRIPT italic_W ( italic_v ( italic_S ) ) italic_K end_POSTSUBSCRIPT, whose value range contains v(S)𝑣𝑆v(S)italic_v ( italic_S ), by K1𝐾1K-1italic_K - 1 classes. Since the value range of each of these classes spans a factor of 1εspread1subscript𝜀spread1-\varepsilon_{\textnormal{spread}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT, it follows that any paltry item is worth less than (1εspread)K1v(S)εpaltryv(S)superscript1subscript𝜀spread𝐾1𝑣𝑆subscript𝜀paltry𝑣𝑆(1-\varepsilon_{\textnormal{spread}})^{K-1}v(S)\leq\varepsilon_{\textnormal{% paltry}}v(S)( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_K - 1 end_POSTSUPERSCRIPT italic_v ( italic_S ) ≤ italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT italic_v ( italic_S ), where the inequality holds by the definition of K𝐾Kitalic_K. This fact will be used later on.

We denote by u1<<umsubscript𝑢1subscript𝑢𝑚u_{1}<\ldots<u_{m}italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT < … < italic_u start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT the precious items appearing in the optimal solution S𝑆Sitalic_S in the order as they are presented during the given instance. These items partition the paltry items Vpaltrysubscript𝑉paltryV_{\textnormal{paltry}}italic_V start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT into m+1𝑚1m+1italic_m + 1 subclasses, depending on their relative appearance time: For j{0,,m}𝑗0𝑚j\in\{0,\dots,m\}italic_j ∈ { 0 , … , italic_m }, we let Vpaltry,j={iVpaltryuj<i<uj+1}subscript𝑉paltry𝑗conditional-set𝑖subscript𝑉paltrysubscript𝑢𝑗𝑖subscript𝑢𝑗1V_{\textnormal{paltry},j}=\{\,i\in V_{\textnormal{paltry}}\mid u_{j}<i<u_{j+1}\,\}italic_V start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT = { italic_i ∈ italic_V start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ∣ italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT < italic_i < italic_u start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT } denote the paltry items appearing after ujsubscript𝑢𝑗u_{j}italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT and before uj+1subscript𝑢𝑗1u_{j+1}italic_u start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT, where we use the auxiliary definitions u0=0subscript𝑢00u_{0}=0italic_u start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 0 and um+1=n+1subscript𝑢𝑚1𝑛1u_{m+1}=n+1italic_u start_POSTSUBSCRIPT italic_m + 1 end_POSTSUBSCRIPT = italic_n + 1 for two valueless items for notational convenience.

Finally, we partition the items— independently of the distinction between paltry and precious—into the big ones of size at least εsmallsubscript𝜀small\varepsilon_{\textnormal{small}}italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, denoted by Vbigsubscript𝑉bigV_{\textnormal{big}}italic_V start_POSTSUBSCRIPT big end_POSTSUBSCRIPT, and the small ones below this threshold, denoted by Vsmallsubscript𝑉smallV_{\textnormal{small}}italic_V start_POSTSUBSCRIPT small end_POSTSUBSCRIPT.

Advice Content

In analogy to the proof of Theorem 4.15 for the proportional problem variant, where it is sufficient to define a finite number of instance-independent, size-based classes, we would like for the oracle to communicate through its advice the class of each precious item in the optimal solution S𝑆Sitalic_S in appearance order. This is impossible, however, since the number of classes is unbounded this time around. Instead, we restrict ourselves to conveying the information merely modulo the constant K𝐾Kitalic_K. We do so by encoding modulo classes—of which there are only finitely many—for all precious items into a tuple (M(u1),,M(um))𝑀subscript𝑢1𝑀subscript𝑢𝑚(M(u_{1}),\dots,M(u_{m}))( italic_M ( italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) , … , italic_M ( italic_u start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ) ).

In addition, the advice tells the algorithm into which modulo class the first item of the instance is falling; that is, it encodes M(1)𝑀1M(1)italic_M ( 1 ).

Furthermore, for every j{0,1,,m}𝑗01𝑚j\in\{0,1,\dots,m\}italic_j ∈ { 0 , 1 , … , italic_m }, the oracle encodes v(SVpaltry,j)/v(S)εroundsubscript𝑣𝑆subscript𝑉paltry𝑗𝑣𝑆subscript𝜀round\lfloor v(S\cap V_{\textnormal{paltry},j})/v(S)\rfloor_{\varepsilon_{% \textnormal{round}}}⌊ italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT ) / italic_v ( italic_S ) ⌋ start_POSTSUBSCRIPT italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT end_POSTSUBSCRIPT for some sufficiently small εround>0subscript𝜀round0\varepsilon_{\textnormal{round}}>0italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT > 0; this is the fraction of the optimal solution value that is due to paltry items appearing in the instance after ujsubscript𝑢𝑗u_{j}italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT but before uj+1subscript𝑢𝑗1u_{j+1}italic_u start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT, rounded down to the nearest multiple of εroundsubscript𝜀round\varepsilon_{\textnormal{round}}italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT. We denote this fraction by fjsubscript𝑓𝑗f_{j}italic_f start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT.

There is also one special advice bit bsmallsubscript𝑏smallb_{\textnormal{small}}italic_b start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, telling the algorithm whether packing only paltry items yields a (1εsmall)1subscript𝜀small(1-\varepsilon_{\textnormal{small}})( 1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT )-competitive solution.

The advice described so far is everything needed for the virtual version of our algorithm to work. The actual algorithm makes use of the following additional advice, which depends on the online output of the virtual version: For every j{1,,m}𝑗1𝑚j\in\{1,\dots,m\}italic_j ∈ { 1 , … , italic_m }, the advice contains a tuple aj=(aj,1,aj,2,,aj,mj)subscript𝑎𝑗subscript𝑎𝑗1subscript𝑎𝑗2subscript𝑎𝑗subscript𝑚𝑗a_{j}=(a_{j,1},a_{j,2},\dots,a_{j,m_{j}})italic_a start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT = ( italic_a start_POSTSUBSCRIPT italic_j , 1 end_POSTSUBSCRIPT , italic_a start_POSTSUBSCRIPT italic_j , 2 end_POSTSUBSCRIPT , … , italic_a start_POSTSUBSCRIPT italic_j , italic_m start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT end_POSTSUBSCRIPT ) of numbers from {0,1,2,,m}012𝑚\{0,1,2,\dots,m\}{ 0 , 1 , 2 , … , italic_m }. Here, the numbers 1,2,,m12𝑚1,2,\dots,m1 , 2 , … , italic_m are the indices of the m𝑚mitalic_m slots used by the algorithm for storing precious items. The number 00 is taken as the index of the splitting slot. The numbers of the tuple ajsubscript𝑎𝑗a_{j}italic_a start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT are determined by what the virtual algorithm does with the items appearing in phase j𝑗jitalic_j. More precisely, it only matters what the algorithm does with those items that will be part of the eventual virtual solution Ssuperscript𝑆S^{\prime}italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, excluding the one item remaining in the splitting slot in the end. If there are no such items during phase j𝑗jitalic_j, then the tuple ajsubscript𝑎𝑗a_{j}italic_a start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is empty. Otherwise, consider the first such item of phase j𝑗jitalic_j. It will be part of the eventual solution Ssuperscript𝑆S^{\prime}italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, meaning that must be packed by the virtual algorithm upon appearance. The first number of the tuple ajsubscript𝑎𝑗a_{j}italic_a start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT indicates the slot into which this item is stored, namely slot aj,1subscript𝑎𝑗1a_{j,1}italic_a start_POSTSUBSCRIPT italic_j , 1 end_POSTSUBSCRIPT. The next number of the tuple is analogously determined by the next item that is packed during phase j𝑗jitalic_j and a full part of the eventual virtual solution, and so on. In summary, tuple ajsubscript𝑎𝑗a_{j}italic_a start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT contains the indices of the slots filled during phase j𝑗jitalic_j with items that will be a complete part of the eventual virtual solution, and the indices are sorted in the order these slots were filled with said items.

Constant Advice

We prove that a constant amount of advice suffices to encode the information just described.

We assume without loss of generality that the following, separately discussed pieces of information are combined into the advice string in such a way that they can be unambiguously retrieved. This is achieved by means of a suitable self-delimiting encoding that increases the advice length by at most a constant factor.

The number m𝑚mitalic_m of precious items in the optimal solution, and thus also in the virtual solution, is bounded from above by the constant 1/εpaltry1subscript𝜀paltry1/\varepsilon_{\textnormal{paltry}}1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT since every precious item is worth at least εpaltryv(S)subscript𝜀paltry𝑣𝑆\varepsilon_{\textnormal{paltry}}\cdot v(S)italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ⋅ italic_v ( italic_S ) and the total value of packed precious items cannot exceed v(S)𝑣𝑆v(S)italic_v ( italic_S ).

There are only constantly many modulo classes, namely K=log1εspreadεpaltry+1𝐾subscript1subscript𝜀spreadsubscript𝜀paltry1K=\big{\lceil}\log_{1-\varepsilon_{\textnormal{spread}}}\varepsilon_{% \textnormal{paltry}}\big{\rceil}+1italic_K = ⌈ roman_log start_POSTSUBSCRIPT 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT end_POSTSUBSCRIPT italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ⌉ + 1; a constant amount of advice therefore suffices to communicate the modulo classes of the m𝑚mitalic_m precious items in the optimal solution and that of the first item of the instance.

For every j{0,1,,m}𝑗01𝑚j\in\{0,1,\dots,m\}italic_j ∈ { 0 , 1 , … , italic_m }, we can encode fjsubscript𝑓𝑗f_{j}italic_f start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT via (1/εround)v(Sk=0jVpaltry,k)/v(S)1subscript𝜀round𝑣𝑆superscriptsubscript𝑘0𝑗subscript𝑉paltry𝑘𝑣𝑆\lfloor(1/\varepsilon_{\textnormal{round}})v(S\cap\bigcup_{k=0}^{j}V_{% \textnormal{paltry},k})/v(S)\rfloor⌊ ( 1 / italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ) italic_v ( italic_S ∩ ⋃ start_POSTSUBSCRIPT italic_k = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT italic_V start_POSTSUBSCRIPT paltry , italic_k end_POSTSUBSCRIPT ) / italic_v ( italic_S ) ⌋; this is the fraction to be approximated divided by εroundsubscript𝜀round\varepsilon_{\textnormal{round}}italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT and rounded down to the nearest integer. These integers are clearly bounded by the constant 1/εround1subscript𝜀round1/\varepsilon_{\textnormal{round}}1 / italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT. Since both 1/εround1subscript𝜀round1/\varepsilon_{\textnormal{round}}1 / italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT and m𝑚mitalic_m are constants, this information is also encodable within a constant amount of advice.

Finally, there are the m+1𝑚1m+1italic_m + 1 tuples a0,a1,,amsubscript𝑎0subscript𝑎1subscript𝑎𝑚a_{0},a_{1},\dots,a_{m}italic_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_a start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT, each containing at most m+1𝑚1m+1italic_m + 1 numbers ranging from 00 to m𝑚mitalic_m. A number of advice bits cubic in m𝑚mitalic_m, but still constant for any given parameter ε𝜀\varepsilonitalic_ε, is enough to store this information too.

Algorithm Description

A Single Special Switch.

As a first simple special case, we consider what the algorithm does when the bit bsmallsubscript𝑏smallb_{\textnormal{small}}italic_b start_POSTSUBSCRIPT small end_POSTSUBSCRIPT is set to 1111, meaning that packing only paltry items in a yield-greedy fashion would lead to a 1/(1εsmall)11subscript𝜀small1/(1-\varepsilon_{\textnormal{small}})1 / ( 1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT )-competitive solution. In this case, the algorithm does not directly implement this strategy—being unsure what items are in fact paltry, it is in fact unable to do so—but instead runs a yield-greedy strategy on the small items, discarding any big item without consideration. When analyzing the algorithm later on, we will show that this still secures a solution of sufficient value.

For the remainder of this description, we assume that the switch bsmallsubscript𝑏smallb_{\textnormal{small}}italic_b start_POSTSUBSCRIPT small end_POSTSUBSCRIPT is set to zero.

Computing the Classes.

Immediately after seeing the first item, the algorithm uses the advice-given information about the modulo class of this item and the fact that its value v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT lies right at the upper end of the value interval of its class to reconstruct the precise value intervals of every class Vksubscript𝑉𝑘V_{k}italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT. This is possible thanks to the four properties of these value classes already proved above:

Once the exact value range covered by the class containing the first item is known to the algorithm, the first property can be used to achieve the same for all other classes. The remaining three properties help the algorithm retrieve all information about the value interval of the class of the first item. The second property fixes the upper end of this interval to v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. The third property tells us that v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is contained in one of the classes V1,V2,,VKsubscript𝑉1subscript𝑉2subscript𝑉𝐾V_{1},V_{2},\dots,V_{K}italic_V start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_V start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_V start_POSTSUBSCRIPT italic_K end_POSTSUBSCRIPT of comboclass W1subscript𝑊1W_{1}italic_W start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. The fourth property determines which of these K𝐾Kitalic_K classes it is by fixing the modulo class of v(S)𝑣𝑆v(S)italic_v ( italic_S ) and thus also the one of v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT, which is included in the advice given to the algorithm.

As a consequence, the algorithm is able to compute V(i)𝑉𝑖V(i)italic_V ( italic_i ), M(i)𝑀𝑖M(i)italic_M ( italic_i ), and W(i)𝑊𝑖W(i)italic_W ( italic_i ) for any item i𝑖iitalic_i of the instance as soon as it appears. We emphasize that, nevertheless, it is still unable to tell for sure whether an item is precious or paltry as long as the instance has not ended. Instead, the algorithm partitions the items seen so far into presumably precious and provenly paltry ones. This partition may change over time and is based on the following level system.

The Level System.

At any time, there is exactly one comboclass considered presumably precious; all lower comboclasses are provenly paltry. The designation as presumably precious or provenly paltry is naturally inherited by the classes and items contained in a comboclass. For every integer \ellroman_ℓ, we say that the algorithm is at level \ellroman_ℓ if Wsubscript𝑊W_{\ell}italic_W start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT is the presumably precious comboclass at this moment. The algorithm starts at level 1111, which means that the comboclass containing the first item of the instance is considered presumably precious in the beginning. While processing its input, the algorithm may level up many times, but the level is never decreasing: What has been recognized as presumably precious may become provenly paltry at a later point, but never the other way around. There are exactly two events that can trigger the raise to a new level.

  1. 1.

    The first one is the appearance of an item with a value above the value range of the comboclass that is currently seen as presumably precious. In this case, the comboclass containing this new item becomes the presumably precious one.

  2. 2.

    The algorithm might also be triggered into leveling up by the arrival of a provenly paltry item, but only under certain conditions. Namely, the algorithm is always kee** track of what the optimal solution value achievable with the items presented so far, including the rejected ones, would have been. This only hypothetically realizable value is continually compared against some upper estimate Usubscript𝑈U_{\ell}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT for the optimal solution value v(S)𝑣𝑆v(S)italic_v ( italic_S ); the exact estimate is explained and examined in the next subsection. As soon as the estimate Usubscript𝑈U_{\ell}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT for v(S)𝑣𝑆v(S)italic_v ( italic_S ) is exceeded by the hypothetically achievable solution value, the algorithm enters the next level: The presumably precious comboclass becomes provenly paltry and the comboclass immediately above it becomes the new presumably precious one.

We will explain the precise purpose for employing exactly these two triggers when analyzing the competitive ratio of the algorithm. Essentially, the first one protects precious items from being discarded due to procrastinated level changes, while the second trigger’s paramount duty is to prevent too many paltry items from being misjudged as precious, which can also lead to them being unduly discarded.

Each of the two triggers alone would already ensure that the algorithm eventually reaches a level such that the presumably precious comboclass is in fact the precious one. We call the level for which this happens the final level and refer to all previous ones as the lost levels for a reason that will become clear later on.

Estimating the Optimal Solution Value.

The upper estimate for v(S)𝑣𝑆v(S)italic_v ( italic_S ) mentioned before is

U=v1j=1m(1εspread)V(1)+M(uj)K/(1εround(1+1/εpaltry)p=0mfp),subscript𝑈subscript𝑣1superscriptsubscript𝑗1𝑚superscript1subscript𝜀spread𝑉1𝑀subscript𝑢𝑗𝐾1subscript𝜀round11subscript𝜀paltrysuperscriptsubscript𝑝0𝑚subscript𝑓𝑝U_{\ell}=v_{1}\sum_{j=1}^{m}(1-\varepsilon_{\textnormal{spread}})^{V(1)+M(u_{j% })-\ell K}/(1-\varepsilon_{\textnormal{round}}(1+1/\varepsilon_{\textnormal{% paltry}})-\sum_{p=0}^{m}f_{p}),italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT = italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_V ( 1 ) + italic_M ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) - roman_ℓ italic_K end_POSTSUPERSCRIPT / ( 1 - italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) - ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ) ,

where \ellroman_ℓ is the index of the comboclass currently considered presumably precious by the algorithm. The modulo class index M(uj)𝑀subscript𝑢𝑗M(u_{j})italic_M ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ), the class index V(1)𝑉1V(1)italic_V ( 1 ), and the rounded fractions fp=v(SVpaltry,p)/v(S)εroundsubscript𝑓𝑝subscript𝑣𝑆subscript𝑉paltry𝑝𝑣𝑆subscript𝜀roundf_{p}=\lfloor v(S\cap V_{\textnormal{paltry},p})/v(S)\rfloor_{\varepsilon_{% \textnormal{round}}}italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT = ⌊ italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT ) / italic_v ( italic_S ) ⌋ start_POSTSUBSCRIPT italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT end_POSTSUBSCRIPT of the optimal solution value contributed by paltry items from phase p𝑝pitalic_p are all retrieved from the advice. When calculating the estimate above, the algorithm assumes to have reached its final level; that is, it operates under the assumption that the presumably precious comboclass Wsubscript𝑊W_{\ell}italic_W start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT is in fact the precious one. Under this assumption, Usubscript𝑈U_{\ell}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT is indeed a valid upper estimate for v(S)𝑣𝑆v(S)italic_v ( italic_S ) as we will show now.

We have v(S)=v(SVprecious)+v(SVpaltry)𝑣𝑆𝑣𝑆subscript𝑉precious𝑣𝑆subscript𝑉paltryv(S)=v(S\cap V_{\textnormal{precious}})+v(S\cap V_{\textnormal{paltry}})italic_v ( italic_S ) = italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT precious end_POSTSUBSCRIPT ) + italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) and begin by analyzing the first of the two summands. It is the value contributed to the optimal solution by the m𝑚mitalic_m precious items contained in it. The algorithm can use the information about the modulo classes of these m𝑚mitalic_m items to place the value of each of them into an interval spanning a factor of 1εspread1subscript𝜀spread1-\varepsilon_{\textnormal{spread}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT. Specifically, we start with the already established general relation V(i)=W(i)KM(i)𝑉𝑖𝑊𝑖𝐾𝑀𝑖V(i)=W(i)K-M(i)italic_V ( italic_i ) = italic_W ( italic_i ) italic_K - italic_M ( italic_i ), apply it to i=uj𝑖subscript𝑢𝑗i=u_{j}italic_i = italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, and use the assumption W(uj)=𝑊subscript𝑢𝑗W(u_{j})=\ellitalic_W ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) = roman_ℓ of the current comboclass being the precious one to obtain V(uj)=KM(uj)𝑉subscript𝑢𝑗𝐾𝑀subscript𝑢𝑗V(u_{j})=\ell K-M(u_{j})italic_V ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) = roman_ℓ italic_K - italic_M ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ). Since v1subscript𝑣1v_{1}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT lies at the upper endpoint of class V(1)𝑉1V(1)italic_V ( 1 ), we can compute the upper end of the value range of class V(uj)𝑉subscript𝑢𝑗V(u_{j})italic_V ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) as v1/(1εspread)V(uj)V(1)=v1(1εspread)V(1)+M(uj)Ksubscript𝑣1superscript1subscript𝜀spread𝑉subscript𝑢𝑗𝑉1subscript𝑣1superscript1subscript𝜀spread𝑉1𝑀subscript𝑢𝑗𝐾v_{1}/(1-\varepsilon_{\textnormal{spread}})^{V(u_{j})-V(1)}=v_{1}(1-% \varepsilon_{\textnormal{spread}})^{V(1)+M(u_{j})-\ell K}italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT / ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_V ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) - italic_V ( 1 ) end_POSTSUPERSCRIPT = italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_V ( 1 ) + italic_M ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) - roman_ℓ italic_K end_POSTSUPERSCRIPT precisely. Note that the given advice and the value of the first item are in tandem indeed sufficient to calculate this number. It is an upper bound on v(uj)𝑣subscript𝑢𝑗v(u_{j})italic_v ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) such that the true value cannot be smaller than a factor 1εspread1subscript𝜀spread1-\varepsilon_{\textnormal{spread}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT of it, provided that the algorithm’s assumption W(uj)=𝑊subscript𝑢𝑗W(u_{j})=\ellitalic_W ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) = roman_ℓ holds true. If the algorithm is mistaken, however—that is, if <W(uj)𝑊subscript𝑢𝑗\ell<W(u_{j})roman_ℓ < italic_W ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT )—then the estimate is far too low; namely, it would be exactly a factor (1εspread)(W(uj))K(1εspread)Ksuperscript1subscript𝜀spread𝑊subscript𝑢𝑗𝐾superscript1subscript𝜀spread𝐾(1-\varepsilon_{\textnormal{spread}})^{(W(u_{j})-\ell)K}\leq(1-\varepsilon_{% \textnormal{spread}})^{K}( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT ( italic_W ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) - roman_ℓ ) italic_K end_POSTSUPERSCRIPT ≤ ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_K end_POSTSUPERSCRIPT of what it otherwise would have been. If the algorithm has not yet reached the final level, the estimate for v(uj)𝑣subscript𝑢𝑗v(u_{j})italic_v ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) is therefore at most a fraction (1εspread)K1εpaltrysuperscript1subscript𝜀spread𝐾1subscript𝜀paltry(1-\varepsilon_{\textnormal{spread}})^{K-1}\leq\varepsilon_{\textnormal{paltry}}( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_K - 1 end_POSTSUPERSCRIPT ≤ italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT of the true value. As mentioned before, the inequality holds by the definition of K𝐾Kitalic_K. All of the assertions above for any single precious item naturally carry over to the sum

t=j=1mv1(1εspread)V(1)+M(uj)K.𝑡superscriptsubscript𝑗1𝑚subscript𝑣1superscript1subscript𝜀spread𝑉1𝑀subscript𝑢𝑗𝐾t=\sum_{j=1}^{m}v_{1}(1-\varepsilon_{\textnormal{spread}})^{V(1)+M(u_{j})-\ell K}.italic_t = ∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_V ( 1 ) + italic_M ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) - roman_ℓ italic_K end_POSTSUPERSCRIPT .

In particular, the total value v(SVprecious)𝑣𝑆subscript𝑉preciousv(S\cap V_{\textnormal{precious}})italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT precious end_POSTSUBSCRIPT ) of all precious items in the fixed optimal solution S𝑆Sitalic_S—the first of the two summands to be examined—lies in the interval [(1εspread)t,t]1subscript𝜀spread𝑡𝑡[(1-\varepsilon_{\textnormal{spread}})t,t][ ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) italic_t , italic_t ] during the final level.

Using the advice information fp=v(SVpaltry,p)/v(S)εroundsubscript𝑓𝑝subscript𝑣𝑆subscript𝑉paltry𝑝𝑣𝑆subscript𝜀roundf_{p}=\lfloor v(S\cap V_{\textnormal{paltry},p})/v(S)\rfloor_{\varepsilon_{% \textnormal{round}}}italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT = ⌊ italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT ) / italic_v ( italic_S ) ⌋ start_POSTSUBSCRIPT italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT end_POSTSUBSCRIPT on the value of the paltry items in the optimal solution appearing during each phase p{0,1,,m}𝑝01𝑚p\in\{0,1,\dots,m\}italic_p ∈ { 0 , 1 , … , italic_m }—given as fractions of the optimal solution value, rounded down to the nearest multiple of εroundsubscript𝜀round\varepsilon_{\textnormal{round}}italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT—the algorithm can narrow down the second summand v(SVpaltry)𝑣𝑆subscript𝑉paltryv(S\cap V_{\textnormal{paltry}})italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) to gv(S)𝑔𝑣𝑆g\cdot v(S)italic_g ⋅ italic_v ( italic_S ) for some factor g[p=0mfp,p=0m(fp+εround)][p=0mfp,εround(1+1/εpaltry)+p=0mfp]𝑔superscriptsubscript𝑝0𝑚subscript𝑓𝑝superscriptsubscript𝑝0𝑚subscript𝑓𝑝subscript𝜀roundsuperscriptsubscript𝑝0𝑚subscript𝑓𝑝subscript𝜀round11subscript𝜀paltrysuperscriptsubscript𝑝0𝑚subscript𝑓𝑝g\in[\sum_{p=0}^{m}f_{p},\sum_{p=0}^{m}(f_{p}+\varepsilon_{\textnormal{round}}% )]\subseteq[\sum_{p=0}^{m}f_{p},\varepsilon_{\textnormal{round}}(1+1/% \varepsilon_{\textnormal{paltry}})+\sum_{p=0}^{m}f_{p}]italic_g ∈ [ ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT , ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT ( italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT + italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ) ] ⊆ [ ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT , italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) + ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ], where we have used once more the bound m1/εpaltry𝑚1subscript𝜀paltrym\leq 1/\varepsilon_{\textnormal{paltry}}italic_m ≤ 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT, derived via the total value of all precious items. Together with the bounds found for the first summand in the previous paragraph we obtain the following two inequalities, in which the optimal solution value v(S)𝑣𝑆v(S)italic_v ( italic_S ) occurs three times:

(1εspread)t+v(S)p=0mfpv(S)t+v(S)(εround(1+1/εpaltry)+p=0mfp).1subscript𝜀spread𝑡𝑣𝑆superscriptsubscript𝑝0𝑚subscript𝑓𝑝𝑣𝑆𝑡𝑣𝑆subscript𝜀round11subscript𝜀paltrysuperscriptsubscript𝑝0𝑚subscript𝑓𝑝(1-\varepsilon_{\textnormal{spread}})t+v(S)\sum_{p=0}^{m}f_{p}\leq v(S)\leq t+% v(S)\big{(}\varepsilon_{\textnormal{round}}(1+1/\varepsilon_{\textnormal{% paltry}})+\sum_{p=0}^{m}f_{p}\big{)}.( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) italic_t + italic_v ( italic_S ) ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ≤ italic_v ( italic_S ) ≤ italic_t + italic_v ( italic_S ) ( italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) + ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ) .

From this we obtain for v(S)𝑣𝑆v(S)italic_v ( italic_S ) a lower bound of L=(1εspread)t/(1p=0mfp)subscript𝐿1subscript𝜀spread𝑡1superscriptsubscript𝑝0𝑚subscript𝑓𝑝L_{\ell}=(1-\varepsilon_{\textnormal{spread}})t/(1-\sum_{p=0}^{m}f_{p})italic_L start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT = ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) italic_t / ( 1 - ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ) and the presumed upper bound U=t/(1εround(1+1/εpaltry)p=0mfp)subscript𝑈𝑡1subscript𝜀round11subscript𝜀paltrysuperscriptsubscript𝑝0𝑚subscript𝑓𝑝U_{\ell}=t/(1-\varepsilon_{\textnormal{round}}(1+1/\varepsilon_{\textnormal{% paltry}})-\sum_{p=0}^{m}f_{p})italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT = italic_t / ( 1 - italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) - ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ), which is an actual upper bound only during the last level. The upper and lower bound lie a factor

UL=subscript𝑈subscript𝐿absent\displaystyle\frac{U_{\ell}}{L_{\ell}}={}divide start_ARG italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT end_ARG start_ARG italic_L start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT end_ARG = 1p=0mfp(1εspread)(1εround(1+1/εpaltry)p=0mfp)1superscriptsubscript𝑝0𝑚subscript𝑓𝑝1subscript𝜀spread1subscript𝜀round11subscript𝜀paltrysuperscriptsubscript𝑝0𝑚subscript𝑓𝑝\displaystyle\frac{1-\sum_{p=0}^{m}f_{p}}{(1-\varepsilon_{\textnormal{spread}}% )(1-\varepsilon_{\textnormal{round}}(1+1/\varepsilon_{\textnormal{paltry}})-% \sum_{p=0}^{m}f_{p})}divide start_ARG 1 - ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT end_ARG start_ARG ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) ( 1 - italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) - ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ) end_ARG
\displaystyle\leq{} 1p=0mfp1εspreadεround(1+1/εpaltry)p=0mfp1superscriptsubscript𝑝0𝑚subscript𝑓𝑝1subscript𝜀spreadsubscript𝜀round11subscript𝜀paltrysuperscriptsubscript𝑝0𝑚subscript𝑓𝑝\displaystyle\frac{1-\sum_{p=0}^{m}f_{p}}{1-\varepsilon_{\textnormal{spread}}-% \varepsilon_{\textnormal{round}}(1+1/\varepsilon_{\textnormal{paltry}})-\sum_{% p=0}^{m}f_{p}}divide start_ARG 1 - ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT end_ARG start_ARG 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) - ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT end_ARG
=\displaystyle={}= 1+εspread+εround(1+1/εpaltry)1εspreadεround(1+1/εpaltry)p=0mfp1subscript𝜀spreadsubscript𝜀round11subscript𝜀paltry1subscript𝜀spreadsubscript𝜀round11subscript𝜀paltrysuperscriptsubscript𝑝0𝑚subscript𝑓𝑝\displaystyle 1+\frac{\varepsilon_{\textnormal{spread}}+\varepsilon_{% \textnormal{round}}(1+1/\varepsilon_{\textnormal{paltry}})}{1-\varepsilon_{% \textnormal{spread}}-\varepsilon_{\textnormal{round}}(1+1/\varepsilon_{% \textnormal{paltry}})-\sum_{p=0}^{m}f_{p}}1 + divide start_ARG italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT + italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) end_ARG start_ARG 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) - ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT end_ARG

apart. Note that this quotient no longer depends on \ellroman_ℓ. Furthermore,we may assume that p=0mfp<1εsmall+εpaltrysuperscriptsubscript𝑝0𝑚subscript𝑓𝑝1subscript𝜀smallsubscript𝜀paltry\sum_{p=0}^{m}f_{p}<1-\varepsilon_{\textnormal{small}}+\varepsilon_{% \textnormal{paltry}}∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT < 1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT + italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT. This is because otherwise the algorithm could attain a fraction p=0mfpεpaltry1εsmallsuperscriptsubscript𝑝0𝑚subscript𝑓𝑝subscript𝜀paltry1subscript𝜀small\sum_{p=0}^{m}f_{p}-\varepsilon_{\textnormal{paltry}}\geq 1-\varepsilon_{% \textnormal{small}}∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ≥ 1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT of the optimal solution value by packing paltry items exclusively in an otherwise purely yield-greedy manner uninhibited by any value limit; this special case is covered by the dedicated advice bit bsmallsubscript𝑏smallb_{\textnormal{small}}italic_b start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, which, when set to 1111, switches the restrictions applied to the algorithm’s yield-greedy approach from a value limit to a size limit, as already explained at the beginning of this proof. We can therefore use 1p=0mfp>εsmallεpaltry1superscriptsubscript𝑝0𝑚subscript𝑓𝑝subscript𝜀smallsubscript𝜀paltry1-\sum_{p=0}^{m}f_{p}>\varepsilon_{\textnormal{small}}-\varepsilon_{% \textnormal{paltry}}1 - ∑ start_POSTSUBSCRIPT italic_p = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT > italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT to obtain

ULsubscript𝑈subscript𝐿absent\displaystyle\frac{U_{\ell}}{L_{\ell}}\leq{}divide start_ARG italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT end_ARG start_ARG italic_L start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT end_ARG ≤ 1+εspread+εround(1+1/εpaltry)εsmallεpaltryεspreadεround(1+1/εpaltry)1subscript𝜀spreadsubscript𝜀round11subscript𝜀paltrysubscript𝜀smallsubscript𝜀paltrysubscript𝜀spreadsubscript𝜀round11subscript𝜀paltry\displaystyle 1+\frac{\varepsilon_{\textnormal{spread}}+\varepsilon_{% \textnormal{round}}(1+1/\varepsilon_{\textnormal{paltry}})}{\varepsilon_{% \textnormal{small}}-\varepsilon_{\textnormal{paltry}}-\varepsilon_{\textnormal% {spread}}-\varepsilon_{\textnormal{round}}(1+1/\varepsilon_{\textnormal{paltry% }})}1 + divide start_ARG italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT + italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) end_ARG start_ARG italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) end_ARG
=\displaystyle={}= εsmallεpaltryεsmallεpaltryεspreadεround(1+1/εpaltry)subscript𝜀smallsubscript𝜀paltrysubscript𝜀smallsubscript𝜀paltrysubscript𝜀spreadsubscript𝜀round11subscript𝜀paltry\displaystyle\frac{\varepsilon_{\textnormal{small}}-\varepsilon_{\textnormal{% paltry}}}{\varepsilon_{\textnormal{small}}-\varepsilon_{\textnormal{paltry}}-% \varepsilon_{\textnormal{spread}}-\varepsilon_{\textnormal{round}}(1+1/% \varepsilon_{\textnormal{paltry}})}divide start_ARG italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT end_ARG start_ARG italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) end_ARG
and thus
LUsubscript𝐿subscript𝑈absent\displaystyle\frac{L_{\ell}}{U_{\ell}}\geq{}divide start_ARG italic_L start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT end_ARG start_ARG italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT end_ARG ≥ εsmallεpaltryεspreadεround(1+1/εpaltry)εsmallεpaltrysubscript𝜀smallsubscript𝜀paltrysubscript𝜀spreadsubscript𝜀round11subscript𝜀paltrysubscript𝜀smallsubscript𝜀paltry\displaystyle\frac{\varepsilon_{\textnormal{small}}-\varepsilon_{\textnormal{% paltry}}-\varepsilon_{\textnormal{spread}}-\varepsilon_{\textnormal{round}}(1+% 1/\varepsilon_{\textnormal{paltry}})}{\varepsilon_{\textnormal{small}}-% \varepsilon_{\textnormal{paltry}}}divide start_ARG italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) end_ARG start_ARG italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT end_ARG
=\displaystyle={}= 1εspread+εround(1+1/εpaltry)εsmallεpaltry1subscript𝜀spreadsubscript𝜀round11subscript𝜀paltrysubscript𝜀smallsubscript𝜀paltry\displaystyle 1-\frac{\varepsilon_{\textnormal{spread}}+\varepsilon_{% \textnormal{round}}(1+1/\varepsilon_{\textnormal{paltry}})}{\varepsilon_{% \textnormal{small}}-\varepsilon_{\textnormal{paltry}}}1 - divide start_ARG italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT + italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) end_ARG start_ARG italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT end_ARG
\displaystyle\geq{} 12εspread/εsmall,12subscript𝜀spreadsubscript𝜀small\displaystyle 1-2\varepsilon_{\textnormal{spread}}/\varepsilon_{\textnormal{% small}},1 - 2 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ,

where, for the last inequality, we used εspreadεround(1+1/εpaltry)subscript𝜀spreadsubscript𝜀round11subscript𝜀paltry\varepsilon_{\textnormal{spread}}\geq\varepsilon_{\textnormal{round}}(1+1/% \varepsilon_{\textnormal{paltry}})italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ≥ italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ), which is satisfied by our choices of εspread=ε4/ε14subscript𝜀spreadsuperscript𝜀4superscript𝜀14\varepsilon_{\textnormal{spread}}=\varepsilon^{4}/\varepsilon^{14}italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT = italic_ε start_POSTSUPERSCRIPT 4 end_POSTSUPERSCRIPT / italic_ε start_POSTSUPERSCRIPT 14 end_POSTSUPERSCRIPT, εround=ε6/220subscript𝜀roundsuperscript𝜀6superscript220\varepsilon_{\textnormal{round}}=\varepsilon^{6}/2^{20}italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT = italic_ε start_POSTSUPERSCRIPT 6 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 20 end_POSTSUPERSCRIPT, and εpaltry=ε2/25subscript𝜀paltrysuperscript𝜀2superscript25\varepsilon_{\textnormal{paltry}}=\varepsilon^{2}/2^{5}italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT = italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 5 end_POSTSUPERSCRIPT. In other words: During the final level the algorithm’s estimate Usubscript𝑈U_{\ell}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT is indeed an upper bound on v(S)𝑣𝑆v(S)italic_v ( italic_S ) exceeding the real value by at most U2εspread/εsmallsubscript𝑈2subscript𝜀spreadsubscript𝜀smallU_{\ell}\cdot 2\varepsilon_{\textnormal{spread}}/\varepsilon_{\textnormal{% small}}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT ⋅ 2 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT. The algorithm can thus derive from any hypothesized upper bound Usubscript𝑈U_{\ell}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT for v(S)𝑣𝑆v(S)italic_v ( italic_S ) an actual lower bound U(12εspread/εsmall)subscript𝑈12subscript𝜀spreadsubscript𝜀smallU_{\ell}(1-2\varepsilon_{\textnormal{spread}}/\varepsilon_{\textnormal{small}})italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT ( 1 - 2 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ). We will put this insight to use when analyzing the competitive ratio of the algorithm.

The Slot System.

In the precious part of the knapsack, the algorithm uses a slot system to store presumably precious items. There are m𝑚mitalic_m slots, each of which can accommodate one such item, and all of them are empty in the beginning. They will be filled one by one, each with exactly one item. The items in filled slots may also be exchanged at some point. In contrast to what happens in the simpler algorithm for the proportional version of the problem, slots might also be emptied again when the algorithm decides to level up. The second difference is that there are now two stages to filling a slot. Any slot first has to be filled virtually before this filling is actualized at some point. The precise meaning of these two notions is explained later on. The order in which the slots are filled virtually is determined by the modulo classes of the precious items u1,,umsubscript𝑢1subscript𝑢𝑚u_{1},\dots,u_{m}italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_u start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT in the optimal solution: Slot j𝑗jitalic_j must be filled virtually after slots 1111 through j1𝑗1j-1italic_j - 1 and before the other slots. As soon as this condition is met, slot j𝑗jitalic_j is filled virtually with the first matching item, that is, the first item from the same modulo class as ujsubscript𝑢𝑗u_{j}italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. The order in which m𝑚mitalic_m slots receive an actualized filling is encoded in the tuples a0,a1,,amsubscript𝑎0subscript𝑎1subscript𝑎𝑚a_{0},a_{1},\dots,a_{m}italic_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_a start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT given by the advice. A filling may be actualized long after or right when it has happened virtually, just never before that.

When exactly a slot is filled virtually, instead of just in which order, is described in the following paragraph; when exactly the fillings are actualized is explained after the discussion on packing the paltry part of the knapsack.

The Phase Progression.

We say that the algorithm is in phase p𝑝pitalic_p if slot p𝑝pitalic_p has been filled virtually but not yet slot p+1𝑝1p+1italic_p + 1. Since all precious items are discarded when the algorithm is leveling up, all slots are empty again at the start of a new level, implying that the algorithm’s phase is reset to 00 as well. In general, the current phase p𝑝pitalic_p ends as soon as the instance ends or presents a presumably precious item i𝑖iitalic_i satisfying the following two conditions. On the one hand, it is from the same modulo class as upsubscript𝑢𝑝u_{p}italic_u start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT—recall that we can compute M(i)𝑀𝑖M(i)italic_M ( italic_i ) for any given item and know M(up)𝑀subscript𝑢𝑝M(u_{p})italic_M ( italic_u start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ) from the advice. On the other hand, the virtual algorithm can fit it into the precious part of the knapsack beside the items already present in the other slots, even if just virtually, and the packed paltry items, including the currently used fraction of any split item. If both of these conditions are met, said item i𝑖iitalic_i is virtually packed into slot p𝑝pitalic_p. For any other presumably precious item i𝑖iitalic_i, it is first checked whether there are matching slots—that is, slots reserved for items from modulo class M(i)𝑀𝑖M(i)italic_M ( italic_i )—filled with items larger than i𝑖iitalic_i. If this is the case, a largest of these items is evicted, either just virtually or actually, and item i𝑖iitalic_i takes its place. Otherwise, the presumably precious item i𝑖iitalic_i is discarded.

Packing the Paltry Part.

The paltry items in the instance are in principle packed in a yield-greedy manner, that is, optimizing the ratio of value to size on the paltry items. If there were no precious items, this would already guarantee a sufficient approximation to the optimal solution value; we would lose at most the value of a single paltry item. If there are precious items, however, then we need to restrict the reservation of paltry items such that they never block a crucial precious item from filling an empty slot. But too much restriction is bad as well; if we always favor the packing of precious items matching an empty slot over accruing paltry items, then we might discard too many paltry items; after all, it is impossible to give exact bounds on the sizes of the optimal precious items, and the paltry items can be infinitesimally small.

The right type of restriction keeps the total size of the reserved paltry items low enough to allow for filling the next empty slot when the right precious items appears but not more than a constant fraction below the optimal amount. Directly encoding the right volume bound into the advice is impossible, however, since the requisite precision grows indefinitely with decreasing item sizes. Instead, we can limit the value that we should be accumulating in the form of paltry items in each phase. This does not immediately bound the size occupied by these items—we have no knowledge about the necessary yield—but will always do so just in time to fill all regular slots with precious items.

The value goal for each phase is indicated with a precision of εroundsubscript𝜀round\varepsilon_{\textnormal{round}}italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT and always rounded down. Additionally, this value goal is indicated relative to v(S)𝑣𝑆v(S)italic_v ( italic_S ), for which the algorithm has a lower bound Lsubscript𝐿L_{\ell}italic_L start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT that is too small by at most a factor of 2εspread/εsmall2subscript𝜀spreadsubscript𝜀small2\varepsilon_{\textnormal{spread}}/\varepsilon_{\textnormal{small}}2 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT as seen above. Since there are at most 1/εpaltry+11subscript𝜀paltry11/\varepsilon_{\textnormal{paltry}}+11 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT + 1 phases, the value lost due to this rounding can be bounded by

(1/εpaltry+1)(εround+2εspread/εsmall)v(S)(2εround+4εspread/εsmall)v(S)/εpaltry,1subscript𝜀paltry1subscript𝜀round2subscript𝜀spreadsubscript𝜀small𝑣𝑆2subscript𝜀round4subscript𝜀spreadsubscript𝜀small𝑣𝑆subscript𝜀paltry\displaystyle(1/\varepsilon_{\textnormal{paltry}}+1)(\varepsilon_{\textnormal{% round}}+2\varepsilon_{\textnormal{spread}}/\varepsilon_{\textnormal{small}})v(% S)\leq(2\varepsilon_{\textnormal{round}}+4\varepsilon_{\textnormal{spread}}/% \varepsilon_{\textnormal{small}})v(S)/\varepsilon_{\textnormal{paltry}},( 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT + 1 ) ( italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT + 2 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) italic_v ( italic_S ) ≤ ( 2 italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT + 4 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) italic_v ( italic_S ) / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ,

which we can still tolerate, as shown by the competitive analysis in the end of this proof. However, the situation could be exacerbated by the fact that when discarding a single paltry item to get below the rounded value threshold, we could incur a loss of up to εpaltryv(S)subscript𝜀paltry𝑣𝑆\varepsilon_{\textnormal{paltry}}v(S)italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT italic_v ( italic_S ), the maximum value of a paltry item, instead of only (εround+1+1/εpaltry)v(S)subscript𝜀round11subscript𝜀paltry𝑣𝑆(\varepsilon_{\textnormal{round}}+1+1/\varepsilon_{\textnormal{paltry}})v(S)( italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT + 1 + 1 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) italic_v ( italic_S ) in every phase. There are up to 1/εpaltry+11subscript𝜀paltry11/\varepsilon_{\textnormal{paltry}}+11 / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT + 1 phases, so this could sum up to a total loss just shy of v(S)𝑣𝑆v(S)italic_v ( italic_S ). In the following, we introduce what might be called a virtual version of our algorithm as a tool to circumvent this problem.

The Virtual Algorithm.

Beside the actual advice algorithm producing our online solution, we consider a virtual version of the algorithm that has one huge, if imaginary, advantage: It may use a so-called splitting slot. The splitting slot can store one paltry item at any point, and the virtual algorithm may then split off from the item currently stored there any desired fraction to be used in the packing of the knapsack. The fraction used of the split item is allowed to change at any moment. However, the algorithm must always take the same fraction for the value and the size of an item, meaning that the split-off part retains the yield of the full item.

In other words, the algorithm can, for an arbitrary positive r1𝑟1r\leq 1italic_r ≤ 1, treat an item i𝑖iitalic_i of size sisubscript𝑠𝑖s_{i}italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and value visubscript𝑣𝑖v_{i}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT in the splitting slot as though it were an item of size rsi𝑟subscript𝑠𝑖r\cdot s_{i}italic_r ⋅ italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and value, rvi𝑟subscript𝑣𝑖r\cdot v_{i}italic_r ⋅ italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and the r𝑟ritalic_r can be adjusted arbitrarily at any time.

This enables the virtual algorithm to hit the previously described target value precisely and persistently, once it could have exceeded it, by maintaining in the splitting slot a paltry item of highest yield after those actually kept outside the splitting slot, and always taking just the right fraction to stay at the value limit as long as possible. The unused fraction is assumed to neither take up any space nor contribute any value.

There are two ways for an item to be forced out of the splitting slot. If items of higher yield—or identical yield but smaller ones—and sufficient total value appear, the present split item will become useless to the virtual algorithm, which then discards it for good. If, however, there is a phase change accompanied by an increase of the value limit, then the algorithm may decide to retrieve the entire item from the splitting slot, pack it in the knapsack regularly, and store an item of lower yield—or identical yield but lower size—in the splitting slot instead.

Having described the behavior of the virtual version of the algorithm, which uses the imagined capabilities of the splitting slot, we now explain how the actual algorithm acts based on the decisions taken by the virtual version.

The Actual Algorithm.

The actual algorithm is essentially trying to trace every action of its virtual version. However, it is not allowed to split any items and thus faced with a binary decision whenever the virtual algorithm stores an item in the splitting slot: either pack said item as a whole or discard it completely. Both choices come with their own set of problems.

It is the simpler option for the algorithm to discard any split item, as it then can still imitate the virtual version in every other respect, by operating as though any fraction from the split item were available at any time. In particular, the precious items would be handled absolutely identically by both versions of the algorithm. However, if too many split items kept by the virtual algorithm are discarded, then their total value could accumulate to a substantial part the optimal solution value. Thus it will be necessary to store split items under certain circumstances.

This opens up the possibility for the second type of error, entailing even more serious consequences. If the actual algorithm packs an item in its entirety instead of only the fraction used by the virtual version, then there is less space left for precious items needed to fill up all slots in the end. The naïve approach of just following the virtual version in packing a precious item whenever feasible—that is, unless packed paltry items, including the used fraction of the split item, would need to be discarded—does not work here. This could entice the algorithm into filling a slot with a precious item much larger than what this slot will contain in the end, thus preventing the packing of rather large but still important paltry items into the splitting slot.

Instead, the algorithm uses the advice tuples a0,a1,,amsubscript𝑎0subscript𝑎1subscript𝑎𝑚a_{0},a_{1},\dots,a_{m}italic_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_a start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT to navigate the two issues in such a way that its final output is in fact identical to that of the virtual version, except for missing the one item remaining in the splitting slot at the end.

Specifically, the advice tuple aj=(aj,1,aj,2,,aj,mj)subscript𝑎𝑗subscript𝑎𝑗1subscript𝑎𝑗2subscript𝑎𝑗subscript𝑚𝑗a_{j}=(a_{j,1},a_{j,2},\dots,a_{j,m_{j}})italic_a start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT = ( italic_a start_POSTSUBSCRIPT italic_j , 1 end_POSTSUBSCRIPT , italic_a start_POSTSUBSCRIPT italic_j , 2 end_POSTSUBSCRIPT , … , italic_a start_POSTSUBSCRIPT italic_j , italic_m start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT end_POSTSUBSCRIPT ) is used in phase j𝑗jitalic_j as follows. The algorithm does not pack any precious items or split items by default. Once the virtual algorithm packs an item into slot aj,1subscript𝑎𝑗1a_{j,1}italic_a start_POSTSUBSCRIPT italic_j , 1 end_POSTSUBSCRIPT, however, the actual algorithm tries to follow suit. It might be unable to do so if it has stored items of a larger total size due to its inability to split items. If it can fill a new item into slot aj,1subscript𝑎𝑗1a_{j,1}italic_a start_POSTSUBSCRIPT italic_j , 1 end_POSTSUBSCRIPT alongside with the virtual version, however, then from this moment on, the algorithm starts actually packing into slot aj,1subscript𝑎𝑗1a_{j,1}italic_a start_POSTSUBSCRIPT italic_j , 1 end_POSTSUBSCRIPT whatever the virtual version packs into it; we say that slot aj,1subscript𝑎𝑗1a_{j,1}italic_a start_POSTSUBSCRIPT italic_j , 1 end_POSTSUBSCRIPT is now actualized. After actualizing slot aj,1subscript𝑎𝑗1a_{j,1}italic_a start_POSTSUBSCRIPT italic_j , 1 end_POSTSUBSCRIPT, the algorithm starts monitoring slot aj,2subscript𝑎𝑗2a_{j,2}italic_a start_POSTSUBSCRIPT italic_j , 2 end_POSTSUBSCRIPT, which might already be filled virtually at this point, but is not yet filled actually. Whenever a new item—assume that it is precious for the moment—is stored into aj,2subscript𝑎𝑗2a_{j,2}italic_a start_POSTSUBSCRIPT italic_j , 2 end_POSTSUBSCRIPT by the virtual algorithm, the actual algorithm observes if it could do the same. As soon as such an opportunity arises, it is taken, and slot aj,2subscript𝑎𝑗2a_{j,2}italic_a start_POSTSUBSCRIPT italic_j , 2 end_POSTSUBSCRIPT is now also actualized. This continues until the tuple is exhausted, which means that no more slots will be actualized in this phase. If the advice tells the algorithm to actualize the splitting slot, which has the number 00, with a paltry item, this all works identically, with two exceptions: First, if the virtual algorithm updates an already actualized item in the splitting slot, then all slots that were actualized after the splitting slot in the current phase are virtualized again, meaning that the actual algorithm discards the items stored in them. And second, the splitting slot is reverted to be virtual at the beginning of each new phase. Nevertheless, an item already stored in the splitting slot at the beginning of a phase remains there until it is replaced by a future item.

We have now fully described our algorithm, whose pseudo-code is found in Algorithm 2. Note that both the value-restricted and the size-based yield-greedy procedure used for packing the paltry items are implemented by the function Greedy.

Turning now to the analysis of the algorithm, we will first show that the algorithm performs sufficiently in the special mode where items are filtered based on their size. Then we prove that the virtual version eventually fills all slots and always attains the value goal on the paltry items, resulting in a total value that surpasses our final goal with more than εpaltryv(S)subscript𝜀paltry𝑣𝑆\varepsilon_{\textnormal{paltry}}v(S)italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT italic_v ( italic_S ) to spare. Finally, we prove that the actual algorithm can successfully re-create the solution by the virtual version up to potentially one single paltry item, which we can forego without problem due to the leeway afforded by the virtual version.

Success of Size-Based Strategy.

We first consider the rather simple case that the special bit bsmallsubscript𝑏smallb_{\textnormal{small}}italic_b start_POSTSUBSCRIPT small end_POSTSUBSCRIPT is set to 1111. The oracle does this if and only if a purely yield-greedy approach on the paltry items, ignoring all precious ones, is guaranteed to achieve a competitive ratio of 1/(1εsmall)11subscript𝜀small1/(1-\varepsilon_{\textnormal{small}})1 / ( 1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) on the given instance. However, as mentioned before, the algorithm does not know for sure which items will turn out to be paltry in the end; thus it is implementing a size-based strategy instead in this case, packing only small items and dismissing the big ones.

Since the big items all have size at least εsmallsubscript𝜀small\varepsilon_{\textnormal{small}}italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, at most 1/εsmall1subscript𝜀small1/\varepsilon_{\textnormal{small}}1 / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT of them fit into any feasible solution, in particular the 1/(1εsmall)11subscript𝜀small1/(1-\varepsilon_{\textnormal{small}})1 / ( 1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT )-competitive solution that would have been produced by greedily packing only paltry items. Omitting from this solution, which contains only paltry items, the up to 1/εsmall1subscript𝜀small1/\varepsilon_{\textnormal{small}}1 / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT big items decreases its value by less than εpaltry/εsmallsubscript𝜀paltrysubscript𝜀small\varepsilon_{\textnormal{paltry}}/\varepsilon_{\textnormal{small}}italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT. This means that we now have a solution containing only small items, worth at least a fraction 1εsmallεpaltry/εsmall1subscript𝜀smallsubscript𝜀paltrysubscript𝜀small1-\varepsilon_{\textnormal{small}}-\varepsilon_{\textnormal{paltry}}/% \varepsilon_{\textnormal{small}}1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT of the optimal solution value. Running a yield-greedy strategy on the small items either reproduces this solution perfectly or it leaves, as soon as a packed item is discarded, an unfilled gap smaller than εsmallsubscript𝜀small\varepsilon_{\textnormal{small}}italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT. Since the yield is optimized for the filled part of the knapsack, this is a solution worth at least a fraction (1εsmallεpaltry/εsmall)(1εsmall)1εsmallεpaltry/εsmallεsmall1subscript𝜀smallsubscript𝜀paltrysubscript𝜀small1subscript𝜀small1subscript𝜀smallsubscript𝜀paltrysubscript𝜀smallsubscript𝜀small(1-\varepsilon_{\textnormal{small}}-\varepsilon_{\textnormal{paltry}}/% \varepsilon_{\textnormal{small}})(1-\varepsilon_{\textnormal{small}})\geq 1-% \varepsilon_{\textnormal{small}}-\varepsilon_{\textnormal{paltry}}/\varepsilon% _{\textnormal{small}}-\varepsilon_{\textnormal{small}}( 1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) ( 1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) ≥ 1 - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT - italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT of the optimal solution value, which for our choices of εsmall=ε/23subscript𝜀small𝜀superscript23\varepsilon_{\textnormal{small}}=\varepsilon/2^{3}italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT = italic_ε / 2 start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT and εpaltry=ε2/25subscript𝜀paltrysuperscript𝜀2superscript25\varepsilon_{\textnormal{paltry}}=\varepsilon^{2}/2^{5}italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT = italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 5 end_POSTSUPERSCRIPT is greater than 1ε/21/(1ε)1𝜀211𝜀1-\varepsilon/2\geq 1/(1-\varepsilon)1 - italic_ε / 2 ≥ 1 / ( 1 - italic_ε ). We can therefore assume bsmall=0subscript𝑏small0b_{\textnormal{small}}=0italic_b start_POSTSUBSCRIPT small end_POSTSUBSCRIPT = 0 from now on.

Success of Virtual Version.

Assuming that the algorithm already starts in its final level—which is proved to be possible without loss of generality in its own section on leveling up—we show that the virtual version completes all phases and hits its value goal on the paltry items precisely in each phase. Recall that after reaching the final level, the notions of paltry and precious coincide with provenly paltry and presumably precious, respectively.

Denote by vpaltry,j=v(SVpaltry,j)subscript𝑣paltry𝑗𝑣𝑆subscript𝑉paltry𝑗v_{\textnormal{paltry},j}=v(S\cap V_{\textnormal{paltry},j})italic_v start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT = italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT ) and spaltry,j=s(SVpaltry,j)subscript𝑠paltry𝑗𝑠𝑆subscript𝑉paltry𝑗s_{\textnormal{paltry},j}=s(S\cap V_{\textnormal{paltry},j})italic_s start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT = italic_s ( italic_S ∩ italic_V start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT ) the total value and size, respectively, of the items in optimal solution S𝑆Sitalic_S appearing after ujsubscript𝑢𝑗u_{j}italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT but before uj+1subscript𝑢𝑗1u_{j+1}italic_u start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT. Recall that the algorithm computes fjLsubscript𝑓𝑗subscript𝐿f_{j}\cdot L_{\ell}italic_f start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⋅ italic_L start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT—where fj=v(SVpaltry,j)εroundsubscript𝑓𝑗subscript𝑣𝑆subscript𝑉paltry𝑗subscript𝜀roundf_{j}=\lfloor v(S\cap V_{\textnormal{paltry},j})\rfloor_{\varepsilon_{% \textnormal{round}}}italic_f start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT = ⌊ italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT ) ⌋ start_POSTSUBSCRIPT italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT end_POSTSUBSCRIPT is given directly by the advice and Lsubscript𝐿L_{\ell}italic_L start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT is the current lower bound on v(S)𝑣𝑆v(S)italic_v ( italic_S )—as a fairly accurate lower bound on vpaltry,jsubscript𝑣paltry𝑗v_{\textnormal{paltry},j}italic_v start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT. Denote this lower bound by vpaltry,j=fjLsubscriptsuperscript𝑣paltry𝑗subscript𝑓𝑗subscript𝐿v^{\prime}_{\textnormal{paltry},j}=f_{j}\cdot L_{\ell}italic_v start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT = italic_f start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⋅ italic_L start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT, and denote by spaltry,jsubscriptsuperscript𝑠paltry𝑗s^{\prime}_{\textnormal{paltry},j}italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT the proportional lower bound on spaltry,jsubscript𝑠paltry𝑗s_{\textnormal{paltry},j}italic_s start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT, namely spaltry,j=spaltry,jvpaltry,j/vpaltry,jsubscriptsuperscript𝑠paltry𝑗subscript𝑠paltry𝑗subscriptsuperscript𝑣paltry𝑗subscript𝑣paltry𝑗s^{\prime}_{\textnormal{paltry},j}=s_{\textnormal{paltry},j}\cdot v^{\prime}_{% \textnormal{paltry},j}/v_{\textnormal{paltry},j}italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT = italic_s start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT ⋅ italic_v start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT / italic_v start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT. The desired statement follows from a two-part claim by induction over p{0,1,,m+1}𝑝01𝑚1p\in\{0,1,\dots,m+1\}italic_p ∈ { 0 , 1 , … , italic_m + 1 }, where we use once more our auxiliary definition of two imaginary items u0=0subscript𝑢00u_{0}=0italic_u start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 0 and um+1=n+1subscript𝑢𝑚1𝑛1u_{m+1}=n+1italic_u start_POSTSUBSCRIPT italic_m + 1 end_POSTSUBSCRIPT = italic_n + 1.

Induction Claim.
  1. 1.

    After the decision on item upsubscript𝑢𝑝u_{p}italic_u start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, the first p𝑝pitalic_p slots are filled, whether just virtually or already actualized, with items of size at most j=1ps(uj)superscriptsubscript𝑗1𝑝𝑠subscript𝑢𝑗\sum_{j=1}^{p}s(u_{j})∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p end_POSTSUPERSCRIPT italic_s ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ).

  2. 2.

    Consider the paltry items in the knapsack when upsubscript𝑢𝑝u_{p}italic_u start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT is presented, including the used fraction of any split item. Among these, select items in a manner greedy for high yield and secondarily for low size—allowing for any items to be split, regardless of whether they are in the splitting slot—and stop only if the total value reaches j=0p1vpaltry,jsuperscriptsubscript𝑗0𝑝1subscriptsuperscript𝑣paltry𝑗\sum_{j=0}^{p-1}v^{\prime}_{\textnormal{paltry},j}∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p - 1 end_POSTSUPERSCRIPT italic_v start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT. The value of this selection is in fact exactly j=0p1vpaltry,jsuperscriptsubscript𝑗0𝑝1subscriptsuperscript𝑣paltry𝑗\sum_{j=0}^{p-1}v^{\prime}_{\textnormal{paltry},j}∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p - 1 end_POSTSUPERSCRIPT italic_v start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT and its size at most j=0p1spaltry,jsuperscriptsubscript𝑗0𝑝1subscriptsuperscript𝑠paltry𝑗\sum_{j=0}^{p-1}s^{\prime}_{\textnormal{paltry},j}∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p - 1 end_POSTSUPERSCRIPT italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT.

Base Case.

The base case j=0𝑗0j=0italic_j = 0 is trivially true: Phase 00 begins with the decision on the auxiliary item u0=0subscript𝑢00u_{0}=0italic_u start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 0, which does not fit any of the slots, which thus all remain empty. The second part claim is empty as well due to j=01vpaltry,j=j=01spaltry,j=0superscriptsubscript𝑗01subscriptsuperscript𝑣paltry𝑗superscriptsubscript𝑗01subscriptsuperscript𝑠paltry𝑗0\sum_{j=0}^{-1}v^{\prime}_{\textnormal{paltry},j}=\sum_{j=0}^{-1}s^{\prime}_{% \textnormal{paltry},j}=0∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT italic_v start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT = ∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT = 0.

Induction Step.

Let an arbitrary p{0,1,,m}𝑝01𝑚p\in\{0,1,\dots,m\}italic_p ∈ { 0 , 1 , … , italic_m } be given. We assume the claim for all p{0,1,,p}superscript𝑝01𝑝p^{\prime}\in\{0,1,\dots,p\}italic_p start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∈ { 0 , 1 , … , italic_p } as our induction hypothesis and use it to prove the statement for p+1𝑝1p+1italic_p + 1. By the first part of the hypothesis, the algorithm is at least in phase p𝑝pitalic_p when the items between upsubscript𝑢𝑝u_{p}italic_u start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT and up+1subscript𝑢𝑝1u_{p+1}italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT are presented. Therefore, the value limit for packing paltry items is already j=0pvpaltry,jsuperscriptsubscript𝑗0𝑝subscriptsuperscript𝑣paltry𝑗\sum_{j=0}^{p}v^{\prime}_{\textnormal{paltry},j}∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p end_POSTSUPERSCRIPT italic_v start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT or higher at the beginning of this period of the instance. The set Vpaltry,psubscript𝑉paltry𝑝V_{\textnormal{paltry},p}italic_V start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT of paltry items presented during this period contains a set of items, namely SVpaltry,p𝑆subscript𝑉paltry𝑝S\cap V_{\textnormal{paltry},p}italic_S ∩ italic_V start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT, with total size vpaltry,psubscript𝑣paltry𝑝v_{\textnormal{paltry},p}italic_v start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT and size spaltry,psubscript𝑠paltry𝑝s_{\textnormal{paltry},p}italic_s start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT. A yield-greedy online packing choosing from these items with a value limit vpaltry,psubscriptsuperscript𝑣paltry𝑝v^{\prime}_{\textnormal{paltry},p}italic_v start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT achieves, if splitting items arbitrarily is allowed, a selection with a value of exactly vpaltry,psubscriptsuperscript𝑣paltry𝑝v^{\prime}_{\textnormal{paltry},p}italic_v start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT and—since the selection has the highest possible yield—size at most spaltry,psubscriptsuperscript𝑠paltry𝑝s^{\prime}_{\textnormal{paltry},p}italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT. We know from the second part of the hypothesis that at the beginning of the considered period the knapsack has already contained paltry items allowing for a selection of value j=0p1vpaltry,jsuperscriptsubscript𝑗0𝑝1subscript𝑣paltry𝑗\sum_{j=0}^{p-1}v_{\textnormal{paltry},j}∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p - 1 end_POSTSUPERSCRIPT italic_v start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT and size at most j=0p1spaltry,jsuperscriptsubscript𝑗0𝑝1subscript𝑠paltry𝑗\sum_{j=0}^{p-1}s_{\textnormal{paltry},j}∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p - 1 end_POSTSUPERSCRIPT italic_s start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT. The combination of this selection with the previously described one has value j=0pvpaltry,jsuperscriptsubscript𝑗0𝑝subscriptsuperscript𝑣paltry𝑗\sum_{j=0}^{p}v^{\prime}_{\textnormal{paltry},j}∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p end_POSTSUPERSCRIPT italic_v start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT and some size which is at most j=0pspaltry,jsuperscriptsubscript𝑗0𝑝subscriptsuperscript𝑠paltry𝑗\sum_{j=0}^{p}s^{\prime}_{\textnormal{paltry},j}∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p end_POSTSUPERSCRIPT italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT. Our algorithm will therefore also achieve at the end of the considered period a selection of this same value and some size that might be even lower—since it has to chance to use some items in Vpaltry,pSsubscript𝑉paltry𝑝𝑆V_{\textnormal{paltry},p}\smallsetminus Sitalic_V start_POSTSUBSCRIPT paltry , italic_p end_POSTSUBSCRIPT ∖ italic_S of potentially greater yield—but never higher. This concludes the proof of the second part of the claim.

For the first part, it suffices to consider the case that the first p+1𝑝1p+1italic_p + 1 slots do not yet contain items of size at most j=1p+1s(uj)superscriptsubscript𝑗1𝑝1𝑠subscript𝑢𝑗\sum_{j=1}^{p+1}s(u_{j})∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p + 1 end_POSTSUPERSCRIPT italic_s ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) when item up+1subscript𝑢𝑝1u_{p+1}italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT is presented. By the induction hypothesis, the first p𝑝pitalic_p slots already contained items of size at most j=1ps(uj)superscriptsubscript𝑗1𝑝𝑠subscript𝑢𝑗\sum_{j=1}^{p}s(u_{j})∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p end_POSTSUPERSCRIPT italic_s ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) after the decision on ujsubscript𝑢𝑗u_{j}italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. This remains true until the instance ends since items in a slot are only ever replaced by smaller ones. If slot p+1𝑝1p+1italic_p + 1 is already filled when up+1subscript𝑢𝑝1u_{p+1}italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT is presented, then the item in this slot either has size at most s(up+1)𝑠subscript𝑢𝑝1s(u_{p+1})italic_s ( italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT ), or it is replaced by up+1subscript𝑢𝑝1u_{p+1}italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT, both of which mean that the induction claim for p+1𝑝1p+1italic_p + 1 is satisfied. Finally, if slot p+1m𝑝1𝑚p+1\leq mitalic_p + 1 ≤ italic_m is still empty upon the presentation of up+1subscript𝑢𝑝1u_{p+1}italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT, then we can combine the first part of our induction hypothesis and the already proven second part for p+1𝑝1p+1italic_p + 1 to bound the total size of all packed items at this moment by

j=0p(s(uj)+spaltry,j)j=0p(s(uj)+spaltry,j)j=0m(s(uj)+spaltry,j)s(up+1)=s(S)s(up+1).superscriptsubscript𝑗0𝑝𝑠subscript𝑢𝑗subscriptsuperscript𝑠paltry𝑗superscriptsubscript𝑗0𝑝𝑠subscript𝑢𝑗subscript𝑠paltry𝑗superscriptsubscript𝑗0𝑚𝑠subscript𝑢𝑗subscript𝑠paltry𝑗𝑠subscript𝑢𝑝1𝑠𝑆𝑠subscript𝑢𝑝1\sum_{j=0}^{p}(s(u_{j})+s^{\prime}_{\textnormal{paltry},j})\leq\sum_{j=0}^{p}(% s(u_{j})+s_{\textnormal{paltry},j})\leq\sum_{j=0}^{m}(s(u_{j})+s_{\textnormal{% paltry},j})-s(u_{p+1})=s(S)-s(u_{p+1}).∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p end_POSTSUPERSCRIPT ( italic_s ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) + italic_s start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT ) ≤ ∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p end_POSTSUPERSCRIPT ( italic_s ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) + italic_s start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT ) ≤ ∑ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT ( italic_s ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) + italic_s start_POSTSUBSCRIPT paltry , italic_j end_POSTSUBSCRIPT ) - italic_s ( italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT ) = italic_s ( italic_S ) - italic_s ( italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT ) .

Since S𝑆Sitalic_S is a feasible solution, item up+1subscript𝑢𝑝1u_{p+1}italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT will fill slot p+1𝑝1p+1italic_p + 1, which concludes the proof of the second part of the claim, the induction step from p𝑝pitalic_p to p+1𝑝1p+1italic_p + 1, and thus the entire induction.

Success of Actual Algorithm

Having seen that the virtual version of the algorithm performs sufficiently well—the exact competitive analysis follows later on—we now prove that the actual algorithm successfully mimics this behavior in the following sense: Despite deviating from the virtual online solution by non-negligible values at some times, the actual algorithm produces a final output that is identical to that of the virtual solution Ssuperscript𝑆S^{\prime}italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, except for the omission of one single paltry item, namely the one remaining in the splitting slot when the instance ends. We will see that the actual algorithm, which uses exactly the same phases and value limits as the virtual version, can use the advice to actualize any item that is part of the eventual solution immediately when is appears. The first key toward this is the following observation. During any given phase, the value limit used by the algorithm remains fixed. Hence, any item that is split at any point during a given phase either remains in the splitting slot until the end of this phase or—if it leaves the splitting slot before the phase has ended—it is discarded in favor of items of greater yield or identical yield but larger size, as dictated by the yield-greedy approach for paltry items. This means that the paltry items remaining in the knapsack at the end of a phase, excluding the one in the splitting slot at this point, have never been in the splitting slot during the entire phase. By not actualizing the splitting slot, the algorithm will therefore not miss during this phase any paltry item from the eventual virtual solution Ssuperscript𝑆S^{\prime}italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT but potentially the one item that is in the splitting slot at the end of the phase. Moreover, actualizing the splitting slot only upon appearance of this one item suffices to not miss any paltry item from Ssuperscript𝑆S^{\prime}italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT in this phase. The algorithm can therefore focus on actualizing the precious items and paltry items that are in the splitting slot at the end of some phase—although it does not know beforehand which of the paltry items will turn out to be of this kind.

The second key, addressing this issue, is to actualize the slots in the right order, which is made possible by the advice. Denote by w1,w2,,wmsubscript𝑤1subscript𝑤2subscript𝑤superscript𝑚w_{1},w_{2},\dots,w_{m^{\prime}}italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_w start_POSTSUBSCRIPT italic_m start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT those items from the virtual solution Ssuperscript𝑆S^{\prime}italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, excluding the item remaining in the splitting slot in the end, that are either precious or have been in the splitting slot at the end of some phase, in the order as they appear during the instance. These are exactly the items that the algorithm might miss by not actualizing them. We inductively prove that the actual algorithm actualizes the items w1,w2,,wmsubscript𝑤1subscript𝑤2subscript𝑤superscript𝑚w_{1},w_{2},\dots,w_{m^{\prime}}italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_w start_POSTSUBSCRIPT italic_m start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT.

Induction Claim.

Immediately after the decision on wisubscript𝑤𝑖w_{i}italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, the algorithm has actualized the items w1,w2,,wisubscript𝑤1subscript𝑤2subscript𝑤𝑖w_{1},w_{2},\dots,w_{i}italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT.

Induction Basis.

Using once more the auxiliary definition of an imaginary item w0=u0=0subscript𝑤0subscript𝑢00w_{0}=u_{0}=0italic_w start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = italic_u start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 0 of zero value and size, the claim for i=0𝑖0i=0italic_i = 0 is empty.

Induction Step.

Our induction hypothesis is that the items w1,w2,,wisubscript𝑤1subscript𝑤2subscript𝑤𝑖w_{1},w_{2},\dots,w_{i}italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT are already packed and actualized immediately after the decision on wisubscript𝑤𝑖w_{i}italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. These items will never be replaced by the actual algorithm because the virtual version does not do so either since they are part of its eventual solution Ssuperscript𝑆S^{\prime}italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT.

The advice tells us into which slot the virtual algorithm will pack wi+1subscript𝑤𝑖1w_{i+1}italic_w start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT in the current phase. Whenever the virtual version packs an item into this slot, the algorithm will try to actualize it. We only need to prove this to be possible without exceeding the given capacity.

If the oracle advises the algorithm to not actualize any item in the splitting slot in the current phase, this is trivial: The actual algorithm never actualizes anything not also fully packed by the virtual version, which never exceeds the knapsack capacity.

The more difficult case is that the virtual algorithm puts into the splitting slot during this phase some paltry item isuperscript𝑖i^{\prime}italic_i start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT that will be part of the eventual virtual solution in its entirety rather than just as a split item. In the moment when this item is put into the splitting slot, the remaining packed paltry items have a total size that will never be undercut during the rest of the instance. This is because the only way to decrease the total size of the packed paltry items is to discard some of them, which would be possible only if the item of lower priority in the splitting slot were discarded beforehand by the virtual algorithm, which it cannot do since isuperscript𝑖i^{\prime}italic_i start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT is part of the eventual solution. This means that Ssuperscript𝑆S^{\prime}italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT contains paltry items of some total size at least as large the size of paltry items packed when isuperscript𝑖i^{\prime}italic_i start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT appears, plus the entire item isuperscript𝑖i^{\prime}italic_i start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, plus all the items w1,w2,,wmsubscript𝑤1subscript𝑤2subscript𝑤superscript𝑚w_{1},w_{2},\dots,w_{m^{\prime}}italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_w start_POSTSUBSCRIPT italic_m start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT. Thus the total size of Ssuperscript𝑆S^{\prime}italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT is at least what the total size in the knapsack becomes for the actual algorithm when packing isuperscript𝑖i^{\prime}italic_i start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT fully upon appearance, in addition to those the items from w1,w2,,wmsubscript𝑤1subscript𝑤2subscript𝑤superscript𝑚w_{1},w_{2},\dots,w_{m^{\prime}}italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_w start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_w start_POSTSUBSCRIPT italic_m start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT that have appeared earlier and those yet to appear. It might happen that the algorithm has actualized the slot for a precious item wjsubscript𝑤superscript𝑗w_{j^{\prime}}italic_w start_POSTSUBSCRIPT italic_j start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT before it has appeared, which could mean that this slot contains an item larger than wjsubscript𝑤superscript𝑗w_{j^{\prime}}italic_w start_POSTSUBSCRIPT italic_j start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT, which in turn could block the replacement of the item in the splitting slot by one that has higher yield, but is also larger. However, recall that in this case the algorithm just re-virtualizes the slots to be actualized after the splitting slot in the current phase, dismissing all precious items in them. Therefore, the algorithm can and will indeed always actualize wi+1subscript𝑤𝑖1w_{i+1}italic_w start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT upon appearance.

Competitive Analysis

We analyze the competitive ratios achieved on the precious items and the paltry items separately. During this, we assume that the algorithm starts in the final level and thus never discards previously packed items due to leveling up; this assumption is justified afterward.

We still denote by S𝑆Sitalic_S the optimal solution picked by the oracle to compute the advice, and let T𝑇Titalic_T denote the final output of the online algorithm.

Precious Part.

It follows from the termination of all phases in the last level and the actualization of all slots that the precious part of the online solution T𝑇Titalic_T contains exactly as many precious items in each value class as S𝑆Sitalic_S does. Each class spans a value interval whose lower and upper end spread a factor of exactly 1εspread1subscript𝜀spread1-\varepsilon_{\textnormal{spread}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT, thus we know that v(TVprecious)(1εspread)v(SVprecious)𝑣𝑇subscript𝑉precious1subscript𝜀spread𝑣𝑆subscript𝑉preciousv(T\cap V_{\textnormal{precious}})\geq(1-\varepsilon_{\textnormal{spread}})v(S% \cap V_{\textnormal{precious}})italic_v ( italic_T ∩ italic_V start_POSTSUBSCRIPT precious end_POSTSUBSCRIPT ) ≥ ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) italic_v ( italic_S ∩ italic_V start_POSTSUBSCRIPT precious end_POSTSUBSCRIPT ). The loss on the precious items is therefore at most a fraction εspreadsubscript𝜀spread\varepsilon_{\textnormal{spread}}italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT of the optimal solution value.

Paltry Part.

For the paltry items, we have already bounded the lost value to a fraction (2εround+4εspread/εsmall)/εpaltry2subscript𝜀round4subscript𝜀spreadsubscript𝜀smallsubscript𝜀paltry(2\varepsilon_{\textnormal{round}}+4\varepsilon_{\textnormal{spread}}/% \varepsilon_{\textnormal{small}})/\varepsilon_{\textnormal{paltry}}( 2 italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT + 4 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT of the optimal solution when discussing how the paltry part of the knapsack is packed using the splitting slot.

Leveling Up.

It remains to show that the potentially unbounded number of resets, which occur whenever the algorithm is leveling up, are only causing a negligible value loss.

The first trigger causing a level change was the appearance of an item worth more than the items considered presumably precious so far. This trigger ensures that the algorithm never mistreats a precious item as paltry since doing so could mean missing a precious item that should have filled a slot. If a precious item is not already recognized as such upon arrival, the algorithm immediately levels up to rectify this and pack the item if necessary.

The second trigger for leveling up was that the algorithm can construct, from the items seen so far—whether they have been accepted or not—a valid solution whose value exceeds the upper bound Usubscript𝑈U_{\ell}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT on the optimal solution value v(S)𝑣𝑆v(S)italic_v ( italic_S ). The newest item is part of any such hypothetical solution—otherwise the level would have risen earlier—and when excluding it, the remaining possible solutions are all worth less than the current upper bound Usubscript𝑈U_{\ell}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT.

When a level change is occurring—independent of whether it was caused by the first or second trigger—this means that the estimate Usubscript𝑈U_{\ell}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT has in fact been far too low: It has been at most a fraction (1εspread)K1εpaltrysuperscript1subscript𝜀spread𝐾1subscript𝜀paltry(1-\varepsilon_{\textnormal{spread}})^{K-1}\leq\varepsilon_{\textnormal{paltry}}( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_K - 1 end_POSTSUPERSCRIPT ≤ italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT of what it is becoming now, as already noted in the section on notions and notation. Moreover, we have proved, when explaining how the optimal solution value v(S)𝑣𝑆v(S)italic_v ( italic_S ) is estimated, that we can derive from any upper bound Usubscript𝑈U_{\ell}italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT a guaranteed lower bound L=U(12εspread/εsmall)subscript𝐿subscript𝑈12subscript𝜀spreadsubscript𝜀smallL_{\ell}=U_{\ell}(1-2\varepsilon_{\textnormal{spread}}/\varepsilon_{% \textnormal{small}})italic_L start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT = italic_U start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT ( 1 - 2 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ).

Combining the three facts from the last two paragraphs, we see that the value of any solution that can be constructed from the items to be discarded with the level change is worth at most εpaltryv(S)/(12εspread/εsmall)subscript𝜀paltry𝑣𝑆12subscript𝜀spreadsubscript𝜀small\varepsilon_{\textnormal{paltry}}v(S)/(1-2\varepsilon_{\textnormal{spread}}/% \varepsilon_{\textnormal{small}})italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT italic_v ( italic_S ) / ( 1 - 2 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ). If the final optimal solution contains any of these items, then omitting them means losing at most a fraction εpaltry/(12εspread/εsmall)<2εpaltrysubscript𝜀paltry12subscript𝜀spreadsubscript𝜀small2subscript𝜀paltry\varepsilon_{\textnormal{paltry}}/(1-2\varepsilon_{\textnormal{spread}}/% \varepsilon_{\textnormal{small}})<2\varepsilon_{\textnormal{paltry}}italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT / ( 1 - 2 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) < 2 italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT of the overall value, where the last inequality is satisfied for our choices of εsmall=ε/23subscript𝜀small𝜀superscript23\varepsilon_{\textnormal{small}}=\varepsilon/2^{3}italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT = italic_ε / 2 start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT, εpaltry=ε2/25subscript𝜀paltrysuperscript𝜀2superscript25\varepsilon_{\textnormal{paltry}}=\varepsilon^{2}/2^{5}italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT = italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 5 end_POSTSUPERSCRIPT, and εspread=ε4/214subscript𝜀spreadsuperscript𝜀4superscript214\varepsilon_{\textnormal{spread}}=\varepsilon^{4}/2^{14}italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT = italic_ε start_POSTSUPERSCRIPT 4 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 14 end_POSTSUPERSCRIPT. While we might incur such a loss of a factor bounded by 2εpaltry2subscript𝜀paltry2\varepsilon_{\textnormal{paltry}}2 italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT with every new level change, the aggregate loss of the previous resets is fortunately also diminishing in relation to the estimate for v(S)𝑣𝑆v(S)italic_v ( italic_S ) with every update of this estimate to a higher value. Hence the total fractional value loss caused by the potentially unbounded number of resets of the algorithm can be bounded by k=1(2εpaltry)k=2εpaltry/(12εpaltry)4εpaltrysuperscriptsubscript𝑘1superscript2subscript𝜀paltry𝑘2subscript𝜀paltry12subscript𝜀paltry4subscript𝜀paltry\sum_{k=1}^{\infty}(2\varepsilon_{\textnormal{paltry}})^{k}=2\varepsilon_{% \textnormal{paltry}}/(1-2\varepsilon_{\textnormal{paltry}})\leq 4\varepsilon_{% \textnormal{paltry}}∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT ( 2 italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT = 2 italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT / ( 1 - 2 italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) ≤ 4 italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT. Deducting this fraction from the value of the final online solution, we are justified in assuming without loss of generality that the algorithm already starts at the final level.

Algorithm 2 implements all of this by resetting the input sequence to its initial state upon each level change, and then acting out what it would have done, had it been at the current level from the beginning. For all items encountered at past levels this is a mere simulation since all previously packed items are discarded during a reset. To allow for this simulation, the algorithm maintains a set Jseensubscript𝐽seenJ_{\textnormal{seen}}italic_J start_POSTSUBSCRIPT seen end_POSTSUBSCRIPT of all items seen so far and writes them off as lost whenever the level changes. The lost items are remembered by storing during each reset the current Jseensubscript𝐽seenJ_{\textnormal{seen}}italic_J start_POSTSUBSCRIPT seen end_POSTSUBSCRIPT as Jlostsubscript𝐽lostJ_{\textnormal{lost}}italic_J start_POSTSUBSCRIPT lost end_POSTSUBSCRIPT. This set is then omitted from the online output to keep to real.

Conclusion.

Combining the three types of potential losses discussed above—the one on the precious part, the one on the paltry part, and the one due to leveling up repeatedly—to a worst-case scenario, we are still left with at least a fraction 1εspread(2εround+4εspread/εsmall)/εpaltry4εpaltry1subscript𝜀spread2subscript𝜀round4subscript𝜀spreadsubscript𝜀smallsubscript𝜀paltry4subscript𝜀paltry1-\varepsilon_{\textnormal{spread}}-(2\varepsilon_{\textnormal{round}}+4% \varepsilon_{\textnormal{spread}}/\varepsilon_{\textnormal{small}})/% \varepsilon_{\textnormal{paltry}}-4\varepsilon_{\textnormal{paltry}}1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT - ( 2 italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT + 4 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT - 4 italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT of the optimal solution value, which is greater than 1ε/21/(1+ε)1𝜀211𝜀1-\varepsilon/2\geq 1/(1+\varepsilon)1 - italic_ε / 2 ≥ 1 / ( 1 + italic_ε ), concluding the proof.

Algorithm 2 ProPack

Parameter: Any ε(0,1/2]𝜀012\varepsilon\in(0,1/2]italic_ε ∈ ( 0 , 1 / 2 ].

Online Input: A sequence I=((s1,v1),,(sn,vn))𝐼subscript𝑠1subscript𝑣1subscript𝑠𝑛subscript𝑣𝑛I=((s_{1},v_{1}),\dots,(s_{n},v_{n}))italic_I = ( ( italic_s start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) , … , ( italic_s start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT , italic_v start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT ) ) with the sizes and values of n𝑛nitalic_n items.

Online Output: A packing T=(Tpaltryj=0m{tjbactual,j=1})Jlost𝑇subscript𝑇paltrysuperscriptsubscript𝑗0𝑚conditional-setsubscript𝑡𝑗subscript𝑏actual𝑗1subscript𝐽lostT=(T_{\textnormal{paltry}}\cup\bigcup_{j=0}^{m}\{\,t_{j}\mid b_{\textnormal{% actual},j}=1\,\})\smallsetminus J_{\textnormal{lost}}italic_T = ( italic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ∪ ⋃ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT { italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∣ italic_b start_POSTSUBSCRIPT actual , italic_j end_POSTSUBSCRIPT = 1 } ) ∖ italic_J start_POSTSUBSCRIPT lost end_POSTSUBSCRIPT that never exceeds the knapsack capacity and is (1+ε)1𝜀(1+\varepsilon)( 1 + italic_ε )-competitive in the end.

Advice:

Algorithm:

εsmallε/23;εpaltryε2/25formulae-sequencesubscript𝜀small𝜀superscript23subscript𝜀paltrysuperscript𝜀2superscript25\varepsilon_{\textnormal{small}}\leftarrow\varepsilon/2^{3};\quad\varepsilon_{% \textnormal{paltry}}\leftarrow\varepsilon^{2}/2^{5}italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ← italic_ε / 2 start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT ; italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ← italic_ε start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 5 end_POSTSUPERSCRIPT normal-▷\triangleright Initialize several constants …
εspreadε4/214;εroundε6/220formulae-sequencesubscript𝜀spreadsuperscript𝜀4superscript214subscript𝜀roundsuperscript𝜀6superscript220\varepsilon_{\textnormal{spread}}\leftarrow\varepsilon^{4}/2^{14};\quad% \varepsilon_{\textnormal{round}}\leftarrow\varepsilon^{6}/2^{20}italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ← italic_ε start_POSTSUPERSCRIPT 4 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 14 end_POSTSUPERSCRIPT ; italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ← italic_ε start_POSTSUPERSCRIPT 6 end_POSTSUPERSCRIPT / 2 start_POSTSUPERSCRIPT 20 end_POSTSUPERSCRIPT normal-▷\triangleright … for the given parameter ε𝜀\varepsilonitalic_ε.
for j{0,1,,m}𝑗01𝑚j\in\{0,1,\dots,m\}italic_j ∈ { 0 , 1 , … , italic_m }  normal-▷\triangleright Initialize the slots, where slot 00 is the splitting slot, as empty …
     tj0subscript𝑡𝑗0t_{j}\leftarrow 0italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ← 0 normal-▷\triangleright … by filling them with an imaginary item 00 of size and value zero, …
     bactual,j0subscript𝑏actual𝑗0b_{\textnormal{actual},j}\leftarrow 0italic_b start_POSTSUBSCRIPT actual , italic_j end_POSTSUBSCRIPT ← 0 normal-▷\triangleright … and initialize the state of the filling to be virtual only.
IcopyIsubscript𝐼copy𝐼I_{\textnormal{copy}}\leftarrow Iitalic_I start_POSTSUBSCRIPT copy end_POSTSUBSCRIPT ← italic_I normal-▷\triangleright Store a copy of the input.
Tpaltrysubscript𝑇paltryT_{\textnormal{paltry}}\leftarrow\emptysetitalic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ← ∅ normal-▷\triangleright Initialize to set of all completely packed paltry items to the empty set.
Jseensubscript𝐽seenJ_{\textnormal{seen}}\leftarrow\emptysetitalic_J start_POSTSUBSCRIPT seen end_POSTSUBSCRIPT ← ∅;  Jlostsubscript𝐽lostJ_{\textnormal{lost}}\leftarrow\emptysetitalic_J start_POSTSUBSCRIPT lost end_POSTSUBSCRIPT ← ∅ normal-▷\triangleright Initialize the sets of seen and lost items to the empty set.
p0𝑝0p\leftarrow 0italic_p ← 0 normal-▷\triangleright Initialize the phase, equal to the number of virtually filled slots, to zero.
q0𝑞0q\leftarrow 0italic_q ← 0 normal-▷\triangleright Initialize counter for the number of slot actualized during current phase to 00.
11\ell\leftarrow 1roman_ℓ ← 1 normal-▷\triangleright Initialize the level, showing what the algorithm considers precious, to 1111.
function Greedy(T,vlimit,slimit,isplitsuperscript𝑇subscript𝑣limitsubscript𝑠limitsubscript𝑖splitT^{\prime},v_{\textnormal{limit}},s_{\textnormal{limit}},i_{\textnormal{split}}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT , italic_v start_POSTSUBSCRIPT limit end_POSTSUBSCRIPT , italic_s start_POSTSUBSCRIPT limit end_POSTSUBSCRIPT , italic_i start_POSTSUBSCRIPT split end_POSTSUBSCRIPT) normal-▷\triangleright Greedily reduce the potential packing …
     TT{isplit}superscript𝑇superscript𝑇subscript𝑖splitT^{\prime}\leftarrow T^{\prime}\cup\{i_{\textnormal{split}}\}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ← italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∪ { italic_i start_POSTSUBSCRIPT split end_POSTSUBSCRIPT } normal-▷\triangleright … passed to the function, including the split item isplitsubscript𝑖spliti_{\textnormal{split}}italic_i start_POSTSUBSCRIPT split end_POSTSUBSCRIPT, …
     T{iTs(i)<slimit}superscript𝑇conditional-set𝑖superscript𝑇𝑠𝑖subscript𝑠limitT^{\prime}\leftarrow\{i\in T^{\prime}\mid s(i)<s_{\textnormal{limit}}\,\}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ← { italic_i ∈ italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∣ italic_s ( italic_i ) < italic_s start_POSTSUBSCRIPT limit end_POSTSUBSCRIPT } normal-▷\triangleright … after discarding anything of size at least slimitsubscript𝑠limits_{\textnormal{limit}}italic_s start_POSTSUBSCRIPT limit end_POSTSUBSCRIPT, …
     while s(T)>1𝑠superscript𝑇1s(T^{\prime})>1italic_s ( italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) > 1 or  v(T)>vlimitnormal-vsuperscriptnormal-Tnormal-′subscriptnormal-vlimitv(T^{\prime})>v_{\textnormal{limit}}italic_v ( italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) > italic_v start_POSTSUBSCRIPT limit end_POSTSUBSCRIPT  normal-▷\triangleright … to a valid solution of value at most v𝑙𝑖𝑚𝑖𝑡subscript𝑣𝑙𝑖𝑚𝑖𝑡v_{\text{limit}}italic_v start_POSTSUBSCRIPT limit end_POSTSUBSCRIPT.
          TLowYieldargmin{v(j)/s(j)jT}subscriptsuperscript𝑇LowYieldargminconditional𝑣𝑗𝑠𝑗𝑗superscript𝑇T^{\prime}_{\textnormal{LowYield}}\leftarrow\operatorname{arg\,min}\{\,v(j)/s(% j)\mid j\in T^{\prime}\,\}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT LowYield end_POSTSUBSCRIPT ← start_OPFUNCTION roman_arg roman_min end_OPFUNCTION { italic_v ( italic_j ) / italic_s ( italic_j ) ∣ italic_j ∈ italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT } normal-▷\triangleright Find items of lowest yield.
          isplit𝑝𝑜𝑝(argmin{s(j)jTLowYield})subscript𝑖split𝑝𝑜𝑝argminconditional𝑠𝑗𝑗subscriptsuperscript𝑇LowYieldi_{\textnormal{split}}\leftarrow\textrm{pop}(\operatorname{arg\,min}\{\,s(j)% \mid j\in T^{\prime}_{\textnormal{LowYield}}\,\})italic_i start_POSTSUBSCRIPT split end_POSTSUBSCRIPT ← pop ( start_OPFUNCTION roman_arg roman_min end_OPFUNCTION { italic_s ( italic_j ) ∣ italic_j ∈ italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT LowYield end_POSTSUBSCRIPT } ) normal-▷\triangleright Take a smallest among them.
          TT{isplit}superscript𝑇superscript𝑇subscript𝑖splitT^{\prime}\leftarrow T^{\prime}\smallsetminus\{i_{\textnormal{split}}\}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ← italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∖ { italic_i start_POSTSUBSCRIPT split end_POSTSUBSCRIPT } normal-▷\triangleright Separate out from Tsuperscript𝑇normal-′T^{\prime}italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT the item for the splitting slot.      
     return (T,isplit)superscript𝑇subscript𝑖split(T^{\prime},i_{\textnormal{split}})( italic_T start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT , italic_i start_POSTSUBSCRIPT split end_POSTSUBSCRIPT ) normal-▷\triangleright Return the reduced solution and the current split item.
function VirtualSize normal-▷\triangleright Returns virtual solution size, including used part of split item.
     stemps(Tpaltryj=1m{tj})subscript𝑠temp𝑠subscript𝑇paltrysuperscriptsubscript𝑗1𝑚subscript𝑡𝑗s_{\textnormal{temp}}\leftarrow s(T_{\textnormal{paltry}}\cup\bigcup_{j=1}^{m}% \{\,t_{j}\})italic_s start_POSTSUBSCRIPT temp end_POSTSUBSCRIPT ← italic_s ( italic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ∪ ⋃ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT { italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT } ) normal-▷\triangleright Size of current virtual solution, excluding split item.
     rmin{1,(1stemp)/s(t0)}𝑟11subscript𝑠temp𝑠subscript𝑡0r\leftarrow\min\{1,(1-s_{\textnormal{temp}})/s(t_{0})\}italic_r ← roman_min { 1 , ( 1 - italic_s start_POSTSUBSCRIPT temp end_POSTSUBSCRIPT ) / italic_s ( italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) } normal-▷\triangleright Calculate the fraction r𝑟ritalic_r of split item to be used.
     return s(Tpaltryj=1m{tj})+rs(t0)𝑠subscript𝑇paltrysuperscriptsubscript𝑗1𝑚subscript𝑡𝑗𝑟𝑠subscript𝑡0s(T_{\textnormal{paltry}}\cup\bigcup_{j=1}^{m}\{\,t_{j}\})+r\cdot s(t_{0})italic_s ( italic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ∪ ⋃ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT { italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT } ) + italic_r ⋅ italic_s ( italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) normal-▷\triangleright Return the complete virtual solution.
function Actual normal-▷\triangleright Returns online solution of packed paltry items and items in …
     return Tpaltryj=0m{tjbactual,j=1}subscript𝑇paltrysuperscriptsubscript𝑗0𝑚conditional-setsubscript𝑡𝑗subscript𝑏actual𝑗1T_{\textnormal{paltry}}\cup\bigcup_{j=0}^{m}\{\,t_{j}\mid b_{\textnormal{% actual},j}=1\,\}italic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ∪ ⋃ start_POSTSUBSCRIPT italic_j = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT { italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∣ italic_b start_POSTSUBSCRIPT actual , italic_j end_POSTSUBSCRIPT = 1 } normal-▷\triangleright … actualized slots, ignoring level losses.
Algorithm 2 ProPack (Continuation)
while I𝐼I\neq\emptysetitalic_I ≠ ∅  normal-▷\triangleright As long as the instance has not ended, …
     i𝑝𝑜𝑝(I)𝑖𝑝𝑜𝑝𝐼i\leftarrow\textrm{pop}(I)italic_i ← pop ( italic_I ) normal-▷\triangleright … take the next item in the input sequence.
     if bsmall=1subscript𝑏small1\ b_{\textnormal{small}}=1italic_b start_POSTSUBSCRIPT small end_POSTSUBSCRIPT = 1 normal-▷\triangleright If it is advised to just pack small items of size at most εsmallsubscript𝜀small\varepsilon_{\textnormal{small}}italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT, …
          (Tpaltry,t0)Greedy(Tpaltry{i},,εsmall,t0)subscript𝑇paltrysubscript𝑡0Greedysubscript𝑇paltry𝑖subscript𝜀smallsubscript𝑡0(T_{\textnormal{paltry}},t_{0})\leftarrow\textsc{Greedy}(T_{\textnormal{paltry% }}\cup\{i\},\infty,\varepsilon_{\textnormal{small}},t_{0})( italic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT , italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) ← Greedy ( italic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ∪ { italic_i } , ∞ , italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT , italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) normal-▷\triangleright … then do so greedily, …
          continue normal-▷\triangleright and continue this way until the instance ends.      
     JseenJseen{i}subscript𝐽seensubscript𝐽seen𝑖J_{\textnormal{seen}}\leftarrow J_{\textnormal{seen}}\cup\{i\}italic_J start_POSTSUBSCRIPT seen end_POSTSUBSCRIPT ← italic_J start_POSTSUBSCRIPT seen end_POSTSUBSCRIPT ∪ { italic_i } normal-▷\triangleright Update the set of items seen so far.
     blevelUp0subscript𝑏levelUp0b_{\textnormal{levelUp}}\leftarrow 0italic_b start_POSTSUBSCRIPT levelUp end_POSTSUBSCRIPT ← 0 normal-▷\triangleright Initialize the Boolean checking for a level change to zero.
     if W(i)>𝑊𝑖W(i)>\ellitalic_W ( italic_i ) > roman_ℓ  normal-▷\triangleright If index of new item’s comboclass is greater than current level, …
          W(i)𝑊𝑖\ell\leftarrow W(i)roman_ℓ ← italic_W ( italic_i ) normal-▷\triangleright … then this index becomes the new level.
          blevelUp1subscript𝑏levelUp1b_{\textnormal{levelUp}}\leftarrow 1italic_b start_POSTSUBSCRIPT levelUp end_POSTSUBSCRIPT ← 1 normal-▷\triangleright Flag the level change.      
     \triangleright Compute estimated upper bound U𝑈Uitalic_U for v(S)𝑣𝑆v(S)italic_v ( italic_S ) based on advice and current level \ellroman_ℓ:
     Uv1j=1m(1εspread)V(1)+M(uj)K/(1εround(1+/εpaltry)p=0mfp)U\leftarrow v_{1}\sum_{j=1}^{m}(1-\varepsilon_{\textnormal{spread}})^{V(1)+M(u% _{j})-\ell K}/(1-\varepsilon_{\textnormal{round}}(1+/\varepsilon_{\textnormal{% paltry}})-\sum_{p^{\prime}=0}^{m}f_{p^{\prime}})italic_U ← italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∑ start_POSTSUBSCRIPT italic_j = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT ( 1 - italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT italic_V ( 1 ) + italic_M ( italic_u start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) - roman_ℓ italic_K end_POSTSUPERSCRIPT / ( 1 - italic_ε start_POSTSUBSCRIPT round end_POSTSUBSCRIPT ( 1 + / italic_ε start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ) - ∑ start_POSTSUBSCRIPT italic_p start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT )
     \triangleright Compute optimal solution value attainable with items seen at the current level:
     v𝑚𝑎𝑥max{v(S)SJ,s(S)1}subscript𝑣𝑚𝑎𝑥conditional𝑣superscript𝑆superscript𝑆𝐽𝑠superscript𝑆1v_{\text{max}}\leftarrow\max\{\,v(S^{\prime})\mid S^{\prime}\subseteq J,s(S^{% \prime})\leq 1\,\}italic_v start_POSTSUBSCRIPT max end_POSTSUBSCRIPT ← roman_max { italic_v ( italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) ∣ italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ⊆ italic_J , italic_s ( italic_S start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) ≤ 1 }
     if vmax>Usubscript𝑣𝑈v_{\max}>Uitalic_v start_POSTSUBSCRIPT roman_max end_POSTSUBSCRIPT > italic_U  normal-▷\triangleright If this value exceeds the upper bound, …
          +11\ell\leftarrow\ell+1roman_ℓ ← roman_ℓ + 1 normal-▷\triangleright … then increase the level by one …
          blevelUp1subscript𝑏levelUp1b_{\textnormal{levelUp}}\leftarrow 1italic_b start_POSTSUBSCRIPT levelUp end_POSTSUBSCRIPT ← 1 normal-▷\triangleright … and flag the level change.      
     if blevelUp=1subscript𝑏levelUp1b_{\textnormal{levelUp}}=1italic_b start_POSTSUBSCRIPT levelUp end_POSTSUBSCRIPT = 1  normal-▷\triangleright If new item has triggered a level change, then …
          p0𝑝0p\leftarrow 0italic_p ← 0; q0𝑞0q\leftarrow 0italic_q ← 0; Tpaltrysubscript𝑇paltryT_{\textnormal{paltry}}\leftarrow\emptysetitalic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ← ∅; t00subscript𝑡00t_{0}\leftarrow 0italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ← 0 normal-▷\triangleright … reset the algorithm by re-initializing …
          for j{0,1,,m}𝑗01𝑚j\in\{0,1,\dots,m\}italic_j ∈ { 0 , 1 , … , italic_m }  normal-▷\triangleright … almost everything, including …
               tj0;bactual,j0formulae-sequencesubscript𝑡𝑗0subscript𝑏actual𝑗0t_{j}\leftarrow 0;b_{\textnormal{actual},j}\leftarrow 0italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ← 0 ; italic_b start_POSTSUBSCRIPT actual , italic_j end_POSTSUBSCRIPT ← 0 normal-▷\triangleright … the slots and their actualization states, …           
          JlostJseensubscript𝐽lostsubscript𝐽seenJ_{\textnormal{lost}}\leftarrow J_{\textnormal{seen}}italic_J start_POSTSUBSCRIPT lost end_POSTSUBSCRIPT ← italic_J start_POSTSUBSCRIPT seen end_POSTSUBSCRIPT; normal-▷\triangleright … excepting only the level and items seen so far, and, …
          IIcopy𝐼subscript𝐼copyI\leftarrow I_{\textnormal{copy}}italic_I ← italic_I start_POSTSUBSCRIPT copy end_POSTSUBSCRIPT normal-▷\triangleright … after restoring the input sequence to the original state, …
          continue normal-▷\triangleright … re-start the algorithm, remembering the level and all items lost.      
     if W(i)<𝑊𝑖\ W(i)<\ellitalic_W ( italic_i ) < roman_ℓ normal-▷\triangleright If the new item is provenly paltry, then calculate …
          LU(12εspread/εsmall)𝐿𝑈12subscript𝜀spreadsubscript𝜀smallL\leftarrow U(1-2\varepsilon_{\textnormal{spread}}/\varepsilon_{\textnormal{% small}})italic_L ← italic_U ( 1 - 2 italic_ε start_POSTSUBSCRIPT spread end_POSTSUBSCRIPT / italic_ε start_POSTSUBSCRIPT small end_POSTSUBSCRIPT ) normal-▷\triangleright … a lower bound on v(S)𝑣𝑆v(S)italic_v ( italic_S ) close to U𝑈Uitalic_U, and …
          vvalueLimitLp=0pfpsubscript𝑣valueLimit𝐿superscriptsubscriptsuperscript𝑝0𝑝subscript𝑓superscript𝑝v_{\textnormal{valueLimit}}\leftarrow L\cdot\sum_{p^{\prime}=0}^{p}f_{p^{% \prime}}italic_v start_POSTSUBSCRIPT valueLimit end_POSTSUBSCRIPT ← italic_L ⋅ ∑ start_POSTSUBSCRIPT italic_p start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_p start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT normal-▷\triangleright … use it to derive an upper bound on the …
normal-▷\triangleright … targeted total value of paltry items to be packed before up+1subscript𝑢𝑝1u_{p+1}italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT is presented.
          t0t0superscriptsubscript𝑡0subscript𝑡0t_{0}^{\prime}\leftarrow t_{0}italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ← italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT normal-▷\triangleright Store item in splitting slot to see if it will be changed …
          (Tpaltry,t0)Greedy(Tpaltry{i},vvalueLimit,,t0)subscript𝑇paltrysubscript𝑡0Greedysubscript𝑇paltry𝑖subscript𝑣valueLimitsubscript𝑡0(T_{\textnormal{paltry}},t_{0})\leftarrow\textsc{Greedy}(T_{\textnormal{paltry% }}\cup\{i\},v_{\textnormal{valueLimit}},\infty,t_{0})( italic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT , italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) ← Greedy ( italic_T start_POSTSUBSCRIPT paltry end_POSTSUBSCRIPT ∪ { italic_i } , italic_v start_POSTSUBSCRIPT valueLimit end_POSTSUBSCRIPT , ∞ , italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) normal-▷\triangleright … by the update.
          if t0t0superscriptsubscript𝑡0subscript𝑡0\ t_{0}^{\prime}\neq t_{0}italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ≠ italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and 0{ap,q,,ap,mp}0subscript𝑎𝑝𝑞subscript𝑎𝑝subscript𝑚𝑝0\in\{a_{p,q},\dots,a_{p,m_{p}}\}0 ∈ { italic_a start_POSTSUBSCRIPT italic_p , italic_q end_POSTSUBSCRIPT , … , italic_a start_POSTSUBSCRIPT italic_p , italic_m start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT end_POSTSUBSCRIPT } normal-▷\triangleright If so, and splitting slot is to be …
               while ap,q0subscript𝑎𝑝𝑞0\ a_{p,q}\neq 0italic_a start_POSTSUBSCRIPT italic_p , italic_q end_POSTSUBSCRIPT ≠ 0 normal-▷\triangleright … actualized or has been, then re-virtualize all …
                    bactual,q0subscript𝑏actual𝑞0b_{\textnormal{actual},q}\leftarrow 0italic_b start_POSTSUBSCRIPT actual , italic_q end_POSTSUBSCRIPT ← 0; qq1𝑞𝑞1q\leftarrow q-1italic_q ← italic_q - 1 normal-▷\triangleright … recent slots down to the splitting slot.                          
          if ap,q=0 and s(Actual)+s(t0)1subscript𝑎𝑝𝑞0 and 𝑠Actual𝑠subscript𝑡01\ a_{p,q}=0\textbf{ and }s(\textsc{Actual})+s(t_{0})\leq 1italic_a start_POSTSUBSCRIPT italic_p , italic_q end_POSTSUBSCRIPT = 0 and italic_s ( Actual ) + italic_s ( italic_t start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) ≤ 1 normal-▷\triangleright If advised and possible, …
               bactual,01subscript𝑏actual01b_{\textnormal{actual},0}\leftarrow 1italic_b start_POSTSUBSCRIPT actual , 0 end_POSTSUBSCRIPT ← 1 normal-▷\triangleright … then (re-)actualize the virtual slot, and …
               qq+1𝑞𝑞1q\leftarrow q+1italic_q ← italic_q + 1 normal-▷\triangleright … increment the counter of slots actualized in the phase.                
Algorithm 2 ProPack (Continuation)
     if W(i)=𝑊𝑖\ W(i)=\ellitalic_W ( italic_i ) = roman_ℓ normal-▷\triangleright If the newly arriving item is presumably precious …
          if M(i)=M(up+1)𝑀𝑖𝑀subscript𝑢𝑝1\ M(i)=M(u_{p+1})italic_M ( italic_i ) = italic_M ( italic_u start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT ) normal-▷\triangleright … and also matches the next empty slot …
               if VirtualSize+si1VirtualSizesubscript𝑠𝑖1\ \textsc{VirtualSize}+s_{i}\leq 1VirtualSize + italic_s start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≤ 1 normal-▷\triangleright … without exceeding the knapsack capacity, …
                    jp+1𝑗𝑝1j\leftarrow p+1italic_j ← italic_p + 1 normal-▷\triangleright … then store the number of the slot to be filled virtually, …
                    pp+1𝑝𝑝1p\leftarrow p+1italic_p ← italic_p + 1 normal-▷\triangleright … enter the next phase, …
                    q0𝑞0q\leftarrow 0italic_q ← 0 normal-▷\triangleright … and accordingly reset the actualization counter.                
          elsenormal-▷\triangleright If new item does not match next empty slot, find among all …
               Jmatches{j{1,2,,m}M(tj)=M(i)}subscript𝐽matchesconditional-setsuperscript𝑗12𝑚𝑀subscript𝑡superscript𝑗𝑀𝑖J_{\textnormal{matches}}\leftarrow\{\,j^{\prime}\in\{1,2,\dots,m\}\mid M(t_{j^% {\prime}})=M(i)\,\}italic_J start_POSTSUBSCRIPT matches end_POSTSUBSCRIPT ← { italic_j start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∈ { 1 , 2 , … , italic_m } ∣ italic_M ( italic_t start_POSTSUBSCRIPT italic_j start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT ) = italic_M ( italic_i ) }normal-▷\triangleright … matching slots …
               j𝑝𝑜𝑝(argmax{s(tj)jJmatches})𝑗𝑝𝑜𝑝conditional𝑠subscript𝑡superscript𝑗superscript𝑗subscript𝐽matchesj\leftarrow\textrm{pop}(\arg\max\{\,s(t_{j^{\prime}})\mid j^{\prime}\in J_{% \textnormal{matches}}\,\})italic_j ← pop ( roman_arg roman_max { italic_s ( italic_t start_POSTSUBSCRIPT italic_j start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT end_POSTSUBSCRIPT ) ∣ italic_j start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∈ italic_J start_POSTSUBSCRIPT matches end_POSTSUBSCRIPT } ) normal-▷\triangleright … one with a largest item.
               tjisubscript𝑡𝑗𝑖t_{j}\leftarrow iitalic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ← italic_i normal-▷\triangleright Fill the new item into the right slot, replacing any present item.           
          if ap,q=j and s(Actual)+s(tj)1subscript𝑎𝑝𝑞𝑗 and 𝑠Actual𝑠subscript𝑡𝑗1\ a_{p,q}=j\textbf{ and }s(\textsc{Actual})+s(t_{j})\leq 1italic_a start_POSTSUBSCRIPT italic_p , italic_q end_POSTSUBSCRIPT = italic_j and italic_s ( Actual ) + italic_s ( italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) ≤ 1 normal-▷\triangleright If advised and possible, …
               bactual,01subscript𝑏actual01b_{\textnormal{actual},0}\leftarrow 1italic_b start_POSTSUBSCRIPT actual , 0 end_POSTSUBSCRIPT ← 1 normal-▷\triangleright … then actualize the new filling and …
               qq+1𝑞𝑞1q\leftarrow q+1italic_q ← italic_q + 1 normal-▷\triangleright … update the actualization counter.                
return ActualJlostActualsubscript𝐽lost\textsc{Actual}\smallsetminus J_{\textnormal{lost}}Actual ∖ italic_J start_POSTSUBSCRIPT lost end_POSTSUBSCRIPT normal-▷\triangleright Return the solution, omitting any items from the lost levels.

References

  • [1] Richard Bellman. Dynamic Programming. Princeton University Press, Princeton, NJ, USA, 1957.
  • [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, 2021.
  • [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.
  • [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.
  • [5] Allan Borodin and Ran El-Yaniv. Online computation and competitive analysis. Cambridge University Press, 1998.
  • [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.
  • [7] Marek Cygan, Łukasz Jeż, and Jiří Sgall. Online knapsack revisited. Theory Comput. Syst., 58(1):153–190, 2016.
  • [8] George B. Dantzig. Discrete-variable extremum problems. Operations Research, 5(2):266–277, 1957.
  • [9] Yuval Emek, Pierre Fraigniaud, Amos Korman, and Adi Rosén. Online computation with advice. Theoretical Computer Science, 412(24):2642–2656, 2011.
  • [10] Xin Han, Yasushi Kawase, and Kazuhisa Makino. Online unweighted knapsack problem with removal cost. Algorithmica, 70(1):76–91, 2014.
  • [11] Xin Han, Yasushi Kawase, and Kazuhisa Makino. Randomized algorithms for online knapsack problems. Theoretical Computer Science, 562:395–405, 2015.
  • [12] Xin Han, Yasushi Kawase, Kazuhisa Makino, and He Guo. Online removable knapsack problem under convex function. Theoretical Computer Science, 540:62–69, 2014.
  • [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.
  • [14] Xin Han and Kazuhisa Makino. Online removable knapsack with limited cuts. Theoretical Computer Science, 411(44-46):3956–3964, 2010.
  • [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.
  • [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.
  • [17] Kazuo Iwama and Shiro Taketomi. Removable online knapsack problems. In ICALP 2002, number 2380 in LNCS, pages 293–305. Springer, 2002.
  • [18] Kazuo Iwama and Guochuan Zhang. Online knapsack with resource augmentation. Information Processing Letters, 110(22):1016–1020, 2010.
  • [19] Richard M. Karp. Reducibility among combinatorial problems. In Complexity of computer computations, pages 85–103. Plenum, 1972.
  • [20] Dennis Komm. An Introduction to Online Computation – Determinism, Randomization, Advice. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2016.
  • [21] Alberto Marchetti-Spaccamela and Carlo Vercellis. Stochastic on-line knapsack problems. Mathematical Programming, 68:73–104, 1995.
  • [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.
  • [23] Herbert Ellis Robbins. A remark on Stirling’s formula. American Mathematical Monthly, 62:26–29, 1955.
  • [24] 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.