# Open-end bin packing: new and old analysis approaches

We analyze a recently introduced concept, called the price of clustering, for variants of bin packing called open-end bin packing problems (OEBP). Input items have sizes, and they also belong to a certain number of types. The new concept deals with the comparison of optimal solutions for the cases where items of distinct types can and cannot be packed together, respectively. The problem is related to greedy bin packing algorithms and to batched bin packing, and we discuss some of those concepts as well. We analyze max-OEBP, where a packed bin is valid if by excluding its largest item, the total size of items is below 1. For this variant, we study the case of general item sizes, and the parametric case with bounded item sizes, which shows the effect of small items. Finally, we briefly discuss min-OEBP, where a bin is valid if the total size of its items excluding the smallest item is below 1, which is known to be an entirely different problem.

## Authors

• 10 publications
• ### Several methods of analysis for cardinality constrained bin packing

We consider a known variant of bin packing called cardinality constraine...
07/19/2021 ∙ by Leah Epstein, et al. ∙ 0

• ### Online Adaptive Bin Packing with Overflow

Motivated by bursty bandwidth allocation and by the allocation of virtua...
07/22/2020 ∙ by Sebastian Perez-Salazar, et al. ∙ 0

• ### Fully Dynamic Algorithms for Knapsack Problems with Polylogarithmic Update Time

Knapsack problems are among the most fundamental problems in optimizatio...
07/16/2020 ∙ by Martin Böhm, et al. ∙ 0

• ### On bin packing with clustering and bin packing with delays

We continue the study of two recently introduced bin packing type proble...
08/19/2019 ∙ by Leah Epstein, et al. ∙ 0

• ### Variable Neighborhood Search for the Bin Packing Problem with Compatible Categories

Bin Packing with Conflicts (BPC) are problems in which items with compat...
05/09/2019 ∙ by Luiz F. O. Moura Santos, et al. ∙ 0

• ### Selection from heaps, row-sorted matrices and X+Y using soft heaps

We use soft heaps to obtain simpler optimal algorithms for selecting the...
02/20/2018 ∙ by Haim Kaplan, et al. ∙ 0

• ### Prices of anarchy of selfish 2D bin packing games

We consider a game-theoretical problem called selfish 2-dimensional bin ...
07/25/2017 ∙ by Cristina G. Fernandes, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

We study a variant of bin packing, called Open End Bin Packing (OEBP). The input for one-dimensional bin packing problems consists of items with rational sizes in . There may be additional attributes for some variants and for certain analysis approaches. In bin packing problems, the goal is to partition the items into subsets called bins, under conditions on the contents of a bin. In the classic or standard bin packing problem [19, 20], a bin is a set of items whose total size is at most . In open end bin packing problems [30, 22, 29, 15, 17, 23, 24, 8, 16], a bin is a set of items such that by removing one item, the total size is below . In Max-OEBP, the removed item is the largest item, and in Min-OEBP the removed item is the smallest one. We are interested in greedy algorithms for these two problems. Such algorithms may be offline algorithms, which view the input items as a set, and online algorithms, which receive items one by one, and pack every arriving item before seeing the next one.

Measures. An approximation algorithm has an asymptotic approximation ratio of at most , if there exists a constant (which is independent of the input), such that for any input , the cost of the algorithm for does not exceed the following value: times the optimal cost for this input plus . The asymptotic approximation ratio is the infimum for which the inequality holds for every input. If , then the approximation ratio is called absolute. A specific optimal (offline) algorithm as well as its cost are denoted by ( is sometimes used for the cost for a fixed input ). An alternative definition of the asymptotic approximation ratio is the supreme limit of the ratio between the two costs of the algorithm and of , as a function of the latter cost, taking the maximum or supremum over the inputs with the same optimal cost. If the algorithm is online, the term approximation ratio is sometimes replaced by the term competitive ratio, but the definition is unchanged, and we will use the term approximation ratio uniformly. For bin packing problems and approximation algorithms for them, the asymptotic measures are considered to be more meaningful and therefore we will mostly discuss asymptotic measures. When we do not write if the measure is asymptotic or absolute, the results hold for both measures.

Bin packing with item types.

We describe two models for bin packing problems, where the input is presented together with a fixed partition into subsets. This partition is a part of the input, and not the partition into bins, which is required from an algorithm. The subsets of the partition of the input are also called item types. Such models may be offline or online. The first variant out of such problems, called batched bin packing, was defined as a model related to online algorithms. This is an intermediate model which has features of both the extremes of the offline problem and the online problem. It was studied for combinatorial optimization problems, including classic bin packing

