Better Algorithms for Online Bin Stretching

Online Bin Stretching is a semi-online variant of bin packing in which the algorithm has to use the same number of bins as the optimal packing, but is allowed to slightly overpack the bins. The goal is to minimize the amount of overpacking, i.e., the maximum size packed into any bin. We give an algorithm for Online Bin Stretching with a stretching factor of 1.5 for any number of bins. We also show a specialized algorithm for three bins with a stretching factor of 11/8 = 1.375.


Introduction
The most famous algorithmic problem dealing with online assignment is arguably Online Bin Packing. In this problem, known since the 1970s, items of size between 0 and 1 arrive in a sequence and the goal is to pack these items into the least number of unit-sized bins, packing each item as soon as it arrives.
Online Bin Stretching, which has been introduced by Azar and Regev in 1998 [3], deals with a similar online scenario. Again, items of size between 0 and 1 arrive in a sequence, and the algorithm needs to pack them as soon as each item arrives, but it has two advantages: (i) The packing algorithm knows m, the number of bins that an optimal offline algorithm would use, and must also use only at most m bins, and (ii) the packing algorithm can use bins of capacity R for some R ≥ 1. The goal is to minimize the stretching factor R.
While formulated as a bin packing variant, Online Bin Stretching can also be thought of as a semi-online scheduling problem, in which we schedule jobs in an online manner on exactly m machines, before any execution starts. We have a guarantee that the optimum offline algorithm could schedule all jobs with makespan 1. Our task is to present an online algorithm with makespan of the schedule being at most R.
Motivation. We give two of applications of Online Bin Stretching.
Server upgrade. This application has first appeared in [3]. In this setting, an older server (or a server cluster) is streaming a large number of files to the newer server without any guarantee on file order. The files cannot be split between drives. Both servers have m disk drives, but the newer server has a larger capacity of each drive. The goal is to present an algorithm that stores all incoming files from the old server as they arrive.
Shipment checking. A number m of containers arrive at a shipping center. It is noted that all containers are at most p ≤ 100 percent full. The items in the containers are too numerous to be individually labeled, yet all items must be unpacked and scanned for illicit and dangerous material. After the scanning, the items must be speedily repackaged into the containers for further shipping. In this scenario, an algorithm with stretching factor 100/p can be used to repack the objects into containers in an online manner.
History. Online Bin Stretching has been proposed by Azar and Regev [3]. The original lower bound of 4/3 for three bins has appeared even before that, in [12], for two bins together with a matching algorithm. Azar and Regev extended the same lower bound to any number of bins and gave an online algorithm with a stretching factor 1.625.
The problem has been revisited recently, with both lower bound improvements and new efficient algorithms. On the algorithmic side, Kellerer and Kotov [11] have achieved a stretching factor 11/7 ≈ 1.57 and Gabay et al. [8] have achieved 26/17 ≈ 1.53. In the case with only three bins, the previously best algorithm was due to Azar and Regev [3], with a stretching factor of 1. 4.
On the lower bound side, the lower bound 4/3 of [3] was surpassed only for the case of three bins by Gabay et al. [7], who show a lower bound of 19/14, using an extensive computer search.
Our contributions. In Section 2, we present a new algorithm for Online Bin Stretching with a stretching factor of 1.5. We build on the techniques of [11,8] who designed two-phase algorithms where the first phase tries to fill some bins close to R − 1 and achieve a fixed ratio between these bins and empty bins, while the second phase uses the bins in blocks of fixed size and analyzes each block separately. This technique, with some case analysis, seemed to be able to lead to improved results approaching 1.5. To actually reach 1.5, we needed to significantly improve the analysis using amortization techniques (represented by a weight function in our presentation) to amortize among blocks and bins of different types.
In Section 3, we focus on the case of three bins. For this case, there is a recent lower bound of 19/14 ≈ 1.357 [7]. We present an algorithm for three bins of capacity 11/8 = 1.375. This is the first improvement of the stretching factor 1.4 of Azar and Regev [3] for three bins and significantly decreases the remaining gap.
Related work. The NP-hard problem Bin Packing was originally proposed by Ullman [13] and Johnson [10] in the 1970s. Since then it has seen major interest and progress, see the survey of Coffman et al. [5] for many results on classical Bin Packing and its variants. While our problem can be seen as a variant of Bin Packing, note that the algorithms cannot open more bins than the optimum and thus general results for Bin Packing do not translate to our setting.
As noted, Online Bin Stretching can be formulated as the online scheduling on m identical machines with known optimal makespan. Such algorithms were studied and are important in designing constant-competitive algorithms without the additional knowledge, e.g., for scheduling in the more general model of uniformly related machines [2,4,6].
For scheduling, also other types of semi-online algorithms are studied. Historically first is the study of ordered sequences with non-decreasing processing times [9]. Most closely related is the variant with known sum of all processing times studied in [12] and the currently best results are a lower bound of 1.585 and an algorithm with ratio 1.6, both from [1]. Note that this shows, somewhat surprisingly, that knowing the actual optimum gives a significantly bigger advantage to the online algorithm over knowing just the sum of the processing times (which, divided by m, is a lower bound on the optimum). Definitions and notation. Our main problem, Online Bin Stretching, can be described as follows: Input: an integer m and a sequence of items I = i 1 , i 2 , . . . given online one by one. Each item has a size s(i) ∈ [0, 1] and must be packed immediately and irrevocably. Parameter: The stretching factor R, a limit of the capacity of all bins. Output: Partitioning (packing) of I into bins B 1 , . . . , B m so that i∈Bj s(i) ≤ R for all j = 1, . . . , m. Guarantee: there exists a packing of all items in I into m bins of capacity 1. Goal: Design an online algorithm with the stretching factor R as small as possible which packs all input sequences satisfying the guarantee.
For a bin B, we define the size of the bin s(B) = i∈B s(i). Unlike s(i), s(B) can change during the course of the algorithm, as we pack more and more items into the bin. To easily differentiate between items, bins and lists of bins, we use lowercase letters for items (i, b, x), uppercase letters for bins (A, B, X), and calligraphic letters for lists of bins (A, C, L).
In both sections of our paper, we rescale the item sizes and bin capacities for simplicity. Therefore, in our setting, each item has an associated size s(i) ∈ [0, k], where k ∈ N is also the capacity of the bins which the optimal offline algorithm uses. The online algorithm for Online Bin Stretching uses bins of capacity t ∈ N, t ≥ k. The resulting stretching factor is thus t/k.

