Several methods of analysis for cardinality constrained bin packing

07/19/2021 ∙ by Leah Epstein, et al. ∙ University of Haifa 0

We consider a known variant of bin packing called cardinality constrained bin packing, also called bin packing with cardinality constraints (BPCC). In this problem, there is a parameter k≥2, and items of rational sizes in [0,1] are to be packed into bins, such that no bin has more than k items or total size larger than 1. The goal is to minimize the number of bins. A recently introduced concept, called the price of clustering, deals with inputs that are presented in a way that they are split into clusters. Thus, an item has two attributes which are its size and its cluster. The goal is to measure the relation between an optimal solution that cannot combine items of different clusters into bins, and an optimal solution that can combine items of different clusters arbitrarily. Usually the number of clusters may be large, while clusters are relatively small, though not trivially small. Such problems are related to greedy bin packing algorithms, and to batched bin packing, which is similar to the price of clustering, but there is a constant number of large clusters. We analyze the price of clustering for BPCC, including the parametric case with bounded item sizes. We discuss several greedy algorithms for this problem that were not studied in the past, and comment on batched bin packing.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

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

The bin packing problem is defined as follows. Given items of rational sizes in , partition these items to subsets of total sizes not exceeding so as to minimize the number of subsets. The subsets are called bins, and the process of assigning an item to a subset is called packing. In the classic or standard variant, there are no other attributes or conditions. This problem has been studied for fifty years [26, 27, 23, 4, 28, 31, 32, 33, 10, 16, 17, 13, 5, 7, 9]. Another well-known natural variant limits the number of items that one bin can receive. Given an integer parameter , bin packing with cardinality constraints (BPCC) is the variant of bin packing where every bin is required to have at most items [30, 29, 12, 3, 18, 22, 24, 11, 15, 6]. In this work we study BPCC with respect to new and old concepts. One well-studied concept is greedy algorithms. Such algorithms are frequently online, in the sense that they pack every item before seeing the future items. The problems were studied as offline problems, where an algorithm receives the entire input as a set, and as online problems, where an algorithm receives the input as a sequence. Here, we study not only algorithms but other concepts (defined below) as well.

Measures for bin packing. For an algorithm for a certain problem, that does not necessarily compute an optimal solution, we say that its asymptotic approximation ratio does not exceed , if there exists a constant value (this value has to be independent of the input), such that for any input for the problem, the cost of this algorithm for input is bounded from above by the following value: times the optimal cost for plus the constant . The asymptotic approximation ratio is the infimum value for which this inequality holds for every input . If the constant is equal to zero, the approximation ratio will be called strict or absolute. One specific optimal (offline) algorithm for the problem and its cost are usually denoted by , and is also used for the cost for a fixed input . Another definition of the asymptotic approximation ratio is the supreme limit of the ratio between the cost of the algorithm and the cost of , as a function of the second cost, where we take the maximum or supremum over the inputs with the same optimal cost. For online algorithms, we still use the term approximation ratio, and the definition is unchanged. The term competitive ratio has the same meaning in the literature. The asymptotic measures are considered to be more meaningful for bin packing problems, and thus we are mostly interested in those asymptotic measures. In the cases where we do not specify whether the measure is asymptotic or absolute, the result holds for both these measures. We will use such an analysis throughout the article.

Parametric variants for bin packing problems. It is often assumed that the size of an item may be very close to or even equal to . There are applications where this may happen, but in other applications, bin capacities are much larger than item sizes. The parametric case is defined by an upper bound on item sizes. Specifically, there is a parameter , where , such that items sizes are rational numbers in . For some versions of bin packing and some algorithms for it, the study of the parametric case is different from the general case, and it is of interest. There are models where the interesting cases are only those where is an integer, but there may be additional relevant values of . The resulting asymptotic approximation ratio may or may not be close to for small values of [27, 26, 1].