[18, 6, 10, 13], and here we define it for bin packing problems. Given an integer parameter , items are presented in batches, for an integer . For each batch, the algorithm receives all its items at once, and these items are to be packed irrevocably before the next batch is presented (or before termination, if the current batch is not the last one). Two sub-models have been defined. The first one is where the algorithm may use bins from previous batches for the packing, in which case the crucial difficulty that the algorithm is faced with is that it does not see future batches when a batch is packed. In the second one, which we study here, different batches cannot share bins. We stress that the two versions are semi-online models, in the sense that the algorithm sees the current batch and past batches, but it does not know anything about future batches. In particular, such batches may be empty. However, the second model, which does not allow combining items from different batches in bins is equivalent to an offline model because the different batches are packed independently. It is known that for , the tight bound on the asymptotic approximation ratio (for the second sub-model and classic bin packing) is [13], and for larger values of the ratio increases and grows to approximately . In principle, it is possible to find an optimal solution for every batch, but in some cases a different algorithm is easier to analyze, and still tight bounds are found.

The last model leads us to bin packing with clustering, which is an offline problem, and it is related to the variant of batched bin packing studied here (where items of different batches cannot share bins). In this problem, every item has a second attribute, called a cluster index or a color. A global solution is one where items are packed without considering their clusters, i.e., it is just a solution of the corresponding bin packing problem for this input. A clustered solution is one where every cluster or color must have its own set of bins, and items of different clusters cannot be packed into a common bin. This corresponds to cloud computing, where an input data stream is split quickly into sub-inputs, which are considered independently [2]. Obviously, in order to avoid degenerate cases (for example, the case that every item has its own cluster), an assumption on the input is enforced. It is assumed that every cluster is sufficiently large, and an optimal solution for each cluster has at least a fixed number of bins. Here, we assume that every cluster requires at least two bins, so that (for example) a situation where every item belongs to its own cluster will not be encountered. This model was introduced by Azar et al. [2] (see also [14]) for classic bin packing. The goal is to compare optimal solutions, that is, to compare an optimal clustered solution to an optimal global solution, also called a globally optimal solution. We are interested in the worst-case ratio over all valid inputs, and this (absolute and asymptotic) approximation ratio is called price of clustering (PoC). From an algorithmic point of view, the goal is to design an approximation algorithm for which it is not allowed to mix items of different clusters, while the algorithm still has a good approximation ratio compared to a globally optimal solution. Our results will hold for both the absolute and the asymptotic approximation ratio, and thus we just use the term PoC.

The last two models are related, though in batched bin packing (with separate bins for the different batches), the number of batches is the analyzed parameter. That is, there is a small number of clusters which are typically large. In bin packing with clustering, there is typically a large number of clusters, which may be relatively small, and a lower bound on their optimal numbers of bins can be seen as a parameter. We study OEBP with respect to greedy algorithms and packing with item types. We mostly focus on Max-OEBP, and provide some observations for Min-OEBP as well. Note that we analyze Max-OEBP with respect to multiple aspects, and in particular we consider greedy algorithms. As mentioned above, in order for the results to be comparable with other results for bin packing, our analysis is for the asymptotic approximation ratio. For bin packing with clustering, previous work is for the absolute approximation ratio and our results are valid for both measures.

In the general variants of the problems it is assumed that the size of an item may be very close to the capacity of a bin, or even equal to it. However, in many applications bin capacities are larger than item sizes. The parametric case is the one where sizes do not exceed a fixed value , where . For some problems, adding the size constraint makes the problem different, and more interesting. There are models where the interesting cases are only those where is a reciprocal of an integer, but in other cases there are additional values of that should be considered. For classic bin packing, the asymptotic approximation ratio (for essentially all reasonable algorithms) tends to as tends to zero. However, there are variants where the effect of small items does not decrease the ratio that much [1]. The problems studied here also have the property that the asymptotic approximation ratio tends to for small , but the price of clustering is never close to (this is the case also for classic bin packing).