Upper bound for an arbitrary number of bins
We rescale the bin sizes so that the optimal bins have size 12 and the bins of the algorithm have size 18.
We follow the general two-phase scheme of recent results [11,8] which we sketch now. In the first phase of the algorithm we try to fill the bins so that their size is at most 6, as this leaves space for an arbitrary item in each bin. Of course, if items larger than 6 arrive, we need to pack them differently, namely in bins of size at least 12, whenever possible. We stop the first phase when the number of non-empty bins of size at most 6 is three times the number of empty bins. In the second phase, we work in blocks of three non-empty bins and one empty. The goal is to show that we are able to fill the bins so that the average size is at least 12, which guarantees we are able to pack the total size of 12m which is the upper bound on the size of all items.
The limitation of the previous results using this scheme was that the volume achieved in a typical block of four bins is slightly less than four times the size of the optimal bin, which then leads to bounds strictly above 3/2. This is also the case in our algorithm: A typical block may contain in three bins items from the first phase of size just above 4 plus one item of size 7 from the second phase, while the last bin contains two items of size 7 from the second phase-a total of 47 instead of desired 4 · 12. However, we notice that such a block contains five items of size 7 which the optimum cannot fit into four bins. To take an advantage of this, we cannot analyze each block separately. Instead, we need to show that a bin with no item of size more than 6 typically has size at least 13 and amortize among the blocks of different types. Technically this is done using a weight function w that takes into account both the total size of items and the number of items larger than 6. This is the main new technical idea of our proof.
There are other complications. We need to guarantee that a typical bin of size at most 6 has size at least 4 after the first phase. However, this is impossible to guarantee if the items packed there have size between 3 and 4. Larger items are fine, as one per bin is sufficient, and the smaller ones are fine as well as we can always fit at least two of them and this guarantees that we have only two bins filled below 4. This motivates our classification of items: Only the regular items of size in (0, 3]∪ (4,6] are packed in the bins filled up to size 6. The medium items of size in (3,4] are packed in their own bins (four or five per bin). Similarly, large items of size in (6,9] are packed in pairs in their own bins. Finally, the huge items of size larger than 9 are handled similarly as in the previous papers: If possible, they are packed with the regular items, otherwise each in their own bin.
The introduction of medium size items in turn implies that we need to revisit the analysis of the first phase and also of the case when the first phase ends with no empty bin. These parts of the proof are similar to the previous works, but due to the new item type we need to carefully revisit it; it is now convenient to introduce another weight function v that counts the items according to their type. The analysis of the second phase when empty bins are present is more complicated, as we need to take care of various degenerate cases, and it is also here where the novel amortization is used.
Lower bound. We note that this two-phase approach cannot give a better stretching factor than 1.5. Consider the following instance. Send two items of size 6 which are in the first phase packed separately into two bins. Then send m−1 items of size 12 and one of them must be put into a bin with an item of size 6, i.e., one bin receives items of size 18, while all the items can be packed into m bins of size 12. This instance and its modifications with more items of size 6 or slightly smaller items at the beginning thus show that decreasing the upper bound below 1.5 would need a significantly different approach, as we would be forced to pack these items in pairs. This also shows that the analysis of our algorithm is tight. Now we are ready to proceed with the formal statement of the algorithm and proof.
Theorem 1. There exists an algorithm for Online Bin Stretching with a stretching factor of 1.5 for an arbitrary number of bins.
We take an instance with an optimal packing into m bins of size 12 and, assuming that our algorithm fails, we derive a contradiction. One way to get a contradiction is to show that the size of all items is larger than 12m. We also use two other bounds in the spirit of weight functions: weight w(i) and value v(i). The weight w(i) is a slightly modified size to account for items of size larger than 6. The value v(i) only counts the number of items with relatively large sizes. For our calculations, it is convenient to normalize the functions so that they are at most 0 for optimal bins (see Lemma 1).
We classify the items and define their value v(i) as follows.

