Introduction

One of the fundamental problems in combinatorial optimization is bin packing. Given a list $$I=(x_1,\ldots ,x_n)$$ of n items with sizes from (0, 1] and an infinite number of unit-sized bins, the goal is to pack all items into the minimum number of bins. Formally, a packing is an assignment of items to bins such that for any bin, the sum of assigned items is at most 1. While an offline algorithm has complete information about the items in advance, in the online variant, items are revealed one by one. An online algorithm must pack $$x_i$$ without knowing the items following $$x_i$$ and without modifying the packing of previous items.

Bin packing was mentioned first by Ullman [38]. As the problem is strongly $${\mathsf{N}}{\mathsf{P}}$$-complete [17], research mainly focuses on efficient approximation algorithms. The offline problem is well understood and admits even approximation schemes [20, 26, 39]. The online variant is still a very active field in the community [7], as the asymptotic approximation ratio of the best online algorithm is still unknown [3, 4]. The first approximation algorithms for the problem, First Fit and Best Fit, have been analyzed in [38] and a subsequent work by Garey et al. [16]. Johnson published the Next Fit algorithm briefly afterwards [24]. All of these algorithms work in the online setting and attract by their simplicity: Suppose that $$x_i$$ is the current item to pack. The algorithms work as follows:

$$\mathrm{Best Fit (BF)}$$:

Pack $$x_i$$ into the fullest bin possible, open a new bin if necessary.

$$\mathrm{First Fit (FF)}$$:

Maintain a list of bins ordered by the time at which they were opened. Pack $$x_i$$ into the first possible bin in this list, open a new bin if necessary.

$$\mathrm{Next Fit (NF)}$$:

Pack $$x_i$$ into the bin opened most recently if possible; open a new bin if necessary.

Another important branch of online algorithms is based on the harmonic algorithm [29]. This approach has been massively tuned and generalized in a sequence of papers [3, 35, 36].

To measure the performance of an algorithm, different metrics exist. For an algorithm $$\mathcal{A}$$, let $$\mathcal{A}(I)$$ and $${{\mathrm{OPT}}}(I)$$ denote the number of bins used by $$\mathcal{A}$$ and an optimal offline algorithm, respectively, to pack the items in I. Let $$\mathcal{I}$$ denote the set of all item lists. The most common metric for bin packing algorithms is the asymptotic (approximation) ratio defined as

\begin{aligned} R_{\mathcal{A}}^\infty = \limsup _{k \rightarrow \infty } \sup _{I \in \mathcal{I}} \{ \mathcal{A}(I) / {{\mathrm{OPT}}}(I) \mid {{\mathrm{OPT}}}(I)=k \} . \end{aligned}

Note that $$R_{\mathcal{A}}^\infty$$ focuses on instances where $${{\mathrm{OPT}}}(I)$$ is large. This avoids anomalies typically occurring on lists that can be packed optimally into few bins. However, many bin packing algorithms are also studied in terms of the stronger absolute (approximation) ratio

\begin{aligned} R_{\mathcal{A}} = \sup _{I \in \mathcal{I}} \{ \mathcal{A}(I) / {{\mathrm{OPT}}}(I) \} . \end{aligned}

Here, the approximation ratio $$R_{\mathcal{A}}$$ must hold for each possible input. An online algorithm with (absolute or asymptotic) ratio $$\alpha$$ is also called $$\alpha$$-competitive.

Table 1 shows the asymptotic and absolute approximation ratios of the three heuristics Best Fit, First Fit, and Next Fit. Interestingly, for these algorithms both metrics coincide. While the asymptotic ratios of Best Fit and Next Fit were established already in early work [25], the absolute ratios have been settled rather recently [11, 12].

Note that the above performance measures are clearly worst-case orientated. An adversary can choose items and present them in an order that forces the algorithm into its worst possible behavior. In the case of Best Fit, hardness examples are typically based on lists where small items occur before large items [16]. In contrast, it is known that Best Fit performs significantly better if items appear in non-increasing order [25]. For real-world instances, it seems overly pessimistic to assume adversarial order of input. Moreover, sometimes worst-case ratios hide interesting properties of algorithms that occur in average cases. This led to the development of alternative measures.

A natural approach that goes beyond worst-case was introduced by Kenyon [28] in 1996. In the model of random order arrivals, the adversary can still specify the items, but the arrival order is permuted randomly. The performance measure described in [28] is based on the asymptotic ratio, but can be applied to absolute ratios likewise. In the resulting performance metrics, an algorithm must satisfy its performance guarantee in expectation over all permutations. We define

\begin{aligned} RR_{\mathcal{A}}^\infty&= \limsup _{k \rightarrow \infty } \sup _{I \in \mathcal{I}} \left\{ {{\mathrm{E}}}[\mathcal{A}(I^\sigma )] / {{\mathrm{OPT}}}(I) \mid {{\mathrm{OPT}}}(I)=k \right\} \quad \text{and} \\ RR_{\mathcal{A}}&= \sup _{I \in \mathcal{I}} \left\{ {{\mathrm{E}}}[\mathcal{A}(I^\sigma )] / {{\mathrm{OPT}}}(I) \right\} \end{aligned}

as the asymptotic random order ratio and the absolute random order ratio of algorithm $$\mathcal{A}$$, respectively. Here, $$\sigma$$ is drawn uniformly at random from $$\mathcal{S}_n$$, the set of permutations of n elements, and $$I^\sigma = (x_{\sigma (1)},\ldots ,x_{\sigma (n)})$$ is the permuted list.

Related Work

The following literature review only covers results that are most relevant to our work. We refer the reader to the article [8] by Coffman et al. for an extensive survey on (online) bin packing. For further problems studied in the random order model, see [19].