For the PoC, we assume that every cluster requires at least two bins. The resulting constraint on the items of a cluster for this assumption is slightly different for distinct variants of bin packing, but we feel that for comparison, the constraint should be defined in a similar way based on optimal solutions (for the appropriate variants). Here, we show that the PoC is equal to for max-OEBP and to for min-OEBP. We also find tight bounds for the general parametric case of items of sizes in and any , which requires a careful analysis, and we shed some light on the parametric case for min-OEBP. For small values of , the PoC tends to for both variants. The results of [2] for classic bin packing are based on the assumption that the cost of an optimal solution for every cluster is at least for an integer parameter . In the case , they show that the PoC is exactly , but for , it is strictly below , and more specifically, it is at most (but at least ). These bounds were slightly improved for in [14] to and , respectively, where the case of larger is studied as well. The example of [2] and holds only for , but it is not difficult to see that is the tight bound for and any , by using clusters with jobs of size each for a large integer . We find here that unlike classic bin packing, the PoC is much smaller for max-OEBP and for min-OEBP if all items are small.

Literature review of algorithmic results. Greedy algorithms for classic bin packing were studied already in the early stages of the study of such optimization problems [20, 19]. The simplest algorithm for classic bin packing is Next Fit (NF). This algorithm assigns the first item into an empty bin, and this bin becomes active. At every time, there will be one active bin. For each additional item, it is packed into the active bin if possible, and otherwise a new bin is defined as active and the new item is packed into it. A class of common greedy algorithms is called Any Fit (AF). These algorithms never pack a new item into an empty bin, if there is another possible way to pack the item. This class contains algorithms that choose a bin arbitrarily (out of the existing bins that can accommodate the item), but also First Fit (FF), that selects the bin of minimum index (where the item can be packed), and Worst Fit (WF), that selects the bin of smallest load or maximum free space (if the item can be packed there). There are other intuitive choices that an algorithm may select. There are also offline versions of these algorithms, where items are sorted by non-increasing size. The word Decreasing is added to the names of the algorithms, and the names of the algorithms are abbreviated by NFD, AFD, FFD, and WFD. These algorithms were defined approximately fifty years ago [19, 20]. It is known that the asymptotic approximation ratio of FF and BF is [20] (in fact, the absolute approximation ratio is also [11]). For WF (and AF in general) and NF, the ratio is [19] (there are some other special cases of AF, for which the ratio is equal to ). The asymptotic approximation ratios of the sorted variants are smaller, for example, the ratio for FFD is [19, 12]. For NFD, the asymptotic approximation ratio is almost [3], and for AFD algorithms in general, the asymptotic approximation ratio is at most [19, 20]. Most parametric results are for classic bin packing.

Greedy algorithms for classic bin packing were also analyzed with respect to the parametric case. For example, the asymptotic approximation ratio of FF if all items have sizes in for an integer is [20], and the cases where the parameter is not a reciprocal of an integer are identical to the cases where it is (for example, the cases and are equivalent). For NF and WF, the asymptotic competitive ratio is for . For reciprocals of integers, it is , and more generally, for , the ratio is exactly [19]. There is also work on FFD and NFD in the parametric case [19, 9, 28, 3]. Since greedy algorithms without sorting are greedy algorithms, we mention that other online algorithms are being studied continuously during the last fifty years [4, 5]. The articles of van Vliet [27] and Balogh, Békési, and Galambos [7] contain lower bounds on the asymptotic approximation ratio of online algorithms, where in addition to the lower bounds for the standard case also lower bounds for the parametric case, and the methods for designing algorithms [21, 26] can also be used for parametric versions.

Four variants of OEBP were studied in the past. The first two (which are not those studied here) are online problems, where items are packed into a bin in the order of arrival, and the total size for a valid bin excluding the item that arrived last has to be below . In the unfair variant [22, 30], the optimal offline solution can reorder the items, so the last item of a bin is not necessarily the one that arrived last. In the fair variant [29, 8], all algorithms have to obey the order of arrival. The unfair variant was studied with respect to a certain class of algorithms for the parametric case [30]. Since an offline algorithm can reorder while the online algorithm cannot reorder, the bounds are based on the simple property (used also here) that any bin of an offline solution has items whose total size is below , while an online algorithm has items of total size above packed into almost every bin. This upper bound holds for many algorithms for other variants of OEBP. For the fair online variant, Yang and Leung [22] proved lower bounds on the asymptotic approximation ratio (which were slightly improved later [8]). In particular, they showed a lower bound of . An online algorithm of asymptotic approximation ratio was designed [8]. For the case where there are no items of size , the lower bound of [22] is much smaller (), and the results of Zhang [30] imply that there is a simple online algorithm whose asymptotic approximation ratio is for this case. For this case, the algorithm of [8] has an asymptotic approximation ratio of at most .