Bin packing with item types: Batched bin packing. An item type is an additional attribute of an item. This attribute corresponds to a fixed partition of the input into subsets called batches or clusters. The number of batches or clusters will be denoted by , where . Batched bin packing is a model that was initially defined as a semi-online input arrival scenario for bin packing problems. In this scenario, an algorithm receives all items of one type together. There is work on the version where the algorithm can pack items of different types into one bin (so the difficulty is the lack of knowledge on future batches) [25, 8, 14, 19], and here we consider the variant where items of different batches are to be packed into separate bins [14, 19]. Studies focus on the difference between solutions where items of different batches are packed separately (batched solutions), and globally optimal solutions that can pack items of different types into the same bin. We use the asymptotic approximation ratio to compare a batched optimal solution with a globally optimal solution. This is a comparison between optimal solutions, but sometimes it is easier to analyze greedy solutions instead. The problem was studied for several variants of bin packing [19, 21], and it turns out that for , the tight bound on the asymptotic approximation ratio is [19], and for larger values of the ratio increases and grows to approximately (see [31] for an early article where this value appeared in another context of bounded space online bin packing).

Bin packing with item types: The price of clustering. This problem is similar to batched bin packing, only here may be large while sets of items of one type may be small. A solution where different item types have separate bins is called a clustered solution, and it is compared to a globally optimal solution in this case as well. Thus, a clustered optimal solution is compared to a globally optimal solution using the approximation ratio once again, only here both the absolute approximation ratio and the asymptotic approximation ratio are studied. This approximation ratio is called The price of clustering (PoC) [2, 20]. Azar et al. [2] who introduced this problem, write that (in order for the measure to be meaningful) clusters may be small, but they cannot be arbitrarily small. The assumption that an optimal solution for every cluster has at least two bin leads to tight bounds of on the PoC [2]. This bound is tight even if items can be very small. For the cases where the optimal solution for every cluster requires at least bins with , the approximation ratio is strictly smaller than [2, 20] and decreases to approximately as grows [19, 2]. The PoC was also studied for other variants of bin packing [21]. Here, in the study of CCBP, we use the smallest lower bound on , i.e., we let . Our assumption for every cluster is that the optimal cost for it is at least . Due to the cardinality constraints, the total size of items can still be not larger than for some clusters, and for such a cluster it will hold that the number of items is at least .

Notation for bin packing problems with types. Given an input, recall that is the number of clusters or batches. We let be the number of bins in an optimal solution for the th cluster or batch, and we denote the input (the set of items of type ) by . We let be the set of all items, that is, , where . We use the notation above for optimal solutions, and let be a globally optimal solution for , as well as its cost. We let be the number of bins in the output of a fixed algorithm (which can any algorithm, an optimal algorithm or another algorithm) for cluster .

Greedy algorithms and related work. The study of greedy algorithms for bin packing started together with the first studies of classic bin packing and [27, 26]. Next Fit (NF) is an efficient algorithm that has (at most) one active bin where items are packed, and once an item cannot be added to the bin, it is closed and replaced with a new active bin. Any Fit (AF) algorithms pack an item into a non-empty bin when possible, and otherwise a new bin is used. A specific AF algorithm can be defined based on the choice of bin when there are several options. First Fit (FF) chooses the first (minimum index) bin, while Worst Fit (WF) chooses the least packed bin in terms of total size [26, 27]. It is known that the asymptotic and absolute approximation ratio of FF is [27, 16]. For WF (and AF in general) and NF, this ratio is equal to [26]. These algorithms (for classic bin packing) and online algorithms were sometimes analyzed for the parametric case as well [27, 26, 33, 10]. The asymptotic approximation ratio of FF with for an integer is [27], and the case where the parameter is not different from the case (also for ). For NF and WF, the asymptotic competitive ratio is for . while for , the ratio is exactly [26].

Greedy algorithms can be applied to CCBP. 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 bin has sufficient space for it and less than items. Similarly, we can adapt other greedy algorithms, where the concept of the possibility of packing an item into a bin is tested with respect to the total size (which cannot exceed together with the new item) and the number of items (which cannot exceed together with the new item, that is it has to be at most prior to the packing). CCBP was analyzed for greedy algorithms already in the article where the problem was introduced [30]. In that work, FF and its sorted version FFD were studied. For FF, the asymptotic approximation ratio tends to as grows. The exact asymptotic approximation ratio for every value of was found much later, and it consists of several cases according to the value of [15], where, in particular, for the ratio is . Note that greedy algorithms do not typically have the best possible asymptotic approximation ratios for online algorithms for bin packing problems [5, 3, 30, 27, 26].