Bin packing Kenyon introduced the notion of asymptotic random order ratio $$RR{_{\mathcal{A}}^\infty}$$ for online bin packing algorithms in [28]. For the Best Fit algorithm, Kenyon proves an upper bound of 1.5 on $$RR{_{\mathrm{BF}}^\infty}$$, demonstrating that random order significantly improves upon $$R_{\mathrm{BF}}^\infty = 1.7$$. However, it is conjectured in [8, 28] that the actual random order ratio is close to 1.15. The proof of the upper bound crucially relies on the following scaling property: With high probability, the first t items of a random permutation can be packed optimally into $$\frac{t}{n} {{\mathrm{OPT}}}(I) + o(n)$$ bins. On the other side, Kenyon proves that $$RR{_{\mathrm{BF}}^\infty} \ge 1.08$$. This lower bound is obtained from the weaker i.i.d.-model, where item sizes are drawn independently and identically distributed according to a fixed probability distribution.

Coffman et al. [9] analyzed next-fit in the random order model and showed that $$RR{_{\mathrm{NF}}^\infty} = 2$$, matching the asymptotic approximation ratio $$RR{_{\mathrm{NF}}^\infty} = 2$$ (see Table 1). Fischer and Röglin [14] obtained analogous results for Worst Fit [24] and Smart Next Fit [34]. Therefore, all three algorithms fail to perform better in the random order model than in the adversarial model.

A natural property of bin packing algorithms is monotonicity, which holds if an algorithm never uses fewer bins to pack $$I^{\prime}$$ than for I, where $$I^{\prime}$$ is obtained from I by increasing item sizes. Murgolo [33] showed that next-fit is monotone, while Best Fit and First Fit are not monotone in general. The concept of monotonicity also arises in related optimization problems, such as scheduling [18] and bin covering [14].

Bin covering The dual problem of bin packing is bin covering, where the goal is to cover as many bins as possible. A bin is covered if it receives items of total size at least 1. Here, a well-studied and natural algorithm is Dual Next Fit (DNF). In the adversarial setting, DNF has asymptotic ratio $$R{_{\mathrm{DNF}}}^\infty = 1/2$$ which is best possible for any online algorithm [6]. Under random arrival order, Christ et al. [6] showed that $$RR_{\mathrm{DNF}}^\infty \le 4/5$$. This upper bound was improved later by Fischer and Röglin [13] to $$RR_{\mathrm{DNF}}^\infty \le 2/3$$. The same group of authors further showed that $$RR_{\mathrm{DNF}}^\infty \ge 0.501$$, i.e., DNF performs strictly better under random order than in the adversarial setting [14].

Matching Online matching can be seen as the key problem in the field of online algorithms [32]. Inspired by the seminal work of Karp et al. [27], who introduced the online bipartite matching problem with one-sided arrivals, the problem has been studied in many generalizations. Extensions include fully online models [15, 21, 22], vertex-weighted versions [1, 23] and, most relevant to our work, random arrival order [23, 31].

Our Results

While several natural algorithms fail to perform better in the random order model, Best Fit emerges as a strong candidate in this model. The existing gap between 1.08 and 1.5 clearly leaves room for improvement; closing (or even narrowing) this gap has been reported as challenging and interesting open problem in several papers [6, 9, 19]. To the best of our knowledge, our work provides the first new results on the problem since the seminal work by Kenyon. Below we describe our results in detail. In the following theorems, the expectation is over the permutation $$\sigma$$ drawn uniformly at random.

If all items are strictly larger than 1/3, the objective is to maximize the number of bins containing two items. This problem is closely related to finding a maximum-cardinality matching in a vertex-weighted graph; our setting corresponds with the fully online model studied in [1] under random order arrival. Also in the analysis from [28], this special case arises. There, it is sufficient to argue that $${{\mathrm{BF}}}(I) \le \frac{3}{2} {{\mathrm{OPT}}}(I) + 1$$ under adversarial order. We show that Best Fit performs significantly better under random arrival order:

Theorem 1

For any list I of items larger than 1/3, we have $${{\mathrm{E}}}[{{\mathrm{BF}}}(I^\sigma )] \le \frac{5}{4} {{\mathrm{OPT}}}(I) + \frac{1}{4}.$$

The proof of Theorem 1 is developed in Sect. 3 and based on several pillars. First, we show that Best Fit is monotone in this case (Proposition 3), unlike in the general case [33]. This property can be used to restrict the analysis to instances with well-structured optimal packing. The main technical ingredient is introduced in Sect. 3.3 with Lemma 2 as the key lemma. Here, we show that Best Fit maintains some parts of the optimal packing, depending on certain structures of the input sequence. We identify these structures and show that they occur with constant probability for a random permutation. It seems likely that this property can be used in a similar form to improve the bound $$RR^{\infty }_{\mathrm{BF}} \le 1.5$$ for the general case: Under adversarial order, much hardness comes from relatively large items of size more than 1/3; in fact, if all items have size at most 1/3, an easy argument shows $$\nicefrac {4}{3}$$-competitiveness even for adversarial arrival order [25].

Moreover, it is natural to ask for the performance in terms of absolute random order ratio. It is a surprising and rather recent result that for Best Fit, absolute and asymptotic ratios coincide. The result of [28] has vast additive terms and it seems that new techniques are required for insights into the absolute random order ratio. In Sect. 3.4, we investigate the absolute random order ratio for items larger than 1/3 and obtain the following result.

Proposition 1

For any list I of items larger than 1/3, we have $${{\mathrm{E}}}[{{\mathrm{BF}}}(I^\sigma )] \le \frac{21}{16} {{\mathrm{OPT}}}(I).$$