Max-OEBP was not studied as an online problem, but algorithms similar to those of the ordered problem yield the same bounds. Offline algorithms were studied and in particular, FFD was studied for the case with items of sizes strictly below , and its asymptotic approximation ratio is [25]. As for Min-OEBP, greedy and online algorithms were analyzed for this variant [24]. In particular, several algorithms including FFD and First Fit Increasing (FFI) have asymptotic approximation ratios of , for NF, WF, and FF these ratios are , , and , respectively. An improved online algorithm was designed recently [16]. The paper [24] also contains a partial parametric analysis.

There are several motivations of studying greedy algorithms. These algorithms are simple and natural, easy to implement, and they are frequently found in the industry. We analyze them in the same work as bin packing with item types since greedy algorithms are useful in the analysis of the PoC and batched bin packing. Definitions for online algorithms and greedy algorithms for OEBP problems should carefully take into account the property that packed bins must remain valid throughout the execution of an algorithm.

Notation. For a fixed input, let be the number of clusters. Let be the number of bins in an optimal solution for the th cluster, whose input is . We let be the set of items , where . Let be a globally optimal solution for , and its cost is denoted by , that is, we use the notation of an optimal solution for the globally optimal solution. We let be the number of bins in the output of an algorithm for cluster , which may be an optimal solution or any other solution. For batched bin packing, we have batches rather than clusters, but the notation defined here is unchanged. For an algorithm ALG and an input , the cost of ALG, which is the number of bins it creates for is denoted by . In some cases, We will use weights for the analysis of the upper bound. Weights allow us to compare two solutions, using the fact that the total weight of all input items is consistent. For any weight function defined in this work, we will use to denote the total weight of all items of , and denotes the total weight for .

Structure of the paper and results. The results for the PoC appear after we deal with the analysis of greedy algorithms. This is done not only because greedy algorithms are natural and interesting in their own right, but also because greedy algorithms are used for the analysis for batched bin packing and bin packing with clustering. While the model assumes that every batch or cluster can be packed using an optimal packing, it is often the case that using a greedy algorithm for the analysis instead still allows us to find tight bounds.

In Section 2 we analyze greedy algorithms for max-OEBP. In particular, in Section 2.1 we analyze algorithms that do not sort the input. We find tight bounds on the asymptotic approximation ratios of NF, WF, and FF. The main result of this part is the tight analysis for FF as a function of . While the tight bound for NF (and WF) is , for FF this bound is tight only for values of that are reciprocals of integers, and for other values it is smaller. In Section 2.2, we analyze greedy approaches for sorted inputs, and we study NFD and FFD. Interestingly, NFD also performs better exactly for the same values of as FF, but the effect of sorting is not large. For all these algorithms, the overall bound (that is, the bound for ) is . For FFD, the overall bound is smaller and equal to . (this was known for the case where there are no items of size in the input [25]). Section 3 is dedicated to inputs with item types, for max-OEBP. We show that for any number of batches , the tight asymptotic approximation ratio is , and we prove tight bounds for any . In Section 3.1 we analyze the price of clustering. The main contribution of this part is a careful analysis of the PoC as a function of . The value of the PoC is between and , depending on the value of . In Section 4 we discuss the PoC for min-OEBP. We prove the general case, where the value of the PoC is , analyze particular cases, and we provide examples explaining why we do not perform a complete analysis. Omitted proofs can be found in the Appendix.

## 2 Greedy algorithms for Max-OEBP

We start the analysis of Max-OEBP with greedy algorithms, first those that do not sort the input and therefore they are in fact online algorithms, and afterwards those that sort the input and apply a greedy algorithm for it. The last class of algorithms can be seen as semi-online algorithms where the input arrives in a sorted order. We discuss several common and natural greedy algorithms. In most cases we discuss not only general inputs but also parametric inputs. We usually use the parameter as an upper bound on the sizes of items, that is, item sizes are in . The algorithms were originally defined for classic bin packing, and here we stress the differences in the definitions of these algorithms for the studied problem.

### 2.1 Algorithms without sorting