Structure of the paper and results. In this work we study two kinds of problems. The first one is CCBP with types, where we study the price of clustering and batched bin packing. The second one is greedy algorithms. In most cases, the analysis includes the parametric case. Specifically, in Section 2 we find the exact price of clustering for any and (and ), we analyze batched bin packing with two and three batches, and we explain why large numbers of batches are uninteresting. In Section 3 we analyze NF and WF for the general case, and using sample cases for we exhibit the difficulty of analysis for the parametric case. We also provide a simple analysis of the parametric case for FF, for which the general case was studied in the past [30, 15].

2 The price of clustering and batched bin packing

We start with a complete study of the PoC. Recall that we assume that for every cluster the optimal solution has at least two bins. For the analysis of upper bounds, we consider the action of greedy algorithms on the clusters, since the output of such an algorithm for each cluster has a simpler structure compared to an optimal solution for it, and the number of bins obviously cannot be smaller. We will use weight functions in the analysis. Such a function can relate two solutions as follows. We let the weight of a bin be the sum of weights of its items. If in one solution the total weight of every bin is at most and in another solution the total weight for every bin is at least (where it is sufficient to prove this on average), then the ratio between the costs of the two solutions (for one input, for which the total weight is fixed) is at most . If there is an additive term, that is, the requirement holds possibly excluding a constant number of bins, this results in an upper bound on the asymptotic approximation ratio.

Recall that in the parametric case we assume that item sizes are in for some . We let , so all items have sizes of at most , but . We are interested in all integers . As discussed earlier, for classic bin packing, even if all items are very small, the PoC for the case where optimal solutions for clusters have at least two bins is unchanged. Now, we will see that for CCBP the bounds become slightly smaller as decreases. Specifically, we will find a function of both and such that the PoC is equal to this function. The bounds are between approximately and approximately , for large values of . As mentioned above, for certain bin packing problems and their analysis as a function of (or ), it is sometimes the case that the ratio depends not only on but it depends on the exact value of . [21], but here were prove that the dependence is just on , and the ratio is equal for all values with the same value of . In the next theorem we provide a complete analysis of the PoC for the general case and the parametric case.

Theorem 1

The PoC for CCBP is equal to . For the parametric case, the PoC is equal to if , and to if .

Proof. The the proof of the theorem consists of four lemmas. The first two lemma provide a proof for the general case, and the next two (whose proofs appear in the Appendix) extend the result for the parametric case. The first lemma is a proof of the upper bound for the general case.

Lemma 2

For any input for CCBP with the parameter , it holds that .

Proof. We use the following weight function , where

The motivation for it is that due to the cardinality constraint, the weight for a bin should be affected both by the total size and the number of items.

For a bin of the optimal solution, the total size is at most and the number of items is at most , so the total weight is at most .

Consider a cluster for , and an solution of FF for it, which contains bins. If all bins, possibly excluding the last bin, have items, the number of items for is at least , and total weight is at least . By we get , and the total weight for the cluster is at least .

Otherwise, let (where ) be the number of bins that are not the last bin, such that every such bin has less than items at termination. For these bins together with the last bin we have that every pair of bins have a total size above together. This holds because the first item of the bin with the larger index of the two was not packed into the bin with the smaller index, though that bin had less than items at termination and therefore also at the time of packing for this item. Thus, the total size of items in these bins is above . Every bin has at least one item, so these bins together have at least items, while the other bins have items each. The number of items is at least , and the total weight is at least

In both cases, the average weight for any bin of the clustered solution is at least , and the weight of any bin of a globally optimal solution is at most , which implies the claim.   

The second lemma is a proof of the lower bound for the general case.

Lemma 3

The PoC of CCBP with the parameter is at least .

Proof. Let be a large positive integer.

The input consists of small items whose sizes are equal to , and for all values of such that , there are two items of sizes and . An optimal solution for the entire input packs bins, where the th bin has the two items of sizes and , whose total size is , and items small items, whose total size is below .

The number of clusters will be . There are clusters, each with small items, clusters with a pair of items and for , and one cluster with four remaining items of sizes

For the clusters with small items, the number of items is larger than , and therefore the optimal cost for every cluster is . For the other clusters, the total size of items is at least , and therefore the optimal cost is also above . Thus, the total number of bins is at least . In fact, one can pack every cluster into two bins. The cost of an optimal solution for the entire input is , so the PoC is at least , which tends to as grows to infinity.   