The upper bound of 21/16 is complemented by the following lower bound.

Proposition 2

There is a list I of items larger than 1/3 with $${{\mathrm{E}}}[{{\mathrm{BF}}}(I^\sigma )] > \frac{6}{5} {{\mathrm{OPT}}}(I).$$

The proof of Proposition 2 is given in Appendix B.

We also make progress on the hardness side in the general case, which is presented in Sect. 4. First, we show that the asymptotic random order ratio is larger than 1.10, improving the previous lower bound of 1.08 from [28].

Theorem 2

The asymptotic random order ratio of Best Fit is $$RR{_{\mathrm{BF}}^\infty} > 1.10.$$

As it is typically challenging to obtain lower bounds in the random order model, we exploit the connection to the i.i.d.-model. Here, items are drawn independently and identically distributed according to a fixed probability distribution. By defining an appropriate distribution, the problem can be analyzed using Markov chain techniques. Moreover, we present the first lower bound on the absolute random order ratio:

Theorem 3

The absolute random order ratio of Best Fit is $$RR_{\mathrm{BF}} \ge 1.30.$$

Interestingly, our lower bound on the absolute random order ratio is notably larger than in the asymptotic case (see [28] and Theorem 2). This suggests either

• a significant discrepancy between $$RR_{\mathrm{BF}}$$ and $$RR{_{\mathrm{BF}}^\infty}$$, which is in contrast to the adversarial setting ($$R_{\mathrm{BF}} = R_{\mathrm{BF}}^\infty$$, see Table 1), or

• a disproof of the conjecture $$RR^\infty _{\mathrm{BF}} \approx 1.15$$ mentioned in [8, 28].

Notation

We consider a list $$I=(x_1,\ldots ,x_n)$$ of n items throughout the paper. Due to the online setting, I is revealed in rounds $$1,\ldots ,n$$. In round t, item $$x_t$$ arrives and in total, the prefix list $$I(t):=(x_1,\ldots ,x_t)$$ is revealed to the algorithm. The items in I(t) are called the visible items of round t. We use the symbol $$x_t$$ for the item itself and its size $$x_t \in (0,1]$$ interchangeably. An item $$x_t$$ is called large (L) if $$x_t > 1/2$$, medium (M) if $$x_t \in \left( 1/3, 1/2 \right]$$, and small (S) if $$x_t \le 1/3$$. We also say that $$x_t$$ is $$\alpha$$-large if $$x_t > \alpha$$.

Bins contain items and therefore can be represented as sets. As a bin usually can receive further items in later rounds, the following terms refer always to a fixed round. We define the load of a bin $$\mathcal{B}$$ as $$\sum _{x_i \in \mathcal{B}} x_i$$. Sometimes, we classify bins by their internal structure. We say $$\mathcal{B}$$ is of configuration LM (or $$\mathcal{B}$$ is an LM-bin) if it contains one large and one medium item. The configurations L, MM, etc. are defined analogously. Moreover, we call $$\mathcal{B}$$ a k-bin if it contains exactly k items. If a bin cannot receive further items in the future, it is called closed; otherwise, it is called open.

The number of bins which Best Fit uses to pack a list I is denoted by $${{\mathrm{BF}}}(I)$$. We slightly abuse the notation and refer to the corresponding packing by $${{\mathrm{BF}}}(I)$$ as well whenever the exact meaning is clear from the context. Similarly, we denote by $${{\mathrm{OPT}}}(I)$$ the number of bins and the corresponding packing of an optimal offline solution.

Finally, for any natural number n we define $$[n]:= \{1,\ldots ,n\}$$. Let $$\mathcal{S}_n$$ be the set of permutations in [n]. If not stated otherwise, $$\sigma$$ refers to a permutation drawn uniformly at random from $$\mathcal{S}_n$$.

Upper Bound for 1/3-Large Items

In this section, we consider the case where I contains no small items, i.e., where all items are $$\nicefrac {1}{3}$$-large. We develop the technical foundations in Sects. 3.1 to 3.3. The final proofs of Theorem 1 and Proposition 1 are presented in Sect. 3.4.

Monotonicity

We first define the notion of monotone algorithms.

Definition 1

We call an algorithm monotone if increasing the size of one or more items cannot decrease the number of bins used by the algorithm.

One might suspect that any reasonable algorithm is monotone. While this property holds for an optimal offline algorithm and some online algorithms as Next Fit [10], Best Fit is not monotone in general [33]. As a counterexample, consider the lists

\begin{aligned} I&= (0.36, 0.65, \mathbf {0.34}, 0.38, 0.28, 0.35, 0.62) \quad\text{and} \\ I^{\prime}&= (0.36, 0.65, \mathbf {0.36}, 0.38, 0.28, 0.35, 0.62) . \end{aligned}

Before arrival of the fifth item, $${{\mathrm{BF}}}(I(4))$$ uses the two bins $$\{0.36, 0.38\}$$ and $$\{0.65, 0.34\}$$, while $${{\mathrm{BF}}}(I^{\prime}(4))$$ uses three bins $$\{0.36, 0.36\}$$, $$\{0.65\}$$, and $$\{0.38\}$$. Now, the last three items fill up the existing bins in $${{\mathrm{BF}}}(I^{\prime}(4))$$ exactly. In contrast, these items open two further bins in the packing of $${{\mathrm{BF}}}(I(4))$$. Therefore, $${{\mathrm{BF}}}(I) = 4 > 3 = {{\mathrm{BF}}}(I^{\prime})$$.