First-phase algorithm:
Let e be the number of empty bins and r the number of regular bins. If r ≥ 3e, stop the first phase. Assign the current item i according to its item type, using the first possible option in the particular column. The first letter in a cell indicates the required type of the bin before the assignment and the second column denotes the type of the bin after the assignment. If there are two types listed, the new bin type depends on the new size and weight of the bin. Note: As an additional rule when packing regular items, the item is packed in a regular or tiny bin only if the total size packed into this bin does not exceed 6 afterwards. Item type huge large medium regular First we observe that the algorithm described in the box above is properly defined. For every type of item, packing it into an empty bin is an option, and the stopping criterion guarantees that the algorithm stops when no empty bin is available. We now state properties of the algorithm; all are simple invariants that follow from the description of the algorithm. (iv) There is at most one large-item bin and at most one medium-item bin.
(v) There is at most one tiny bin T . If T exists, then for any regular bin, s(T ) + s(R) > 6. There is at most one regular bin R with s(R) ≤ 4. (vi) At the end of the first phase 3e ≤ r ≤ 3e + 3.
If the algorithm packs all items in the first phase, it stops. Otherwise according to Lemma 2(iii) we split the algorithm in two very different branches.
If there is no regular bin, follow the second phase with huge-item bins below. If there is at least one regular bin, follow the second phase with regular bins.
Let G be the set of all complete bins; we do not use these bins in the second phase. In addition to G and either huge-item bins, or the regular and empty bins, there may exist at most three special bins denoted and ordered as follows: the large-item bin L, the medium item bin M , and the tiny bin T .
Second phase with huge-item bins. Let the list of bins L contain first all the huge-item bins, followed by the special bins L, M , in this order, if they exist. There are no other non-empty bins by Lemma 2 and no empty bins because we have 3e ≤ r = 0. We use First Fit on L, without allowing new bins to be opened. Suppose that we have an instance that has a packing into bins of capacity 12 and on which our algorithm fails. We may assume that the algorithm fails on the last item f . By considering the total volume, there always exists a bin with size at most 12. Thus s(f ) > 6 and v(f ) ≥ 2.
If during the second phase an item n with s(n) ≤ 6 is packed into the last bin in L, we know that all other bins have size more than 12, thus all the remaining items fit into the last bin. Otherwise we consider v(L). Any bin B ∈ G has v(B) ≥ 0 by Lemma 2(ii) and each huge-item bin gets nonnegative value too.
M is the last bin of L and thus in this last case M contains only medium items from the first phase and possibly large and/or huge items from the second phase.
Second phase with regular bins. Let E resp. R be the set of empty resp. regular bins at the beginning of the second phase, and let e = |E|. Let λ ∈ {0, 1, 2, 3} be such that |R| = 3e + λ; Lemma 4(vi) implies that it exists.
We order the bins that are not complete into a list L as follows. We group the bins in E ∪ R into blocks of typically one empty and three regular bins as follows. Denote the empty bins E 1 , E 2 , . . . , E e . The regular bins are denoted by 3 , E i in this order. There are two exceptions: The last block B e+1 has no empty bin, only exactly 3 regular bins. The first block contains only λ regular bins instead of 3 and an empty bin. As the first regular bin we choose the one with size less than 4, if there is such a bin. By Lemma 2(v) there exists at most one such bin and all the remaining R i,j have size at least 4. Denote the first regular bin byR if R = ∅; note thatR is either the first bin in B 1 or the first bin in B 2 if λ = 0.
The list of bins L we use in the second phase contains first the special bins and then all the blocks B 1 , . . . , B e+1 . Thus the list L is (some or all of the first six bins may not exist): Whenever we refer to the ordering of the bins, we mean the ordering in L. See Figure 1 for an illustration. We use First Fit on the reversed list L for huge items (that is, we pack each huge item to the last bin in L where it fits) and we use First Fit on L for all other items.
Suppose that we have an instance that has a packing into bins of capacity 12 and on which our algorithm fails. We may assume that the algorithm fails on the last item. Let us denote this item by f . Call the items that arrived in the second phase new (including f ), the items from the first phase are old. See Figure 2 for an illustration of a typical final situation. Our overall strategy is to obtain a contradiction by showing that In some cases, we instead argue that v(L) Any of these is sufficient for a contradiction, as all bins in G have both volume and weight nonnegative and size larger than 12. Note also that s(f ) > 6 since by considering the total volume, there always exists a bin with size at most 12.
Let H denote all the bins from L with a huge item, and let h = |H| mod 4. First we show that the average size of bins in H is large and exclude some degenerate cases.
Proof. Let H = H ∩(E ∪R). We first prove the lemma for H . That is, we ignore the special bins at this stage.
If a huge item does not fit into a bin B in E ∪ R with no huge item, then B contains a new item of size at most 9 which did not fit into any previous bin. Thus the huge item also does not fit into any previous bin, and it is the item f . This shows that H is a final segment of the list, and also that if H is not the entire E ∪ R, then no special bin has a huge item and H = H.
All bins R i,j with a huge item have size at least 4 + 9 = 13, with a possible exception of the first such bin which has size at least ρ + 9 = 13 + ρ − 4, by the definition of ρ. Each E i with a huge item has size at least 9. Thus for each i with E i ∈ H , s(E i ) + s(R i+1,1 ) + s(R i+1,2 ) + s(R i+1,3 ) ≥ 4 · 12, with a possible exception of i = 1 in the case λ = 0. Summing over all i with E i ∈ H and the h bins in R from the first block intersecting H , and adjusting forR ifR ∈ H , (ii) for H follows. The claims (iii) and (iv) for H are an immediate consequence as ρ > 3 ifR ∈ H and ρ = 4 otherwise.
It remains to show that H = E ∪ R, implying H = H. Suppose for a contradiction that H = E ∪ R, thus We distinguish four cases. Case 1: There are no special bins. Then each bin B is a huge-item bin and has v(B) ≥ 0 and in addition f is not packed and it has v(f ) ≥ 2. So, overall v(L) + v(f ) > 0, a contradiction. Case 2: There is only one special bin. Then its size together with f is more than 18, thus s(L) > 18 + 12|H | − 1 > 12|L|, a contradiction. Case 3: The last special bin B = L has a new item n; this is always the case if T exists. We first claim that If there are two special bins, then the size of the first one plus s(n) is more than 18 because n did not fit there, s(f ) > 6 and thus summing with (1) we get s(L) + s(f ) > 18 + 6 + 12|H | = 12|L|, a contradiction.
If there are three special bins (necessarily L, M , and B = T ), we have s(L) + s(n) > 18 and s(M ) + s(f ) > 18, as the items do not fit in the respective bins, and summing with (1) we get s(L) + s(f ) > 18 + 18 + 12|H | = 12|L|, a contradiction.
Case 4: There are two special bins L and M , moreover M has no new item (otherwise Case 3 applies). Then either f is huge and M has at least two medium items, or f is large and M has at least three items. Thus v(M ) + v(f ) ≥ 2, v(L) ≥ −1 since L has a large item, and v(A) ≥ 0 for any other bin A since either it is a complete bin from the first phase or it has a huge item. Summing over all bins we get that the total value v(L) > 0, a contradiction.
Let F , the final bin be the last bin in L before H, or the last bin if H = ∅; by Lemma 3 we have F ∈ E ∪ R. Now modify the packing so that f is put into F , f is also considered a new item. Thus s(F ) > 18 and f as well as all the new items packed in F or a bin before F satisfy the property that they do not fit into any previous bin. Let C, the critical bin, be the first bin in L of size at most 12; such a bin exists, as otherwise the total size is more than 12m.
We start by some easy observations. Only items of size at most 9 are packed in bins before F , in F itself only the item f can be larger. All the new items in the bins after C are large; f can be also huge. Each bin, possibly with the exception of L and M , contains a new item, as it enters the phase with size at most 6, and the algorithm failed. Each bin in E before F contains two new items. The bin F always has two new items, one that did fit into it and f . More observations are given in the next two lemmata. Proof. F contains a new item n different from f . To prove (i), note that s(n) ≤ 9, and n does not fit into B.
To prove (ii), let n, n be two new items in B and note that s(B)+s(n) > 18 and s(B ) + s(n ) > 18.
To prove (iii), let B be after B. The bin B has a new item of size larger than 18 − s(B), and it also has old items of size at least 3 or even 4 if B =R.
Lemma 5. The critical bin C is before F , there are at least two bins between C and F and C is not in the same block as F .
It remains to bound the sizes of the other bins. Note that F = C as s(F ) > 18. If C is after F , all bins before F have size more than 12, so all together s(L) > 12|L| + 5, a contradiction. If C is just before F , then by Lemma 4(i), s(C) > 9 = 12 − 3 and the total size of bins in s(L) > 12|L| + 5 − 3 > 12|L|, a contradiction.
If there is a single bin B between C and F , then s(C) + s(B) plus the size of two new items in F is more than 36 by Lemma 4(ii). If F ∈ E then H starts with three bins in R and h = 3, thus s(H) ≥ 12|H| + 2 by Lemma 3, and we get a contradiction. If F ∈ R thenR / ∈ H, thus Lemma 3 gives s(H) ≥ 12|H|, and we get a contradiction as well.
The last case when C and F are in the same block is when F ∈ E, so h = 3, and C is the first bin of the three other bins from the same block, soR / ∈ H. Then s(C) > 9, the remaining two bins together with F have size more than 36 by Lemma 4(ii) and we use s(H) > 12|H| + 3 from Lemma 3 to get a contradiction. Now we partition L into several parts, see Figure 2 for an illustration of these parts. Let F = B i ∪ H, where F ∈ B i . Let D be the set of all bins after C and before F. Let C be the set of all bins before and including C. Lemma 5 shows that the parts are non-overlapping. We analyze the weight of the parts separately, essentially block by block. The proof is relatively straightforward if C is not special (and thus also F ∈ B 1 ), which is the most important case driving our choices for w. A typical block has nonnegative weight, we gain more weight in the block of F which exactly compensates the loss of weight in C, which occurs mainly in C itself. Lemma 6. If F is not in the first block then w(F) > 5, else w(F) > 4.
Proof. All the new items in bins of F are large or huge. Each bin has a new item and the bin F has two new items. Thus k(F) ≥ |F| + 1. All that remains is to show that s(F) > 12|F| + 3, and s(F) > 12|F| + 4 if F is not in the first block.
In the remaining cases there is a bin in R ∩ F before F . Lemma 3 gives s(H) ≥ 12|H|; moreover, if F ∈ E, then s(H) ≥ 12|H| + 3.
If F is preceded by three bins from F ∩ R, then F ∈ E and thus s(H) ≥ 12|H| + 3. Using Lemma 4(iii) twice, two of the bins in R before F have size at least 11 and using Lemma 4(i) the remaining one has size 9. Thus the size of these four bins is more than 11 + 11 + 9 + 18 = 4 · 12 + 1, summing with the bound for H we get s(F) > 12|F| + 4.
If F is preceded by two bins from F ∩ R, then by Lemma 4(i) the total size of these two bins and two new items in F is more than 36. If F ∈ R, the size of old items in F is at least 4 and with s(H) ≥ 12|H| we get s(F) > 12|F| + 4. If F ∈ E, which also implies that F is in the first block, then s(H) ≥ 12|H| + 3, thus s(F) > 12|F| + 3.
If F is preceded by one bin R from F ∩ R, then let n be a new item in F different from f . We have s(R) + s(n) > 18 and s(f ) > 6. We conclude the proof as in the previous case.
Proof. For every bin B before C, s(B) > 12 and thus w(B) > −1 by the definition of C. Let C be the set of bins before C with w(B) ≤ 0. This implies that for B ∈ C , s(B) ∈ (12, 13] and B has no large item. Any new item in any bin after the first bin in C has size more than 5. We have First we argue that either |C | ≤ 1 or C = {M, T }. Suppose that |C | > 1, choose B, B ∈ C so that B is before B . If B ∈ E, either B has at most two (new) non-large items and s(B ) ≤ 6 + 6 = 12, or it has at least three items and s(B ) > 5 + 5 + 5 = 15; both options are impossible for B ∈ C . If B ∈ R, it has old items of total size in [3,6]. Either B has a single new item and s(B ) ≤ 6 + 6 = 12, or it has at least two new items and s(B ) > 3 + 5 + 5 = 13; both options are impossible for B ∈ C . The only remaining option is that B is a special bin. Since L has a large item, L ∈ C and C = {M, T }. By Lemma 4(i), we have w(C) ≥ −4 and the lemma follows by (2) if C ∈ R or C = ∅ and also if C ∈ E and |C | = 1. For the remaining cases, we need to show w(C) ≥ −3. If C ∈ E and C = {M, T } then C contains two new items of size at least 5, thus w(C) ≥ −3. If C = T and C = {M } then C either has a large item, or it has two new items: otherwise it would have size at most 3 of old items plus at most 6 from a single new item, total of at most 9, contradicting Lemma 4(i). Thus w(C) ≥ −3 in this case as well.
(ii) If there is no special bin in D, then w(D) ≥ 0. If also C ∈ R then w(D) ≥ 1.
Proof. First we claim that for each block B i ⊆ D with three bins in R, we have By Lemma 4(iii), one of the bins in R ∩ B i has size at least 11. By Lemma 4(ii), the remaining three bins have size at least 36. We get (3) by observing that k(B i ) ≥ 5, as all the new items are large after C, each bin contains a new item and E i contains two new items. Next, we consider an incomplete block, that is, a set of bins B with at most two bins from R ∩ D followed by a bin E ∈ E ∩ D. We claim The bin E contains two large items, since it is after C. In particular, w(E) ≥ 1 and (4) follows if |B| = 1. If |B| = 2, the size of one item from E plus the previous bin is more than 18, the size of the other item is more than 6, thus s(B) ≥ 24; since k(B) ≥ 3, (4) follows. If |B| = 3, by Lemma 4(ii) we have s(B) ≥ 36; k(B) ≥ 4 and (4) follows as well. By definition, D ends by a bin in E (if nonempty). Thus the lemma follows by using (4) for the block of C ∈ R or for B 1 if it does not have three bins in R and adding (3) for all the remaining blocks. Note that C ∈ R implies D = ∅.
We are now ready to derive the final contradiction. If D does not contain a special bin, we add the appropriate bounds from Lemmata 7, 8 and 6. If C ∈ R then F is not in the first block and w(L) = w(C)+w(D)+w(F) > −6+1+5 = 0. If C ∈ E then F is not in the first block and w(L) = w(C) + w(D) + w(F) > −5 + 0 + 5 = 0. If C is the last special bin then w(L) = w(C) + w(D) + w(F) > −4 + 0 + 4 = 0. In all subcases w(L) > 0, a contradiction. Now suppose D does contain a special bin, thus C = L or C = M . We analyze the special bins together with the first block, up to F if F belongs to it. First observe that the only bin possibly before C is L and in that case Let A be the set containing C and all bins between C and A, not including A. Thus A contains two or three special bins followed by at most three bins from R. We . We also use that S(B) > 9 for any B ∈ A by Lemma 4(i) and that n, n together with any two bins in A have size at least 36 by Lemma 4(ii). Here n and n are two new items in A.
If A = F , then F ∈ B 1 . It is sufficient to prove that s(A) + s(A) ≥ 12|A| + 7 and sum it with all the other bounds, in particular w(F) > 5 from Lemma 6 and w(B i ) ≥ 0 for whole blocks B i ∈ D from Lemma 8. The items n and n from A together with the first two special bins in A have size more than 36. Let A be the set of the remaining bins; it contains possibly T and at most three bins from R. It remains to show s(A ) ≥ 12|A | − 5. For |A | = 0 it holds trivially. If |A | = 1, the only remaining bin has size more than 9 and this is sufficient. For |A | > 1 we apply Lemma 4(iii) and pair as many bins from A as possible. If |A | = 2, then s(A ) > 21 = 2 · 12 − 3. For |A | = 3 we get s(A ) > 22 + 9 = 3 · 12 − 5, since we can create a pair withoutR. Finally, if |A | = 4 then s(A ) > 22 + 21 = 4 · 12 − 5.
Otherwise A = F . If F = E 1 then it is sufficient to prove s(A) + s(F ) > 12|A| + 9 and use w(H) ≥ 3 from Lemma 3(iii) whenever A contains a bin from R, i.e.,R ∈ H; otherwise it suffices to prove s(A) + s(F ) > 12|A| + 10 and use w(H) ≥ 2 from Lemma 3(iv). If F ∈ R then it is sufficient to show s(A) + s(F ) > 12|A| + 12 and use s(H) ≥ 12|H| from Lemma 3, asR ∈ H; furthermore, we know that F also contains old items of size at least 3 or even 4 (if F =R), thus it is sufficient to prove s(A) + s(n) + s(n ) > 12|A| + 9 if F =R, or s(A) + s(n) + s(n ) > 12|A| + 8 otherwise, i.e., whenR ∈ A.
Summarizing and using s(F ) ≥ s(n) + s(n ), for A = F it is sufficient to prove that s(A)+s(n)+s(n ) > 12|A|+ 9 in all cases except if both F = E 1 andR ∈ A, 10 in all cases.
We now distinguish cases depending on |A|. Note thatR ∈ A whenever |A| ≥ 4.
Case |A| = 3: We have s(C) > 9 and the remaining two bins together with n and n have size more than 36. Thus s(A) + s(n) + s(n ) > 12|A| + 9, which is sufficient in all cases except if F = E 1 andR ∈ A. In this remaining case, C = L and A = {L, M, T }.
Let o be the size of old items in T . We apply Lemma 3(ii), using the fact that o + ρ > 6 by Lemma 2(v), where ρ is the total size of old items inR ∈ H, and h = 3, as H starts with 3 bins in R. We get o + s(H) ≥ o + 12|H| + h + ρ − 4 > 12|H| + 5.
Case |A| = 4: The last bin R ∈ A is in R. Together with any previous bin it has size more than 21, the remaining two bins together with n and n have size more than 36 by Lemma 4(ii). Thus s(A) + s(n) + s(n ) > 21 + 36 = 4 · 12 + 9 which suffices, sinceR ∈ A.
Case |A| = 5: The last two bins of A are in R, we pair them with two previous bins to form pairs of size more than 21 + 22. If F = E 1 then the remaining bin has size at least 9, since n does not fit into it and s(n) < 9, and s(F ) > 18, thus s(A) + s(A) > 21 + 22 + 9 + 18 = 5 · 12 + 10.
If F ∈ R then one of the last two bins of A has size more than 11 and the other forms a pair of size more than 21 with one special bin. The remaining two bins together with n and n have size more than 36 by Lemma 4(ii). Thus s(A) + s(n) + s(n ) > 11 + 21 + 36 = 5 · 12 + 8 which is sufficient, becauseR ∈ A.
Case |A| = 6: Then A contains all three special bins and three bins from R, therefore also F = E 1 . We form three pairs of a special bin with a bin from R of total size more than 21 + 22 + 22. Since s(F ) > 18, we have s(A) + s(F ) > 21 + 22 + 22 + 18 = 6 · 12 + 11. Since in this case A = F = E 1 , we have s(H) ≥ 12|H| + 3 and s(L) > 12|L|, a contradiction.
In all of the cases we can derive a contradiction, which implies that our algorithm cannot fail. This concludes the proof of Theorem 1.