The algorithm First Fit (FF) for this variant is defined as follows. Every item in the list is packed into the bin of the minimum index such that the item can be added to this bin. An item can be added to a bin in the case where it will remain valid after adding the item, which means that it will satisfy the properties of a bin. The required property for adding an item is that after adding this item, it is still the case that by removing the largest item of the bin, the total size of items will be smaller than . If there is no such bin, a new bin is used, which is always possible. Similarly, one can apply AF (and in particular WF) or NF. AF algorithms also select a bin out of those that can receive the item (based on the same property), and uses a new bin if there is no such bin. There are two variants of WF, with respect to the choice of a bin out of bins where an assignment will result in a feasible bin. In the first variant, a new item is added to the existing bin where the current total size is the smallest (and the resulting total size will also be the smallest), and in the second variant, a new item is added to the bin where after the assignment, the total size excluding the largest item will be the smallest.

Note that it is possible that an item is added to a bin whose total size is above . Consider a bin with three items of size . If an item of size is added, the bin remains valid. On the other hand, for all these algorithms, any of the outputs will satisfy the property that every bin, possibly excluding the last one, has a total size of items of at least . This holds since a bin whose total size of items is below can receive an additional item of any size. We will see later that this property does not hold for min-OEBP. For every valid solution, the total size of items for every bin excluding one item is below , and thus, if items sizes are bounded from above by a parameter , bins have total sizes below (and this holds for min-OEBP as well).

We start with the analysis of NF and WF. In the case of Max-OEBP, NF and both versions of WF have identical behaviours with respect to the asymptotic approximation ratio. Recall that we analyze the case where item sizes are in for , and therefore the analysis covers both the general case () and the parametric case (). The same upper bound construction is also valid for FF, but it is not always tight as we will see later.

###### Theorem 1

The asymptotic approximation ratio of NF, of both variants of WF and of AF in general with the parameter is exactly . It is equal to for the general case .

Note that particular variants of AF may have a smaller asymptotic approximation ratio, and we show that for FF and an infinite number of values of this is indeed the case.

Proof. The upper bound follows from the property that any bin of the output, possibly excluding the last one, has a total size of items of at least , while no bin can have a total size of items of or more. This last property holds (as explained above) since the largest item of any bin has size at most and the remaining items have a total size below . This is valid for NF and any AF algorithm.

To prove the lower bound for NF and the two variants of WF (which will imply the lower bound for AF in general), let be a large positive integer such that , and let , where . For a large positive integer , there are large items, each of size , and small items, each of size . The input arrives in the following order. Every large item is followed by exactly small items. The total size of every small items is , so a large item can be packed into a bin with small items. However, the total size together with the large item is above (it is equal to ), so after items are packed and the next large items arrives, a new bin is opened. For NF, previous bins cannot be used again by definition, so it is clear that the process is repeated and bins with an identical packing are created. For WF, previous bins can be used, but we claim that the resulting packing is the same as for NF. Assume that some number of bins with one large item and small items were created. A large item cannot be added to such a bin, while a small item can still be added if is sufficiently small. Thus, a new large item is packed into a new bin, and then all bins are considered for any small item. However, while small items are being packed (there are such items), the new bin has the smallest total size of items. All bins have one large item each, so the new bin also has the smallest total size excluding the large item. Thus, all small items are packed into the new bin, as for NF. Thus, all the considered algorithms pack exactly bins.

An optimal solution acts as follows. First, it creates bins with two large items each. Note that by . The remaining large items are packed one per bin, and the number of such bins is . This number is non-negative since .

The number of bins with at least one large item is , which is at least and at most , and we show that all small items can be packed into these bins and one additional bin. Any bin with one large item receives small items, where and . Any bin with two large items receives small items, where . The new bin can receive small items.

The number of small items packed with large items is at least . There are at most remaining small items, so they can be packed into one bin. The total number of bins for the described packing is at most , while the algorithm uses bins, and the lower bound on the asymptotic approximation ratio follows by letting grow to infinity.

We turn our attention to better AF algorithms and in particular FF. We found the asymptotic approximation ratio for AF algorithms in general, but some AF algorithms may have a better performance. We will show that for certain values of all AF algorithms including FF still have the same performance, and later we see that for other values of , FF has a better performance. Let , i.e., if , and for for an integer .

###### Lemma 2

For any integer , the asymptotic approximation ratio of any AF algorithm is at least . In the case for an integer , the asymptotic approximation ratio of FF and any AF algorithm is exactly , and in particular, in the general case it is equal to .