For any such that , we already found a tight result of on the PoC. The upper bound of Lemma 2 obviously holds, and the lower bound construction of Lemma 3 holds since we can use , which means that items of sizes just above are chosen such that they are still smaller than . Thus, we consider the case in what follows, both for the upper bound and the lower bound.

Lemma 4

For any input for CCBP with the parameter , and any , it holds that for and if .

Proof. We will analyze clusters via FF once again, so we can use properties of FF in the analysis.

For , we use the weight function , where . In this case, for every cluster every bin except for possibly one bin will have at least items. In this case the total size of items for every bin may be arbitrarily small.

For , we use the weight function , where . In this case, once again the motivation is that the weight for a bin should be affected both by the total size and the number of items. However, in the parametric case, for every cluster, every bin except for possibly one bin will have at least items, since no item is larger than , and therefore FF will not use an empty bin while there is a bin with less than items.

For a bin of the optimal solution, in the first case there are at most items and the total weight is at most . In the second case, the total size is at most and the number of items is at most , so the total weight is at most .

Consider a cluster for , and an solution of FF for it, which contains bins. Every bin except for possibly the last one has items, by the definition of FF. If every bin excluding the last one has items, then the total weight is at least , by .

In the case , indeed every bin except for possibly the last one has items, so the total weight is at least . We consider the case , in which every bin except for possibly the last one has at least items. If all bins, possibly excluding the last bin, have items, the total weight is at least , and we focus on the case where this does not hold.

Let be the number of bins that are not the last bin, where less than items are packed. For these bins together with the last bin we have that every pair of bins have a total size above together. This holds because the first item of the bin with the larger index of the two was not packed into the bin with the smaller index, though that bin had less than items at the time of packing of this item. Moreover, since every item has size not exceeding , each one of the bins that are not the last bin has a total size of items above . Thus, bins have a total size above and the last bin together with another bin have a total size above , and the total size of items in these bins is above . All these bins excluding the last one have at least items each (for the last bin we can only conclude that it has at least one item), while the other bins have items each. The number of items is at least , and the total weight is at least

We will show that the weight is at least by showing that this expression minus is not negative, i.e.,

By , it is sufficient to show that

holds, which is equivalent to

and to

Since it is left to prove that . Since , we have

 

Lemma 5

The PoC of CCBP with the parameter and any is at least if , and at least if .

Proof. Let be a large positive integer. We also require that , so that all sizes will not exceed .

In the case , there are only items of sizes , where and . The number of such items is . An optimal solution for the entire input has bins with items packed into each bin. Every cluster will have items, and there are clusters. An optimal solution for every cluster has two bins. Thus, the PoC is at least , as required. Note that the construction gives a PoC of already for , but using large values of provides us with an asymptotic lower bound rather than an absolute one.

In the case , the input consists of small items whose sizes are equal to , items of size , and for all values of such that , there are two items of sizes and . An optimal solution for the entire input packs bins, where the th bin has the two items of sizes and , whose total size is , items of sizes , and items small items, whose total size is below .

The number of clusters will be . There are clusters, each with small items, clusters with items each, out of which have size , and there is also a pair of items and for , and one cluster with four remaining items of sizes , , , and , and the remaining items of size .

For the clusters with small items, the number of items is larger than , and therefore the optimal cost for every cluster is . For the other clusters, the total size of items is above , and therefore the optimal cost is also above . Thus, the total number of bins is at least since one can pack every cluster into two bins. The cost of an optimal solution for the entire input is , so the PoC is at least , which tends to as grows to infinity.   

Combining the last two lemma concludes the proof of the theorem.   

Next, we consider batched bin packing with a small number of batches. We will analyze the case with two and three batches, as a function of . For a large number of batches the problem becomes similar to batch bin packing for classic bin packing [14, 19], though the bound is larger by an additive . Specifically, it is known that for CCBP, for large values of , the ratios may grow by an additive factor of , since small items are sometimes treated almost independently [18]. For FF and other greedy algorithms, in the bad examples, these items can be presented first, and in the analysis, bins with items can be considered separately [30, 15]. This property of an additive in the ratio is not true for online algorithms in general [3, 11], where the tight asymptotic approximation ratio is , (so it is smaller than plus the best possible asymptotic approximation ratio [33, 10, 7]). The situation for batched bin packing is similar to the case with an additive . As in the price of clustering, a bad situation is where all very small items are separated from other parts of the input into a separate batch. This adds to the asymptotic approximation ratio for a large number of batches, which becomes approximately , since for classic bin packing this value is approximately [31, 19].

