arXiv:2610.40290cs.DSOct 2026

Manuscript Offprint

arXiv:2610.40290

Leveraging Recourse and Size Bounds for OnlineKnapsack with Removable Items

Dimitris Fotakis, Laurent Gourvès, Aris Pagourtzis, Panagiotis Patsilinakos

Dimitris Fotakis 1,2^{1,2}[0000-0001-6864-8960], Laurent Gourvès 3^{3}[0000-0002-5076-1583], Aris Pagourtzis 1,2^{1,2}[0000-0002-6220-3722], and Panagiotis Patsilinakos 3^{3}[0009-0007-9540-2334]

1^{1} National Technical University of Athens, Greece

2^{2} Archimedes, Athena Research Center, Greece

3^{3} Université Paris-Dauphine, Université PSL, CNRS, LAMSADE, Paris, France

fotakis@cs.ntua.gr, laurent.gourves@dauphine.fr,

pagour@cs.ntua.gr, panagiotis.patsilinakos@dauphine.psl.eu

Abstract. In the online unweighted knapsack problem, items arrive sequentially and must be accepted or rejected immediately for a bounded-capacity knapsack, aiming to maximize the total size of accepted items. When decisions are irrevocable, no algorithm achieves a non-trivial competitive ratio. An essential relaxation that circumvents this impossibility is to allow previously accepted items to be removed from the knapsack (a.k.a. removal). In this work, we investigate possible further improvements on the competitive ratio with removal by bringing together two other previously proposed model extensions: knowledge of an upper bound on the item sizes (a.k.a. bound awareness) and ability to reinsert previously rejected items (a.k.a. recourse). Our contributions are twofold. First, we establish close upper and lower bounds on the competitive ratio under bound awareness, removal and recourse. We show that significant improvements on the best known competitive ratio are possible when the upper bound on the item sizes is not too restrictive and only few uses of recourse are available. Second, we introduce the notion of adaptive online algorithms which do not require to know any upper bound on the item sizes but still achieve performance guarantees comparable to the ones obtained under the bound awareness model.

Keywords: Unweighted Knapsack · Adaptive Online Algorithms · Removable Items · Recourse

1 Introduction

We study the online unweighted knapsack problem in which some items, to be placed in a knapsack of capacity 1, are disclosed over time. Each item oio_i has a size ∣oi∣∈(0,1]|o_i| \in (0,1]. Starting from an initial empty set SS, item oio_i is revealed at round ii during which it must be decided to pack oio_i in SS or not. The value of SS, denoted by v(S)v(S) and defined as ∑oi∈S∣oi∣\sum_{o_i \in S} |o_i|, should never exceed the capacity.

∗^{*} A preliminary version of this work appeared in IWOCA 2026 [11].

D. Fotakis et al.

The goal is to maximize v(S)v(S) when the instance stops, given that the number of items is not known in advance.

The competitive ratio (CR for short) ρ\rho of a deterministic online algorithm is the worst case ratio between the value of its solution S^\hat{S} and the value of an optimal solution S∗:ρ:=v(S^)/v(S∗)S^*: \rho := v(\hat{S})/v(S^*). Every CR of this article is in [0, 1]. Unfortunately, no deterministic algorithm can exhibit a non-trivial CR (i.e., bounded away from zero by any constant) 4^4 for the online unweighted knapsack problem [19]. This is mostly due to the fact that decisions are irrevocable. An essential relaxation that circumvents this impossibility is to allow items to be removed from SS after their insertion. Iwama and Taketomi showed that the online unweighted knapsack problem with removable items admits a ϕ−1\phi^{-1}-competitive algorithm with ϕ−1:=5−12≈0.618\phi^{-1} := \frac{\sqrt{5}-1}{2} \approx 0.618, and that no deterministic online algorithm can achieve a better CR [17].

Refined models have been proposed for improving upon the ϕ−1\phi^{-1}-competitive algorithm. One such model is recourse, in which a recourse operation allows one item that was previously rejected to be eventually packed. Concretely, an item may be discarded from the solution upon its arrival and temporarily stored in a buffer. Subsequently, this item may eventually be inserted into the solution, which requires a so-called recourse operation. Items removed after being packed can also be stored in the buffer and reinserted by a recourse operation.

In contrast to the unlimited number of removals, the number of recourse operations is typically small, as such operations can be costly in practice. Böckenhauer et al. have demonstrated (among other results) that the online unweighted knapsack problem with at most r∈{1,2,3}r \in \{1, 2, 3\} recourse operation(s) and removable 5^5 items admits a deterministic r+1r+2\frac{r+1}{r+2}-competitive algorithm, and that no algorithm can achieve better CR with rr recourse operation(s) [6, 7]. Consequently, a single recourse operation suffices to improve upon the ratio of ϕ−1\phi^{-1}.

The second model assumes that item sizes are upper-bounded by a value strictly smaller than the knapsack capacity. Moreover, when dealing repeatedly with such bounded instances, this bound can be known in advance and with precision.

Accordingly, bound awareness refers to the ability to know from the outset an upper bound u∈(0,1]u \in (0, 1] such that ∣oi∣≤u|o_i| \leq u holds for every item oio_i. As uu approaches 0, the instance becomes increasingly constrained; however, the potential errors of an algorithm have a diminishing impact on the CR. When items are removable and their sizes are upper bounded by uu, Gourvès and Pagourtzis [12] proposed an algorithm parameterized by uu whose CR ρ(u)\rho(u) improves upon ϕ−1\phi^{-1} whenever u≤ϕ−1u \leq \phi^{-1}, given that ϕ−1\phi^{-1} is known to be the optimal CR (without recourse) when u∈(ϕ−1,1]u \in (\phi^{-1}, 1] [17]. Figure 1 comprises an illustration of ρ(u)\rho(u) while its formal definition is given in Theorem 3.

4^{4} Suppose a first item o1o_1 is released. If o1o_1 is not packed, then the instance stops. Otherwise, a second item o2o_2 of size 1 arrives and the instance stops. Clearly, o2o_2 cannot be packed because of o1o_1. The CR of any deterministic algorithm for this instance is at most ∣o1∣=max⁡(0/∣o1∣,∣o1∣/1)|o_1| = \max(0/|o_1|, |o_1|/1) but ∣o1∣|o_1| can be arbitrarily close to 0.

5^{5} Recourse operations are useless without the removability property [7].

In comparison with the r+1r+2\frac{r+1}{r+2}-competitive algorithm of Böckenhauer et al., ρ(u)\rho(u) exceeds 2/3 for u<0.6u < 0.6, exceeds 3/4 for u<0.4u < 0.4, and exceeds 4/5 for u<5/17u < 5/17.

The approaches of [7] and [12] are complementary yet incomparable: the former considers recourse without bound awareness, while the latter assumes bound awareness but allows no recourse.