Proof. As we saw in the previous theorem, the upper bound of holds for all AF algorithms including FF.

Consider the following inputs. Let be large positive integers, and let . There are large items of size , and small items, whose sizes are equal to . An optimal solution has bins, each containing small items and one large item. Such bins are feasible since .

We prove the lower bound for any AF algorithm, including FF. Assume that an AF algorithm receives the small items before the large items. In this case, the small items are packed into bins (with items each), which cannot receive any further items (because there are no smaller items in the input), and bins with large large items each. The total number of bins is . The asymptotic approximation ratio is at least , tending to for growing to infinity.

The last simple construction is not the best possible for all values of . We saw that the asymptotic approximation ratio of FF for max-OEBP is for cases that the reciprocal of is an integer, and the above analysis is tight for those cases. For the general case we got tight bounds of . To summarize, we got tight bounds of for .

In what follows we analyze FF for max-OEBP in the parametric case where . We will show that the asymptotic approximation ratio as a function of is:

 R1(β)=⎧⎪ ⎪⎨⎪ ⎪⎩1+4+t2⋅β(t+2)2    for even t,   β∈[1t+1,1t)1+4+(t2−1)⋅β(t+1)⋅(t+3)    for odd  t,   β∈[1t+1,1t) .

Note that the in special case we get the same bounds as before. For all other cases we get a smaller bound since is equivalent to , and is also equivalent to .

For every interval of the form the function is continuous and monotonically non-decreasing. For , the functions are strictly increasing. The function is not continuous in general, as for example the image for is just the point , the image for is , and the image for is .

###### Lemma 3

The asymptotic approximation ratio of FF for the parameter is at least .

Proof. We start with the case of odd . Let . Since , we have . By , we have . We will use the property in what follows. Let be a large positive integer, Let (where ), and let .

The input consists of items of size , items of size , and items of size . We consider a solution that has bins. The bins have identical contents, where each bin has items of size , one item of size , and one item of size . Since , every bin contains a load below if its item of size is excluded, and the packing is valid.

FF receives the items in the following order. First, all items of sizes arrive. Every bin for such items has exactly items and cannot receive any other items (since there are no smaller items). The number of bins so far is . Next, the input will contain repeated batches of the following items. Every batch has items of every size, such that it has items of size followed by items of size . There are such batches. Since , every batch can be packed into one bin. Given the items of a batch, adding an item of size (or of size ) results in a load of (or a larger load), the total size after excluding one item of size is at least , so the items of any batch cannot be packed into bins of other batches (and they cannot be packed into bins with items of size ). Thus, FF packs the input into bins.

Since by the definition of , and by the value of , we find that the number of bins of FF is at least , while an optimal solution has at most bins. The ratio is at least . We get the lower bound by letting grow to infinity.

We continue with the case of even . Let . By , we have . We will use the property in what follows. Let be a large positive integer, Let (where ), and let .

The input consists of items of size , items of size , and items of size . We consider a solution that has bins. The first bins have identical contents, where each bin has items of size , one item of size , and one item of size . There are also bins, each with items of size and one item of size . Since , and , every bin contains a load below if its item of size is excluded, and the packing is valid. All items are packed, and this solution has bins.

FF receives the items in the following order. First, all items of sizes arrive. Every bin for such items has exactly items and cannot receive any other items. The number of bins so far is . Next, the input will contain repeated batches of the following items. Every batch has items in total, such that it has items of size followed by items of size . There are such batches. Since , every batch can be packed into one bin. Since adding an item of size (or of size ) results in a load of (or larger) excluding one item of size , the items of any batch cannot be packed into bins of other batches (and they cannot be packed into bins with items of size ). Thus, FF packs the input into bins.

Since by the definition of , and by the value of , we find that the number of bins of FF is at least , while an optimal solution has at most bins. The ratio is at least . We get the lower bound by letting grow to infinity.

To prove an upper bound, we define a weight function. For , we let , and for , we let , i.e.,

 w(x)=4+t2⋅x(t+2)2 \ \ if t is even, and \ % w(x)=4+(t2−1)⋅x(t+1)⋅(t+3)\ \ \ if t is % odd.

The weight function is continuous and monotonically non-decreasing. The function is in fact equal to , since and are both equivalent to .

###### Lemma 4

The asymptotic approximation ratio of FF for the parameter is at most .