The proof of the next theorem appears in the Appendix.

Theorem 6

The asymptotic approximation ratio for batched bin packing and CCBP is for two batches and for three batches.

Proof. The lower bounds are simple. Let be a large integer that is divisible by . For two batches, consider a solution with bins, where every bin has one large item of size and small items of size zero. Splitting this input into two batches with identical items each, the cost of the batch of large items is , and the second batch has bins with small items, so its cost is . The ratio is . For the case of three batches, add medium items of size to the bins of the optimal solution, each replacing one small item. There is a third batch with medium items, and it contains bins. The ratio becomes .

For the upper bound, consider several special cases first. We show that for , the tight bound for any constant number of batches is . Consider the weight function for and for . In an optimal solution, every bin may have at most two items, one of which may be larger than , and therefore the total weight of the bin is at most . For every batch, consider a solution where items larger than are packed into separate bins and items of sizes at most

are packed in pairs (possibly excluding one bin if their number is odd). The total weight is at least the number of bins minus

. Note that the additive term has to be linear in . Consider an input with items of size . An optimal solution for the entire input has bins with two items of size each, and one bin with a single item if is odd. If every batch has one item, the number of bins for the batched solution is , and the additive term is at least .

The case of and two batches will be covered by the general proof for and , and we consider the case of three batches and , since for , the general case is for . In this case we can also prove the upper bound for batches. The function is defined as follows. Let for , for , and for . A bin of an optimal solution has weight of at most . By packing the three intervals of items separately for every batch, the total weight is at least the number of bins minus . The upper bound for other cases has some resemblance to that of [19], but the cardinality bounds are taken into account, so additional features are used.

Next, consider the case for two batches. An optimal solution for the entire input is considered, and it is modified into a solution were items of the two batches are packed into separate bins. Such a solution cannot be better than an optimal batched solution. In order to do this, we split bins of an optimal solution into types. A new packing that does not combine items of different batches into one bin is created. Every type is based on the total size and the number of items that belong to each batch, and we consider bins of one type together and modify the packing. For a bin of that has no items of some batch, there is no need to modify the packing, and it still requires a single bin. Letting be the number of such bins, the contributions to the cost of and to the modified packing are both . All other bins of have items of both batches and we split every such bin into two bins according to the batches. In several cases we apply repacking in order to reduce the number of bins.

Consider the bins of (not included in ) for which both the total size of items of the first batch is at most and the number of items is at most . Let be the number of such bins. For the items of the second batch of these bins, the bins for the second batch are unchanged. As for the first batch, pairs of bins are combined, which is always possible. The resulting number of bins is . Similarly, for bins of where the total sizes are numbers of the second batch are at most and at most , respectively, and were not included in (or ), we let their number be , and by repacking bins of the second batch there will be at most bins. Note that for every bin of , this bin is valid, so it is not possible that both for the items of the first batch and for those of the total size will be above . Similarly, it cannot be the case that for both the items of the first batch and the items of the second batch, there are more than items. We are left with just one case, where for one of the two batches the total size is above and the number of items is at most , and for the other batch the total size is at most and the number of items is above . We will denote the numbers of bins of these types by and . The repacking is similar (with the roles of batches reversed), and we consider the case where the bins for one batch are such that the total size of items is at most , but the number of items is above . Since every such bin has at least one item in the other batch, the number of items is at most . There is no repacking for the other batch. The repacking process for this batch is as follows. For bins, the bins are destroyed, and each item is added to a different bin of the batch. Every bin can receive one additional item, and since its previous total size is at most , and so was the total size for the original bin of the item, the packing is valid. The number of remaining bins is , which is at least and at most . The number of repacked items is at most , so all repacked items are indeed packed into a bin.

Thus, an optimal solution had bin, while the solution for the two batches has at most

bins. Since , the ratio between the two costs (neglecting the additive term of ) is at most .