Bin stretching for three bins
In this section, we focus on the problem of bin stretching restricted to only three bins.
We scale the input sizes by 16. The stretched bins in our setting therefore have capacity 22 and the optimal offline algorithm can pack all items into three bins of capacity 16 each. The three bins of our setting are named A, B, and C. We prove the following theorem.

Theorem 2.
There exists an algorithm that solves Online Bin Stretching for three bins with stretching factor 1 + 3/8 = 1.375.
A natural idea is to try to pack first all items in a single bin, as long as possible. In general, this is the strategy that we follow. However, somewhat surprisingly, it turns out that from the very beginning we need to put items in two bins even if the items as well as their total size are relatively small.
It is clear that we have to be very cautious about exceeding a load of 6. For instance, if we put 7 items of size 1 in bin A, and 7 such items in B, then if two items of size 16 arrive, the algorithm will have a load of at least 23 in some bin. Similarly, we cannot assign too much to a single bin: putting 20 items of size 0.5 all in bin A gives a load of 22.5 somewhere if three items of size 12.5 arrive next. (Starting with items of size 0.5 guarantees that there is a solution with bins of size 16 at the end.) On the other hand, it is useful to keep one bin empty for some time; many problematic instances end with three large items such that one of them has to be placed in a bin that already has high load. Keeping one bin free ensures that such items must have size more than 11 (on average), which limits the adversary's options, since all items must still fit into bins of size 16.
Deciding when exactly to start using the third bin and when to cross the threshold of 6 for the first time was the biggest challenge in designing this algorithm: both of these events should preferably be postponed as long as possible, but obviously they come into conflict at some point.