Proof. We show that the weight of a bin of an optimal solution does not exceed . For any bin, consider its items excluding the largest item. The weight of any item does not exceed its size, and therefore the total weight of these items is below . Since the weight function is monotonically non-decreasing and no item has size above , the weight of the additional item is at most . The total weight is therefore below .

We will show that for an output of FF with bins, the total weight is at least . Recall that for every bin in an output of FF which is not the last bin, the load is at least , since any bin whose load is below can receive at least one additional item. We say that an item is large if its size is at least , and otherwise it is small. We will use the property that . FF has the property that removing a bin with its items would not change the output for the remaining items. Thus, we can remove bins whose total weights are at least and consider the remaining bins. We also remove the last output bin (and it is left to show that the total weight for the remaining bins is at least their number minus ). Each one of the remaining bins has a load of at least , but its total weight is below .

Since all items have sizes below , every bin (with load or larger) has at least items. Moreover, the number of large items cannot exceed , since the total size of large items is at least .

We classify bins according the numbers of large items that they have, where these numbers are integers in

. The type of a bin is the number of its large items, and satisfies . We will show first that every bin of type or has weight of or more. For a bin of type , its has no large items, but its load is at least . Each of its items has a weight equal to its size, and thus the total weight is at least , so there are no such bins. For a bin of type , its has large items, each of weight at least , and the total weight is again at least , so there are no bins of this type either. For any , we will consider the bins of type independently of other types (since FF would create the same bins as before for any of these sub-inputs that consist of the items of specific subsets of bins). For every such subset of bins, we will show that its total weight is at least the number of bins minus , which will prove the claim regarding the total weight for the entire output.

Consider a fixed type , where . We will now analyze the subset of bins of this type. Since every bin has at least items, every such bin also has at least small items (of sizes smaller than ), and we let . Since , every bin of this type has at least one small item. Since , every bin of type has at least one large item, and thus its largest item is large.

Let the number of bins of type , let be the total size of small items of the th bin for (where indexes are defined according to the order that the bins were opened), and let denote the total size of large items of the th bin, excluding the largest item of this bin. The smallest small item of bin has size of at most , since the bin has at least small items, whose total size is . Moreover, since the weight of this bin is below , and the total weight of large items is at least , we find that the combined total weight of small items is below . Since the weight of a small item is equal to its size, we find that holds for .

We claim that for we have holds. Indeed, the smallest small item of bin was not packed into bin because the load together with it (and excluding the largest item of that time) would have been at least (and the load cannot decrease over time). For bin , the total size of all items is at least , and the size of the largest item is at most , and therefore, holds. For simplicity of notation, we let . Now we have for .

We consider the case separately. In this case holds for every bin, and , and therefore for (since ) and . We get that the total weight of all small items of bin is while the weight of the large item is at least . Thus, the total weight for every bin of this type is at least (so there are no such bins), and the total weight of the last bin of this type is at least .

We are left with the cases , and in particular, we have . In the case , every bin of this type has at least one large item in addition to the largest one. The total size of the large items of bin (including the largest one) is at least , since the average size of a large item (which is not the largest one) is , and the largest large item has at least this size. Thus, the total size of large items is at least .

We will use the weights for large items as they were defined, and for the small items, the total weight is at least the total size. In the case where is odd, we find that the total weight for bin is at least

 Yj+4⋅i(t+1)⋅(t+3)+t−1t+3⋅Xj⋅ii−1 .

In the case where is even, we find that the total weight for bin is at least

 Yj+4⋅i(t+2)2+t2(t+2)2⋅Xj⋅ii−1 .

We have , which holds by , , , , and , and therefore , which we use in the proofs.

An analysis for odd .

By using , we get that the weight of bin is at least

 Yj+4⋅i(t+1)⋅(t+3)+t−1t+3⋅ii−1⋅(1−Yj−Yj+1m)
 =4i(i−1)+i(t2−1)(t+1)⋅(t+3)⋅(i−1)+Yj⋅(1−(t−1)⋅i(t+3)(i−1))−Yj+1⋅(t−1)⋅i(t+3)(i−1)⋅m .

Note that

 4i(i−1)+i(t2−1)(t+1)⋅(t+3)⋅(i−1)=4i2−5i+it2(t+1)⋅(t+3)⋅(i−1)=1+(t+2−2i)2−1(t+1)⋅(t+3)⋅(i−1)