However, we can show that Best Fit is monotone for the case of $$\nicefrac {1}{3}$$-large items. Interestingly, 1/3 seems to be the threshold for the monotonicity of Best Fit: As shown in the counterexample from the beginning of this section, it is sufficient to have one item $$x \in \left( 1/4, 1/3 \right]$$ to force Best Fit into anomalous behavior. Anyway, we have the following proposition.

Proposition 3

Given a list I of items larger than 1/3 and a list $$I^{\prime}$$ obtained from I by increasing the sizes of one or more items, we have $${{\mathrm{BF}}}(I) \le {{\mathrm{BF}}}(I^{\prime})$$.

We provide the proof of Proposition 3 in Appendix A. Enabled by the monotonicity, we can reduce an instance of $$\nicefrac {1}{3}$$-large items to an instance of easier structure. This construction is described in the following.

Simplifying the Instance

Let I be a list of items larger than 1/3. Note that both the optimal and the Best Fit packing use only bins of configurations L, LM, MM, and possibly one M-bin. However, we can assume a simpler structure without substantial implications on the competitiveness of Best Fit.

Lemma 1

Let I be any list that can be packed optimally into $${{\mathrm{OPT}}}(I)$$ LM-bins. If Best Fit has (asymptotic or absolute) approximation ratio $$\alpha$$ for I, then it has (asymptotic or absolute) approximation ratio $$\alpha$$ for any list of items larger than 1/3 as well.

Proof

Let $$I_0$$ be a list of items larger than 1/3 and let a, b, c, and $$d \le 1$$ be the number of bins in $${{\mathrm{OPT}}}(I_0)$$ with configurations L, LM, MM, and M, respectively (see Fig. 1a). In several steps, we eliminate L-, MM-, and M-bins from $${{\mathrm{OPT}}}(I_0)$$ while making the instance only harder for Best Fit.

First, we obtain $$I_1$$ from $$I_0$$ by replacing items of size 1/2 by items of size $$1/2 - \varepsilon$$. By choosing $$\varepsilon > 0$$ small enough, i.e., $$\varepsilon < \min \{ \delta ^+ - 1/2, 1/2 - \delta ^- \}$$, where $$\delta ^+ = \min \{x_i \mid x_i > 1/2 \}$$ and $$\delta ^- = \max \{x_i \mid x_i < 1/2 \}$$, it is ensured that Best Fit packs all items in the same bins as before the modification. Further, the modification does not decrease the number of bins in an optimal packing, so we have $${{\mathrm{BF}}}(I_0)={{\mathrm{BF}}}(I_1)$$ and $${{\mathrm{OPT}}}(I_0) = {{\mathrm{OPT}}}(I_1)$$.

Now, we obtain $$I_2$$ from $$I_1$$ by increasing item sizes: We replace each of the $$a+d$$ items packed in 1-bins in $${{\mathrm{OPT}}}(I_1)$$ by large items of size 1. Moreover, any 2-bin (MM or LM) in $${{\mathrm{OPT}}}(I_1)$$ contains at least one item smaller than 1/2. These items are enlarged such that they fill their respective bin completely. Therefore, $${{\mathrm{OPT}}}(I_2)$$ has $$a+d$$ L-bins and $$b+c$$ LM-bins (see Fig. 1b). We have $${{\mathrm{OPT}}}(I_2) = {{\mathrm{OPT}}}(I_1)$$ and, by Proposition 3, $${{\mathrm{BF}}}(I_2) \ge {{\mathrm{BF}}}(I_1)$$.

Finally, we obtain $$I_3$$ from $$I_2$$ by deleting the $$a+d$$ items of size 1. As size-1 items are packed separately in any feasible packing, $${{\mathrm{OPT}}}(I_3) = {{\mathrm{OPT}}}(I_2) - (a+d)$$ and $${{\mathrm{BF}}}(I_3) = {{\mathrm{BF}}}(I_2) - (a+d)$$.

Note that $${{\mathrm{OPT}}}(I_3)$$ contains only LM-bins (see Fig. 1c) and, by assumption, Best Fit has (asymptotic or absolute) approximation ratio $$\alpha$$ for such lists. Therefore, in general we have a factor $$\alpha \ge 1$$ and an additive term $$\beta$$ such that $${{\mathrm{BF}}}(I_3) \le \alpha {{\mathrm{OPT}}}(I_3) + \beta$$. It follows that

\begin{aligned} {{\mathrm{BF}}}(I_0) \le {{\mathrm{BF}}}(I_2) = {{\mathrm{BF}}}(I_3) + (a+d) \le \alpha {{\mathrm{OPT}}}(I_3) + (a+d) + \beta \le \alpha {{\mathrm{OPT}}}(I_0) + \beta , \end{aligned}

which concludes the proof. $$\square$$

By Lemma 1, we can impose the following constraints on I without loss of generality.

Assumption. For the remainder of the section, we assume that the optimal packing of I has $$k = {{\mathrm{OPT}}}(I)$$ LM-bins. For $$i \in [k]$$, let $$l_i$$ and $$m_i$$ denote the large item and the medium item in the i-th bin, respectively. We call $$\{l_i, m_i\}$$ an LM-pair.

Good Order Pairs

If the adversary could control the order of items, he would send all medium items first, followed by all large items. This way, Best Fit opens k/2 MM-bins and k L-bins and therefore is 1.5-competitive. In a random permutation, we can identify structures with a positive impact on the Best Fit packing. This is formalized in the following random event.

Definition 2

Consider a fixed permutation $$\pi \in \mathcal{S}_n$$. We say that the LM-pair $$\{l_i, m_i\}$$ arrives in good order (or is a good order pair) if $$l_i$$ arrives before $$m_i$$ in $$\pi$$.