For the case with three batches, we assume . We apply a similar procedure to the case of two batches. For bins of OPT where there does not exist an item of some batch, only two bins are created. For a bin where there are two batches with total size at most and a number of items at most , neglecting an additive constant, there are two bins for some batches that will combined with other bins of these batches, and on average there are two bins for the bin of OPT. We are left with the case that for one batch the total size is above and the number of items is at most , for one batch both are at most and , respectively, and there is one batch for which the total size is at most , but the number of items is above . Since there is at least one item for every batch, there are at most items for this batch. The reorganization for this batch is similar to the case of two batches, but the difference is that some bins will receive one item from one bin another item from another bin (most bins receive two items coming from one bin, but if is odd, is odd too, and a destroyed bin cannot be split into pairs of items only). For that, the single item will be the smallest in its previous bin, and its size will be at most , so adding two such items to a bin whose total size is at most results in a valid bin.   

This is the generalization of CCBP, since CCBP can be seen as vector packing in

dimensions, where the first component is the size and the other components are equal to . Thus, we already found a lower bound of on the PoC for . Here, if FF is applied, an item can be packed into a bin if the resulting set of items will have a sum not larger than in every component.

Lemma 7

For any input for VP with the parameter , it holds that .

Proof. Consider a bin of an optimal solution. The total size of all components of all items of any bin is not larger than , since the total size for every component is not larger than . Let the total size of all components of all items be . We have .

Consider a cluster for , and an solution of FF for it, which contains bins. Consider two arbitrary bins. The first item of the second bin of these bins could not be packed into the first one. Already at the time of arrival of this item, there exists a component for which the sum of the contents of the two bins is above . Thus, for every pair of bins, the total size of all components for the two bins together is above . Since there are pairs, and every bin participates in pairs, we get that the sum of all components of all items is at least .

We have .   

Lemma 8

The PoC of VP with the parameter is at least , even if all the components are not larger than a parameter .

Proof. Let be a large positive integer.

The input consists of items, partitioned into types. An item of type (for ) has one non-zero component, which is its th component, and its value is . An optimal solution for the entire input has bins in total, each with items of every type.

There are clusters, where every cluster has just one type of items, and there are clusters with items of type for every . Every cluster is packed into two bins by an optimal solution for it. Thus, the cost for the clusters is . The PoC is at least , which tends to as grows to infinity.   

A corollary of this result is that the PoC for the parametric case of one-dimensional classic bin packing remains for any parameter .

3 Greedy algorithms

We now analyze WF and NF. The interesting feature is that unlike standard bin packing, the performance of these two algorithms is different here.

Theorem 9

The asymptotic approximation ratio of WF for CCBP is , and for NF it is , for .

Proof. We start with the upper bounds. For NF, let . A bin of an optimal solution has at most item with total size at most , and the total weight is at most . For NF, let be the number of bins with items, and let be the number of bins whose number of items is at least and at most . The total number of bins is , and we show that the total weight is at least . For every bin with at most items that is not the last bin, the sum of its load and the load of the following bin is above . The sum of all these values (total loads of pairs of consecutive bins) is above for all such bins, but it is possible that some bins were considered both as a bin with at most items and as a bin following such a bin (if two consecutive bins have at most items, and the second one is not the last bin), and therefore, since the total size for every bin was considered at most twice, the total size of items is above . The number of items is at least , and thus the total weight is at least .

For WF, let if and otherwise . That is, an item of size above has an extra addition of to its weight. In this case the weight of at most items of total size at most does not exceed , since at most one item has size above . For NF, we use similar notation, and let , , and denote the numbers of bins with items, bins with at least two items and at most items, and bins with a single item, respectively. The number of items is at least . Due to the action of WF, the number of items of sizes above is at least , since no two items packed alone into bins by WF can be packed together, while every two items of sizes at most could have been packed together in terms of their sizes (without additional items). The argument regarding the total size is as before, and given the modified notation, the total size of items is above . Thus, the total weight is at least

For the lower bound of NF, let be a large integer, which is divisible by , and let be a small value such that . There are large items of sizes in (this interval is contained in ), medium items of sizes in (this interval is contained in ), and there are also small items, each of size . The large items have sizes of for . The medium items have sizes of for .