holds since

 (t+1)⋅(t+3)⋅(i−1)+(t+2−2i)2−1=(t2+4t+3)⋅(i−1)+(t+2)2−4i(t+2)+4i2−1
 =t2⋅i+4ti+3i−t2−4t−3+t2+4t+4−4it−8i+4i2−1=t2⋅i+4i2−5i .

Thus, after subtracting for every bin, we consider the following sum (for which we show that it is at least ):

 k∑j=1((t+2−2i)2−1(t+1)(t+3)⋅(i−1)+Yj⋅(1−(t−1)⋅i(t+3)(i−1))−Yj+1⋅(t−1)⋅i(t+3)(i−1)⋅m)
 =k∑j=1((t+2−2i)2−1(t+1)(t+3)⋅(i−1)+Yj⋅(1−(t−1)⋅i(t+3)(i−1))−Yj⋅(t−1)⋅i(t+3)(i−1)⋅m)
 +Y1⋅(t−1)⋅i(t+3)(i−1)⋅m−Yk+1⋅(t−1)⋅i(t+3)(i−1)⋅m .

Since and , we have

 Y1⋅(t−1)⋅i(t+3)(i−1)⋅m−Yk+1⋅(t−1)⋅i(t+3)(i−1)⋅m≥−(t−1)⋅it(t+3)(i−1) .

By (which holds for ) and , the last expression is at least .

It is therefore sufficient to show that

 (t+2−2i)2−1(t+1)(t+3)⋅(i−1)+Yj⋅(1−(t−1)⋅i(t+3)(i−1))−Yj⋅(t−1)⋅i(t+3)(i−1)⋅m≥0

holds for any . Since is positive, it remains to prove that

 (t+2−2i)2−1+Yj⋅(t+1)⋅((t+3)(i−1)−(t−1)⋅i−(t−1)⋅im)≥0

holds for any .

The multiplier of (which is non-negative) is , and it is not necessarily non-negative. If it is non-negative, we are done since is also non- negative as is odd and is even, so . Otherwise, in the case that the multiplier of is negative, we would like to prove that

 (t+2−2i)2−1+Yj⋅(t+1)⋅((t+3)(i−1)−(t−1)⋅i−(t−1)⋅im)≥0

holds. We use the fact , and we get that it is sufficient to prove that holds. This is equivalent to

By , we will prove (in fact, we prove that it holds with equality).

Indeed we have

 (t+2−2i)2−1−(t−1)⋅i⋅(t+2−i)+(t+1−i)(t+3)⋅(i−1)
 =(t+2−2i)⋅(t+2−2i−i(t−1)+(t+3)(i−1))−1−i2(t−1)+(i−1)2(t+3)
 =(t+2−2i)⋅(2i−1)−1−i2t+i2+i2t−2it+t+3i2−6i+3
 =(2it+4i−4i2−t−2+2i)+4i2−2it+t−6i+2=0 .

An analysis for even .

By using , we get that the weight of bin is at least

 Yj+4⋅i(t+2)2+t2(t+2)2⋅ii−1⋅(1−Yj−Yj+1m)
 =t2⋅i+4i2−4i(t+2)2⋅(i−1)+Yj⋅(1−t2⋅i(t+2)2⋅(i−1))−Yj+1⋅t2⋅i(t+2)2⋅(i−1)⋅m .

Note that since

 (t+2)2⋅(i−1)+(t+2−2i)2=t2⋅i+4i2−4i .

Thus, we consider the following sum:

 k∑j=1((t+2−2i)2(t+2)2⋅(i−1)+Yj⋅(1−t2⋅i(t+2)2⋅(i−1))−Yj+1⋅t2⋅i(t+2)2⋅(i−1)⋅m)
 =k∑j=1((t+2−2i)2(t+2)2⋅(i−1)+Yj⋅(1−t2⋅i(t+2)2(i−1))−Yj⋅t2⋅i(t+2)2(i−1)⋅m)
 +Y1⋅t2⋅i(t+2)2(i−1)⋅m−Yk+1⋅t2⋅i(t+2)2(i−1)⋅m .

Since and , we have

 Y1⋅t2⋅i(t+2)2(i−1)⋅m−Yk+1⋅t2⋅i(t+2)2(i−1)⋅m≥−t⋅i(t+2)2(i−1) .

By (which holds for ) and , the last expression is at least .

It is therefore sufficient to show that holds for any . The multiplier of is . If it is non-negative, we are done since is non-negative (and so is ). Otherwise, since the denominator is positive, we would like to prove that