Note that in the adversarial setting, no LM-pair arrives in good order, while in a random permutation, this holds for any LM-pair independently with probability 1/2. The next lemma is central for the proof of Theorem 1. It shows that the number of LM-pairs in good order bounds the number of LM-bins in the final Best Fit packing from below.

Lemma 2

Let $$\pi \in \mathcal{S}_n$$ be any permutation and let X be the number of LM-pairs arriving in good order in $$I^\pi$$. The packing $${{\mathrm{BF}}}(I^\pi )$$ has at least X LM-bins.

To prove Lemma 2, we model the Best Fit packing by the following bipartite graph: Let $$G_t = (\mathcal{M}_t \cup \mathcal{L}_t, E^{\mathrm{BF}}_t \cup E^{{{\mathrm{OPT}}}}_t)$$, where $$\mathcal{M}_t$$ and $$\mathcal{L}_t$$ are the sets of medium and large items in $$I^\pi (t)$$, respectively. The sets of edges represent the LM-matchings in the Best Fit packing and in the optimal packing at time t, i.e.,

\begin{aligned} E^{\mathrm{BF}}_t = \bigl \{ \{m,l \} \in (\mathcal{M}_t \times \mathcal{L}_t) \mid \text{m\,and\,l\,are\,packed\,into\,the\,same\,bin\,in}\, {{\mathrm{BF}}}(I^\pi (t)) \bigr \} E^{{{\mathrm{OPT}}}}_t = \bigl \{ \{m_i,l_i \} \in (\mathcal{M}_t \times \mathcal{L}_t) \mid i \in [k] \bigr \} . \end{aligned}

We distinguish OPT-edges in good and bad order, according to the corresponding LM-pair. Note that $$G_t$$ is not necessarily connected and may contain parallel edges. We illustrate the graph representation by a small example.

Example 1

Let $$\varepsilon > 0$$ be sufficiently small and define for $$i \in [4]$$ large items $$l_i = 1/2 + i \varepsilon$$ and medium items $$m_i = 1/2 - i \varepsilon$$. Consider the list $$I^\pi = (l_2, l_1, m_3, m_4, l_4, m_1, m_2, l_3)$$. Figure 2a, b show the Best Fit packing and the corresponding graph $$G_7$$ before arrival of the last item. Note that $$I^\pi$$ has two good order pairs ($$\{l_1,m_1\}$$ and $$\{l_2,m_2\}$$) and, according to Lemma 2, the packing has two LM-bins.

The proof of Lemma 2 essentially boils down to the following claim:

Claim 1

In each round t and in each connected component C of $$G_t$$, the number of BF-edges in C is at least the number of OPT-edges in good order in C.

We first show how Lemma 2 follows from Claim 1. Then, we work towards the proof of Claim 1.

Proof of Lemma 2

Claim 1 implies that in $$G_n$$, the total number of BF-edges (summed over all connected components) is at least X. Therefore, the packing has at least X LM-bins and thus not less than the number of good order pairs X. $$\square$$

Before proving Claim 1, we show the following property of $$G_t$$.

Claim 2

Consider the graph $$G_t$$ for some $$t \in [n]$$. Let $$Q=(b_w,a_{w-1},b_{w-1}, ,\ldots ,a_1,b_1)$$ with $$w \ge 1$$ be a maximal alternating path such that $$\{a_j, b_j\}$$ is an OPT-edge in good order and $$\{a_j, b_{j+1} \}$$ is a BF-edge for any $$j \in [w-1]$$ (i.e., a-items and b-items represent medium and large items, respectively). It holds that $$b_w \ge b_1$$.

Proof

We show the claim by induction on w. Note that the items’ indices only reflect the position along the path, not the arrival order. For $$w=1$$, we have $$Q=(b_w)=(b_1)$$ and thus, the claim holds trivially.

Now, fix $$w \ge 2$$ and suppose that the claim holds for all paths $$Q^{\prime}$$ with $$w^{\prime} \le w-1$$. We next prove $$b_w \ge b_1$$. Let $$t^{\prime} \le t$$ be the arrival time of the a-item $$a_d$$ that arrived latest among all a-items in Q. We consider the graph $$G_{t^{\prime}-1}$$, i.e., the graph immediately before arrival of $$a_d$$ and its incident edges. Note that in $$G_{t^{\prime}-1}$$, all items $$a_i$$ with $$i \in [w-1] {\setminus } \{d\}$$ and $$b_i$$ with $$i \in [w-1]$$ are visible. Let $$Q^{\prime}=(b_w,\ldots ,a_{d+1},b_{d+1})$$ and $$Q^{\prime\prime}=(b_d,\ldots , a_1, b_1)$$ be the connected components of $$b_w$$ and $$b_1$$ in $$G_{t^{\prime}-1}$$. As $$Q^{\prime}$$ and $$Q^{\prime\prime}$$ are maximal alternating paths shorter than Q, we obtain from the induction hypothesis $$b_w \ge b_{d+1}$$ and $$b_d \ge b_1$$.

Note that $$b_{d+1}$$ and $$b_1$$ were visible and packed into L-bins on arrival of $$a_d$$. Further, $$a_d$$ and $$b_1$$ would fit together, as $$a_d + b_1 \le a_d + b_d \le 1$$. However, Best Fit packed $$a_d$$ with $$b_{d+1}$$, implying $$b_{d+1} \ge b_1$$. Combining the inequalities yields $$b_w \ge b_{d+1} \ge b_1$$, concluding the proof.$$\square$$

Now, we are able to prove the remaining technical claim.

Proof of Claim 1