Good situations
Before stating the algorithm itself, we list several good situations (GS). These are configurations of the three bins which allow us to complete the packing regardless of the following input. Obviously the identities of the bins are not important here; for instance, in the first good situation, all that we need is that any two bins together have items of size at least 26. We have used names only for clarity of presentation and of the proofs.

Definition 2.
A partial packing of an input sequence S is a function p : S 1 → {1, 2, 3} that assigns a bin to each item from a prefix S 1 of the input sequence S. Proof. If s(B) + s(C) ≥ 22, then max(s(B), s(C)) ≥ 11, so we are in GS1 on bins A and B or on bins A and C. Else, if s(C) ≤ 6, we pack arriving items into B. If s(B) ≥ 11, we apply GS1 on bins A and B. Thus we can assume s(B) < 11 and we cannot continue packing into B any further. This implies that an item i arrives such that s(i) > 11. As s(C) ≤ 6, we pack i into it and apply GS1 on bins A and C.
Good Situation 4. Given a partial packing such that s(A)+s(B) ≥ 15+ 1 2 s(C), s(B) < 4, and s(C) < 4, there exists an online algorithm that packs all remaining items into three bins of capacity 22.
Proof. Any item that fits on A will be placed there. If this brings the size of A to 15 or more, we reach GS3. Any item of size at least 11 − 1 2 s(C) will be placed on B (where it fits). Then s(A) + s(B) > 26 and we reach GS1. with the bins A, and B.
The only case left is where 15 + 1 2 s(C) − s(B) ≤ s(A) < 15 and one or more items with size in the interval I · · = (22 − s(A), 11 − 1 2 s(C)) arrive. Note that I ⊆ (7,11). The items with size in I will be placed on C (where two such items fit together), while all other items are handled as above.
If two such items arrive, a total size of at least s(A) + 2(22 − s(A)) = 44 − s(A) > 29 has arrived, so we reach GS1 with the bins A and C.
If only one such item i ∈ I arrives, we either reach GS1 on A, B or we wait until an item x arrives which is supposed to go into A but cannot fit; we place x on C. The total size of A and C is now s(A) + s(x) + s(i) ≥ 22 + 7, triggering GS1.
Good Situation 5. Given a partial packing such that an item a with s(a) > 6 is packed into bin A, s(B) ∈ [3,6], and C is empty, there exists an algorithm that packs all remaining items into three bins of capacity 22.
Proof. We have s(B) ∈ [3, 4), otherwise we reach GS2. Pack all incoming items into A using First Fit as long as it possible. If s(A) ≥ 12, we can apply GS4, and so we assume the contrary. Therefore, s(A) < 12 and an item i arrives which cannot be packed into A.
Place i into B. If s(i) ≥ 12, we can apply GS3. We thus have s(i) ∈ (10, 12) and s(A) ≥ 22 − s(i) > 10. Continue with First Fit on bins B, A, and C in this order.
We claim that GS3 is reached at the latest after First Fit has packed two items, x and y, on bins other than B. If one of them (say x) is packed into bin A, this holds because s(x) + s(B) > 22 and s(A) > 10 already before this assignment -enough for GS1. If both items do not fit in A, they are both larger than 10, since s(A) < 12. We will show that this cannot happen.
As s(A) < 12 from our previous analysis, we note that s(x), s(y) > 10. We therefore have three items i, x, y with s(i), s(x), s(y) > 10 and an item s(a) > 6 from our initial conditions. These four items cannot be packed together by any offline algorithm into three bins of capacity 16, and so we have a contradiction with s(x), s(y) > 10.