A possible solution has bins, where every bin has small items, and one or two other items, where the total size of other items is at most , which are defined below. Out of these bins, there are bins, where the th bin has one item of size and one item of size . The total size for these two items is , and this leaves five unpacked items that are large or medium, with sizes , , , , and . The first three items are packed into separate bins, and the two last items are packed together.

NF receives the items in the following order. First, all small items arrive, and they are packed into bins that receive items each and will not receive other items. Large and medium items arrive such that the input alternates between them, starting and ending this part of the input with large items. The large items are sorted by decreasing size and the medium items are sorted by increasing size. We get that for this part of the input (after the small items) for , items of indices and have sizes of and , respectively, and the item of index has size (which corresponds to the case , but there is no item of index ). The first item is packed into a new bin since the previous bin has items. We show that every pair of items have a total size above , and thus every medium or large item is packed into its own bin. If this holds, the number of bins is , which implies the lower bound by letting grow without bound. An item in an even index in the second part of the input has size , where the item before it has size and the item after it has size . The total sizes are and , respectively. Note that this construction is valid for , but in that case there are no small items.

The lower bound for and WF is proved separately. Assume that . For a lower bound of WF, let be a large integer, which is divisible by , let be a small value such that , and let . The input consists of huge items, each of size , small items of size , large items, where the th item (for ) has size , and medium items, where the th medium item has size . A possible solution has bins with at most three items that are not small packed into every bin, where their total size is at most , and the bin also has small items. For , there is a bin with one huge item, one large item of size and one medium item of size , where the total size of these three items is

since . The two remaining items that are not small have sizes of and , and they are packed together (with small items).

For WF, the small items are presented first, and they are packed into bins that cannot be reused. Then, pairs of a large item of size and one medium item of size , are presented for . The total size of such a pair of items is and one medium item of size is . The first pair is packed into a bin since all previous bins already have items each. Every time that an item of size is presented, it cannot be packed into previous bins, since the minimum load of bins with less than items is , and . When the medium item of size arrives, the last bin has load below while other bins that can receive it have loads above , and it is combined into the last bin, creating a load of . Finally, all huge items are presented, and each one is packed into a new bin because previous bins either have items or have loads above . Thus, WF has bins, and the lower bound on the approximation ratio is by letting grow without bound.

The lower bound for the case for WF follows from very simple inputs with items of size followed by items of size . WF creates pairs of items of size and the other items are packed into separate bins, while an optimal solution has bins with one item of each size.   

Next, we perform an analysis for several closely related special cases of , for NF and WF. The goal is to show the difficulty of solving the general case for different values of . We start with the case .

Theorem 10

The asymptotic approximation ratio for WF and NF for CCBP, , and is .

Proof. For the upper bound, we define the following weight function . For any bin of an optimal solution, since there are at most items whose total size is at most , we get a total weight of at most .

Consider the output of WF or NF. Since no item has size above , every bin that is not the last bin and has at most items has total size above . Since , every such bin has at least two items. The weight of every bin with items is at least . For other bins, the weight of every bin except for possibly the last one is at least .

To prove a lower bound, we define a set of bins which act as an offline solution, and additionally define an ordering of the items for NF and WF. Let be large positive integers, where is divisible by , and let be a small value such that . Every bin has or items of size zero, depending on the number of other items. The larger items defined next.

The offline packing is as follows. There are bins containing three items of size , whose total size is below . For , there are bins containing three items of size and one item of size , where the total size of these items is . Finally, there are bins with one item of size , one item of size , and one item of size , whose total size is below . The total number of bins in this solution is , using the sum of an infinite geometric series. The bins that have items of size zero are the first bins and the bins with two items of sizes close to , and all other bins have items of size zero. Thus, the number of items of size zero is .

We define the order in which NF and WF receive the items. First, all items of size zero arrive, every bin will have such items, and the number of such bins is , which is an integer since is divisible by and is divisible by . Every item of slightly smaller than is followed by an item of size slightly smaller than . Specifically, the items of sizes approximately are presented ordered by non-decreasing size, and every item of size (the number of such items is for and for ) is followed by an item of size , for (the number of such items is also for and for ). We claim that both algorithms pack one item of size approximately and one item of size approximately (two items that arrive consecutively) into every bin. The number of additional bins is therefore

The ratio between the number of bins for WF and NF and is