Note that the number of OPT-edges in good order can only increase on arrival of a medium item $$m_i$$ where $$\{m_i, l_i\}$$ is an LM-pair in good order. Therefore, it is sufficient to verify Claim 1 in rounds $$t_1< \cdots < t_j$$ such that in round $$t_i$$, item $$m_i$$ arrives and $$l_i$$ arrived previously.

Induction base. In round $$t_1,$$ there is one OPT-edge $$\{m_1,l_1\}$$ in good order. We need to show that there exists at least one BF-edge in $$G_{t_1}$$, or, alternatively, at least one LM-bin in the packing. If the bin of $$l_1$$ contains a medium item different from $$m_1$$, we identified one LM-bin. Otherwise, Best Fit packs $$m_1$$ together with $$l_1$$ or some other large item, again creating an LM-bin.

Induction hypothesis. Fix $$i \ge 2$$ and assume that Claim 1 holds up to round $$t_{i-1}$$.

Induction step. We only consider the connected component of $$m_i$$, as by the induction hypothesis, the claim holds for all remaining connected components. If $$m_i$$ is packed into an LM-bin, the number of BF-edges increases by one and the claim holds for round $$t_i$$. Therefore, assume that $$m_i$$ is packed by Best Fit in an M- or MM-bin. This means that in $$G_{t_i}$$, vertex $$m_i$$ is incident to an OPT-edge in good order, but not incident to any BF-edge. Let $$P=(m_i, l_i, \ldots ,v)$$ be the maximal path starting from $$m_i$$ alternating between OPT-edges and BF-edges.

Case 1: v is a medium item. For illustration, consider Fig. 2 with $$m_i = m_2$$ and $$v = m_3$$. Since P begins with an OPT-edge and ends with a BF-edge, the number of BF-edges in P equals the number of OPT-edges in P. The latter number is clearly at least the number of OPT-edges in good order in P.

Case 2: v is a large item. For illustration, consider Fig. 2 with $$m_i = m_1$$ and $$v = l_4$$. We consider two cases. If P contains at least one OPT-edge which is not in good order, the claim follows by the same argument as in Case 1.

Now, suppose that all OPT-edges in P are in good order. Let $$P^{\prime}$$ be the path obtained from P by removing the item $$m_i$$. As $$P^{\prime}$$ satisfies the premises of Claim 2, we obtain $$l_i \ge v$$. This implies that $$m_i$$ and v would fit together, as $$m_i + v \le m_i + l_i \le 1$$. However, $$m_i$$ is packed in an M- or MM-bin by assumption, although v is a feasible option on arrival of $$m_i$$. As this contradicts the Best Fit rule, we conclude that case 2 cannot happen. $$\square$$

Final Proofs

Finally, we prove the main result of this section.

Proof of Theorem 1

Let X be the number of good order pairs in $$I^\sigma$$ and let Y be the number of LM-bins in the packing $${{\mathrm{BF}}}(I^\sigma )$$. We have $$Y \ge X$$ by Lemma 2. For the remaining large and medium items, Best Fit uses $$(k-Y)$$ L-bins and $$\lceil (k-Y)/2 \rceil$$ MM-bins (including possibly one M-bin), respectively. Therefore,

\begin{aligned} {{\mathrm{BF}}}(I^\sigma ) = Y + (k-Y) + \left\lceil \frac{k-Y}{2} \right\rceil \le k + \left\lceil \frac{k-X}{2} \right\rceil = \frac{3k}{2} - \frac{X}{2} + \frac{\xi (X)}{2} , \end{aligned}
(1)

where $$\xi (X) = (k-X) \bmod 2$$. Using linearity and monotonicity of expectation, we obtain

\begin{aligned} {{\mathrm{E}}}[{{\mathrm{BF}}}(I^\sigma )] \le \frac{3k}{2} - \frac{{{\mathrm{E}}}[X]}{2} + \frac{\Pr [\xi (X)=1]}{2} . \end{aligned}
(2)

Since $$\sigma$$ is uniformly distributed on $$\mathcal{S}_n$$, each LM-pair arrives in good order with probability 1/2. Therefore, $${{\mathrm{E}}}[X]= k/2$$ and $$\Pr [\xi (X)=1] = 1/2$$. Hence,

\begin{aligned} {{\mathrm{E}}}[{{\mathrm{BF}}}(I^\sigma )] \le \frac{3k}{2} - \frac{k/2}{2} + \frac{1/2}{2} = \frac{5k}{4} + \frac{1}{4} = \frac{5}{4} {{\mathrm{OPT}}}(I) + \frac{1}{4} , \end{aligned}
(3)

where we used $$k = {{\mathrm{OPT}}}(I)$$. This concludes the proof. $$\square$$

To obtain the upper bound of 21/16 on the absolute random order ratio (Proposition 1), we analyze a few special cases more carefully.

Proof of Proposition 1

For $$k \ge 4$$, the claim follows immediately from Equation (3):

\begin{aligned} \frac{{{\mathrm{E}}}[{{\mathrm{BF}}}(I^\pi )]}{{{\mathrm{OPT}}}(I)} = \frac{(5k)/4 + 1/4}{k} = \frac{5}{4} + \frac{1}{4k} \le \frac{21}{16} . \end{aligned}

Since Best Fit is clearly optimal for $$k=1$$, it remains to verify the cases $$k \in \{2,3\}$$.

$$k=2$$:

It is easily verified that there are 16 out of $$4!=24$$ permutations where Best Fit is optimal and that it opens at most 3 bins otherwise. Therefore,