The algorithm
We now proceed to describe the bin packing algorithm itself. The algorithm is split into two phases. We will often use a special variant of First Fit, described as follows: Definition 3. Let L = (X| k , Y | l , . . .) be a list of bins X, Y, . . . where each bin X has an associated integral capacity k satisfying s(X) ≤ k. GSFF(L) (Good Situation First Fit) is an online algorithm for bin stretching that works as follows: Algorithm GSFF(L): For each item i: If it is possible to pack i into any bin (including bins not in L, and using capacities of 22 for all bins) such that a good situation is reached, do so and continue with the algorithm of the relevant good situation. Otherwise, traverse the list L in order and pack i into the first bin X such that X| k ∈ L and s(X) + s(i) ≤ k.

First phase
In the first phase, we pack items into two bins so that either an item of size 6 arrives relatively early in the input sequence, or we can reach a good situation.
The algorithm of the first phase goes as follows: Algorithm First Phase: (1) GSFF(A| 4 , B| 4 ). Rename the bins so that s(A) ≥ s(B).
(2) Let the item on which Step (1) failed be j. If s(j) > 6 place j into A, and go to the Second Phase. (4) GSFF(B| 4 , A| q , C| 4 ) where q · · = 9 + 1 2 (s(B) + s(C)). As soon as C receives its first item, rename the bins B and C so that s(B) ≥ s(C) and continue. Note that also the value of q may change between packing of different items.
First phase analysis. For the rest of this section, we assume that we have reached Step (4). Thus s(j) ≤ 6. In fact, assuming that no good situation is reached before Step (4), we observe the following: Proof. If s(j) ∈ [4, 6], we reach GS2 by assigning j to C. So s(j) < 4 and j is assigned to the least loaded bin, which must have load more than 2 already, else we reach GS2 or GSFF(A| 4 , B| 4 ) does not fail on j. This implies that both A and B received items in Step (1), so s(A) + s(B) − s(j) > 6, else a good situation would have been reached before j arrived. We therefore have s(A) < s(B)+4 and s(B) > 3 after renaming the bins. It follows that s(B) ∈ (3, 4) and s(A) ∈ (6, 8).
Let us consider a third item z that does not fit into A. At this point, if s(A) > 15, we would be in GS1 with bins A, B, and so s(z) > 7.
Therefore, packing z into any bin would grant us GS1, and the algorithm only fails if z cannot fit anywhere. Similarly to w, we learn that as s(z) + s(y) > 22, one of the items y, z is over 11. However, such a configuration can never arrive: we have five items over 6 (j, x, w, y, z) and two of those would be over 11. There is no way to pack those five items into three bins of capacity 16. Case 2: Item x does not fit into bin A. Note that as s(A S ) < 6, we get s(j) + s(x) > 16. Item x is placed on B; before this assignment, s(B) < 4. Hence, after the renaming in Step (4), indeed s(A) < 6 + min(s(x), s(j)) = 6 + s(j ).
Assume that Step (5) fails on an item y. First let us prove that s(y) ≥ 7. If s(y) < 7, then s(B) > 15. If s(A) < 15, we pack y into A and note that s(C) = 0 ≤ 6; when s(A) ≥ 15, we pack y into C and get s(B)+s(C) = s(B)+s(y) > 22. Either way, we end up in GS3. Hence, we must have s(y) ≥ 7.
If y fits on A, we reach GS1 as s(B) + s(y) + s(A) > 22 + 6. Otherwise, we have no choice but to pack y into C in Step (6). We see now that no two items of {y, x, j} can be packed together in the offline optimum, since y does not fit with j on bin A; this will be useful for our final contradiction.
We reorder the bins in Step (7) again; we may also need to recalculate q. What is important for us is that the smallest item of {j, x, y}, denoted as j , is in A and that s(A) ≤ q = s(j ) + 6. (Note that C was empty before it got y.) We resume the analysis when Step (8) fails with an item z. Not reaching GS1 implies s(A) + s(B) < 26, and so min(s(A), s(B)) < 13, which in turn gives us s(z) > 9.
If z fits into A, we can reach GS3 using s(C) + s(B) > 22; the last inequality holds because the large item that arrived later in the input sequence did not fit with the large item that arrived earlier. So z does not fit into A, and as A S < 6, we have that z + j > 16.
The item z not fitting into A is all we need; the large item j ∈ A was the smallest in the set {j, x, y}, which means that min{s(j), s(x), s(y)} + s(z) > 16.
The offline optimum has no chance of packing z with any {j, x, y} together into bins of capacity 16, and we have already proved that no two items of {j, x, y} can be packed together either. This is a contradiction with the guarantee of Online Bin Stretching.
We have shown that all items are packed in the second phase, which concludes the proof of Theorem 2.

Conclusions
With our algorithm for m = 3, the remaining gap is small. For arbitrary m, we have seen at the beginning of Section 2 that a significantly new approach would be needed for an algorithm with a better stretching factor than 1.5. Thus, after the previous incremental results, our algorithm is the final step of this line of study. It is quite surprising that there are no lower bounds for m > 3 larger than the easy bound of 4/3.