\begin{aligned} {{\mathrm{E}}}[{{\mathrm{BF}}}(I^\sigma )] = \frac{1}{4!} \cdot \left( 16 {{\mathrm{OPT}}}(I) + 8 \cdot \frac{3}{2} {{\mathrm{OPT}}}(I) \right) = \frac{7}{6} {{\mathrm{OPT}}}(I) < \frac{21}{16} {{\mathrm{OPT}}}(I). \end{aligned}
$$k=3$$:

When k is odd, there must be at least one LM-bin in the Best Fit packing: Suppose for contradiction that all M-items are packed in MM- or M-bins. As k is odd, there must be an item $$m_i$$ packed in an M-bin. If $$l_i$$ arrives before $$m_i$$, item $$l_i$$ is packed in an L-bin, as there is no LM-bin. Therefore, Best Fit packs $$m_i$$ with $$l_i$$ or some other L-item instead of opening a new bin. If $$l_i$$ arrives after $$m_i$$, Best Fit packs $$l_i$$ with $$m_i$$ or some other M-item. We have a contradiction in both cases. Therefore, for $$k=3$$ we have at least one LM-bin, even if no LM-pair arrives in good order. Consider the proof of Theorem 1. Instead of $$Y \ge X$$, we can use the stronger bound $$Y \ge X^{\prime}$$ with $$X^{\prime} := \max \{1, X\}$$ on the number of LM-bins. The new random variable satisfies $${{\mathrm{E}}}[X^{\prime}] = k/2 + 1/2^k$$ and $$\Pr [\xi (X^{\prime}) = 1] = 1/2 - 1/2^k$$. Adapting Equations (1) and (2) appropriately, we obtain

\begin{aligned} \frac{{{\mathrm{E}}}[{{\mathrm{BF}}}(I^\sigma )]}{{{\mathrm{OPT}}}(I)}&= \frac{1}{k} \cdot \left( \frac{3k}{2} - \frac{k/2 + 1/2^k}{2} + \frac{1/2 - 1/2^k}{2} \right) \\&= \frac{5}{4} + \frac{1}{4k} - \frac{1}{k 2^k} = \frac{31}{24} < \frac{21}{16} . \end{aligned}

$$\square$$

Lower Bounds

In this section, we present the improved lower bound on $$RR{_{\mathrm{BF}}^\infty}$$ (Theorem 2) and the first lower bound on the absolute random order ratio $$RR_{\mathrm{BF}}$$ (Theorem 3).

Asymptotic Random Order Ratio

Another model of probabilistic analysis is the i.i.d.-model, where the input of the algorithm is a sequence of independent and identically distributed (i.i.d.) random variables. Here, the performance measure of algorithm $$\mathcal{A}$$ is $${{{\mathrm{E}}}[\mathcal{A}(I_n(F))]} / {{{\mathrm{E}}}[{{\mathrm{OPT}}}(I_n(F))]}$$, where $$I_n(F):=(X_1,\ldots ,X_n)$$ is a list of n random variables drawn i.i.d. according to F. This model is in general weaker than the random order model, which is why lower bounds in the random order model can be obtained from the i.i.d.-model. This is formalized in the following lemma.

Lemma 3

Consider any online bin packing algorithm $$\mathcal{A}$$. Let F be a discrete distribution and $$I_n(F) = (X_1,\ldots ,X_n)$$ be a list of i.i.d. samples. For $$n \rightarrow \infty$$, there exists a list I of n items such that

\begin{aligned} \frac{{{\mathrm{E}}}[\mathcal{A}(I^\sigma )]}{{{\mathrm{OPT}}}(I)} \ge \frac{{{\mathrm{E}}}[\mathcal{A}(I_n(F))]}{{{\mathrm{E}}}[{{\mathrm{OPT}}}(I_n(F))]} . \end{aligned}

Moreover, if there exists a constant $$c > 0$$ such that $$X_i \ge c$$ for all $$i \in [n]$$, we have $${{\mathrm{OPT}}}(I) \ge cn$$.

This technique has already been used in [28] to establish the lower bound of 1.08, however, without a formal proof. Apparently, the only published proofs of this connection address bin covering [6, 13]. We provide a constructive proof of Lemma 3 in Appendix C for completeness. The improved lower bound from Theorem 2 now follows by combining Lemma 3 with the next lemma.

Lemma 4

There exists a discrete distribution F such that for $$n \rightarrow \infty$$, we have $${{\mathrm{E}}}[\mathcal{A}(I_n(F))] > \frac{11}{10} {{\mathrm{E}}}[{{\mathrm{OPT}}}(I_n(F))]$$ and each sample $$X_i$$ satisfies $$X_i \ge 1/4$$.

Proof

Let F be the discrete distribution which gives an item of size 1/4 with probability p and an item of size 1/3 with probability $$q:=1-p$$. First, we analyze the optimal packing. Let $$N_{4}$$ and $$N_{3}$$ be the number of items with size 1/4 and 1/3 in $$I_n(F)$$, respectively. We have

\begin{aligned} {{\mathrm{E}}}[{{\mathrm{OPT}}}(I_n(F))] \le {{\mathrm{E}}}\left[ \frac{N_{4}}{4} + \frac{N_{3}}{3} + 2 \right] = \frac{np}{4} + \frac{nq}{3} + 2 = n \left( \frac{1}{3} - \frac{p}{12} + \frac{2}{n} \right) . \end{aligned}

Now, we analyze the expected behavior of Best Fit for $$I_n(F)$$. As the only possible item sizes are 1/4 and 1/3, we can consider each bin of load more than 3/4 as closed. Moreover, the number of possible loads for open bins is small and Best Fit maintains at most two open bins at any time. Therefore, we can model the Best Fit packing by a Markov chain as follows. Let the nine states $$\mathsf{A},\mathsf{B},\ldots ,\mathsf{I}$$ be defined as in Fig. 3b. The corresponding transition diagram is depicted in Fig. 3. This Markov chain converges to the stationary distribution

\begin{aligned} \omega&= (\omega_{\mathsf{A}},\ldots ,\omega _{\mathsf{I}}) \\&= \frac{1}{\uplambda } \left( 1, p, q+pq\vartheta , p^2, 2pq+p^2q\vartheta , q^2+2pq^2\vartheta , \vartheta , q\vartheta , q^2 \vartheta \right) , \end{aligned}

where we defined $$\vartheta :=\frac{p^3}{1-q^3}$$ and $$\uplambda := \vartheta q \left( 3 - q^2 \right) + \vartheta + 3$$. A formal proof of this fact can be found in Appendix C.2.

Let $$V_{\mathsf{S}}(t)$$ denote the number of visits to state $$\mathsf{S} \in \{ \mathsf{A}, \ldots , \mathsf{I} \}$$ up to time t. By a basic result from the theory of ergodic Markov chains (see [30, Sect. 4.7]), it holds that $$\lim _{t \rightarrow \infty } \frac{1}{t} \cdot V_{\mathsf{S}}(t) = \omega _S$$. In other words, the proportion of time spent in state $$\mathsf{S}$$ approaches its probability $$\omega _{\mathsf{S}}$$ in the stationary distribution.

This fact can be used to bound the total number of opened bins over time. Note that Best Fit opens a new bin on the transitions $$A \rightarrow B$$, $$A \rightarrow C$$, and $$G \rightarrow H$$ (see Fig. 3a).

Hence, $${{\mathrm{E}}}[{{\mathrm{BF}}}(I_n(F))] = V_{\mathsf{A}}(n) + q V_{\mathsf{G}}(n)$$. Setting $$p = 0.60$$, we obtain finally

\begin{aligned} \lim _{n \rightarrow \infty } \frac{{{\mathrm{E}}}[{{\mathrm{BF}}}(I_n(F))]}{{{\mathrm{E}}}[{{\mathrm{OPT}}}(I_n(F))]} \ge \lim _{n \rightarrow \infty } \frac{n \omega_{\mathsf{A}} + nq \omega _{\mathsf{G}}}{n \left( \frac{1}{3} - \frac{p}{12} + \frac{2}{n} \right) } = \frac{1 + q \vartheta }{\uplambda \cdot \left( \frac{1}{3} - \frac{p}{12} \right) } > \frac{11}{10} . \end{aligned}
(4)

$$\square$$

Absolute Random Order Ratio

Theorem 3 follows from the following lemma.

Lemma 5

There exists a list I such that $${{\mathrm{E}}}[{{\mathrm{BF}}}(I^\sigma )] = \frac{13}{10} {{\mathrm{OPT}}}(I)$$.

Proof

Let $$\varepsilon > 0$$ be sufficiently small and let $$I := (a_1,a_2,b_1,b_2,c)$$ where

\begin{aligned} a_1 = a_2 = \frac{1}{3} + 4 \varepsilon , \quad b_1 = b_2 = \frac{1}{3} + 16 \varepsilon , \quad c = \frac{1}{3} - 8 \varepsilon . \end{aligned}

An optimal packing of I has two bins $$\{a_1,a_2,c\}$$ and $$\{b_1,b_2\}$$, thus $${{\mathrm{OPT}}}(I)=2$$. Subsequently, we argue that Best Fit needs two or three bins depending on the order of arrival.

Let E be the event that exactly one b-item arrives within the first two rounds. After the second item, the first bin is closed, as its load is at least $$\frac{1}{3} + 16\varepsilon + \frac{1}{3} - 8\varepsilon = \frac{2}{3} + 8 \varepsilon$$. Among the remaining three items, there is a b-item of size $$\frac{1}{3} + 16 \varepsilon$$ and at least one a-item of size $$\frac{1}{3} + 4\varepsilon$$. This implies that a third bin needs to be opened for the last item. As there are exactly $$2 \cdot 3 \cdot 2! \cdot 3! = 72$$ permutations where E happens, we have $$\Pr [E] = \frac{72}{5!} = \frac{3}{5}$$.

On the other side, Best Fit needs only two bins if one of the events F and G, defined in the following, happen. Let F be the event that both b-items arrive in the first two rounds. Then, the remaining three items fit into one additional bin. Moreover, let G be the event that the set of the first two items is a subset of $$\{a_1,a_2,c\}$$. Then, the first bin has load at least $$\frac{2}{3} - 4 \varepsilon$$, thus no b-item can be packed there. Again, this ensures a packing into two bins.

By counting permutations, we obtain $$\Pr [F] = \frac{2! \cdot 3!}{5!} = \frac{1}{10}$$ and $$\Pr [G] = \frac{3 \cdot 2! \cdot 3!}{5!} = \frac{3}{10}$$.

As the events E, F, and G partition the probability space, we obtain

\begin{aligned} \frac{{{\mathrm{E}}}[{{\mathrm{BF}}}(I^\sigma )]}{{{\mathrm{OPT}}}(I)} = \frac{\Pr [E] \cdot 3 + \left( \Pr [F] + \Pr [G] \right) \cdot 2}{2} = \frac{\frac{3}{5} \cdot 3 + \left( \frac{1}{10} + \frac{3}{10} \right) \cdot 2}{2} = \frac{13}{10} . \end{aligned}

$$\square$$

The construction from the above proof is used in [25] to prove that Best Fit is 1.5-competitive under adversarial arrival order if all item sizes are close to 1/3. Interestingly, it gives a strong lower bound on the absolute random order ratio as well.