Online Bin Covering with Limited Migration
Sebastian Berndt, Leah Epstein, Klaus Jansen, Asaf Levin, Marten, Maack, Lars Rohwedder

TL;DR
This paper investigates the bin covering problem in semi-online models allowing limited decision revocations, developing algorithms with near-optimal migration and competitive ratios for static and dynamic scenarios.
Contribution
It introduces the first comprehensive study of bin covering with migration, providing algorithms and bounds for both static and dynamic cases, and resolving its competitiveness.
Findings
Algorithms with nearly optimal migration factors.
Lower bounds matching the algorithms' performance.
Resolution of the problem's competitiveness with migration.
Abstract
Semi-online models where decisions may be revoked in a limited way have been studied extensively in the last years. This is motivated by the fact that the pure online model is often too restrictive to model real-world applications, where some changes might be allowed. A well-studied measure of the amount of decisions that can be revoked is the migration factor : When an object of size arrives, the decisions for objects of total size at most may be revoked. Usually should be a constant. This means that a small object only leads to small changes. This measure has been successfully investigated for different, classic problems such as bin packing or makespan minimization. The dual of makespan minimization - the Santa Claus or machine covering problem - has also been studied, whereas the dual of bin packing - the bin covering problem - has not…
| Amortization | Departures | Lower Bound | Competitive Ratio | Migration |
|---|---|---|---|---|
| \faRemove | \faRemove | |||
| \faRemove | \faCheck | |||
| \faCheck | \faRemove | |||
| \faCheck | \faCheck |
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Online Bin Covering with Limited Migration111This work was partially supported
by DFG Project, ”Robuste Online-Algorithmen für Scheduling- und Packungsprobleme”, JA 612 /19-1, and by GIF-Project ”Polynomial Migration for Online Scheduling”.
Sebastian Berndt
Department of Computer Science, Kiel University, Kiel, Germany
Leah Epstein
Department of Mathematics, University of Haifa, Haifa, Israel
Klaus Jansen
Department of Computer Science, Kiel University, Kiel, Germany
Asaf Levin
Faculty of Industrial Engineering and Management, The Technion, Haifa, Israel
Marten Maack
Department of Computer Science, Kiel University, Kiel, Germany
Lars Rohwedder
Department of Computer Science, Kiel University, Kiel, Germany
Abstract
Semi-online models where decisions may be revoked in a limited way have been studied extensively in the last years.
This is motivated by the fact that the pure online model is often too restrictive to model real-world applications, where some changes might be allowed. A well-studied measure of the amount of decisions that can be revoked is the migration factor : When an object of size arrives, the decisions for objects of total size at most may be revoked. Usually should be a constant. This means that a small object only leads to small changes. This measure has been successfully investigated for different, classic problems such as bin packing or makespan minimization. The dual of makespan minimization – the Santa Claus or machine covering problem – has also been studied, whereas the dual of bin packing – the bin covering problem – has not been looked at from such a perspective.
In this work, we extensively study the bin covering problem with migration in different scenarios. We develop algorithms both for the static case – where only insertions are allowed – and for the dynamic case, where items may also depart. We also develop lower bounds for these scenarios both for amortized migration and for worst-case migration showing that our algorithms have nearly optimal migration factor and asymptotic competitive ratio (up to an arbitrary small ). We therefore resolve the competitiveness of the bin covering problem with migration.
1 Introduction
Online algorithms aim to maintain a competitive solution without knowing future parts of the input. The competitive ratio of such an algorithm (for a maximization problem) is thus defined as the worst-case ratio between the value of an optimal solution produced by an offline algorithm knowing the complete input and the value of the solution produced by the online algorithm. Furthermore, once a decision is made by these algorithms, this decision is fixed and irreversible. While a surprisingly large number of problems do have such algorithms, the complete irreversibility requirement is often too strict, leading to high competitive ratios. Furthermore, if the departure of objects from the instance is also allowed, irreversible online algorithms are rarely able to be competitive at all. From a practical point of view, this is quite alarming, as the departure of objects is part of many applications. We call such a problem dynamic and the version with only insertions static.
A number of different scenarios to loosen the strict requirement of irreversibility – called semi-online scenarios – have been developed over time in order to find algorithms that achieve good competitive ratios for some of the scenarios bounded reversibility. In the last few years, the concept of the migration factor has been studied intensively [4, 11, 12, 13, 14, 17, 20, 22, 23]. Roughly speaking, a migration factor of allows to reverse a total size of decisions, where denotes the size of the newly arrived object . For a packing problem, this means that the algorithm is allowed to repack objects with a total size of . This notion of reversibility is very natural, as it guarantees that a small object can only lead to small changes in the solution structure. Furthermore, algorithms with bounded migration factor often show a very clear-cut tradeoff between their migration and the competitive ratio: Many algorithms in this setting have a bounded migration factor which can be defined as a function (growing with ) and a small competitive ratio (growing with ), where the functions and can be defined for all [4, 11, 14, 17, 20, 22, 23]. Such algorithms are called robust, as the amount of reversibility allowed only depends on the solution guarantee that one wants to achieve. Such robust algorithms thus serve as evidence for the possibility for sensitivity analysis in approximated settings.
Many different problems have been studied in online and semi-online scenarios, but two problems that have been considered in nearly every scenario are classic scheduling problems: The bin packing problem and the makespan minimization problem. Both of these problems have been studied intensively in the migration model [4, 11, 13, 14, 20, 22, 23]. Both of these problems also have corresponding dual maximization variants. The dual version of the makespan minimization problem, often called the Santa Claus or machine covering problem, has also been studied with migration [17, 23]. In contrast, the dual version of bin packing, called bin covering has not yet been studied in this model. The aim of this paper is to remedy this situation by taking a look at this classic scheduling problem in the migration model.
Formal Problem Statement
In the bin covering problem, a set of items with sizes is used to cover as many unit sized bins as possible, that is, has to be partitioned maximizing the number of partitions with summed up item size of at least one. An instance of the problem will usually be denoted as and is given as a sequence of entries where is the identifier of the item and is the size of the item. A solution to such an instance with items is a partition and a set with is called a bin and we say that the items in are packed into the -th bin. For a subset , let . A bin is covered if , where is called the load of or its size, and the goal is to maximize the number of such covered bins. The optimal (maximum) number of covered bins of instance is denoted as .
We also use the following notations throughout our work: The smallest size of an item in bin is defined as and the largest size is defined as . If is a set of bins, we also define its total size , its minimal size , and its maximal size . Furthermore, we define and .
We consider variants of static and dynamic online bin covering in which algorithms are allowed to reassign a bounded amount of previously assigned items. In particular, an algorithm has a migration factor of , if the total size of items that it reassigns upon arrival or departure of an item of size is bounded by . Moreover, it has an amortized migration factor of , if at any time the total size of items that have been reassigned by the algorithm in total is bounded by , where is the total size of all items that arrived before. Intuitively, an item of size creates a migration potential of size upon arrival, and this potential may be used by an algorithm to reassign items right away (non-amortized) or anytime from then on (amortized). Note that if an algorithm has a non-amortized migration factor of , then it also has an amortized migration factor of at most . Thus, we study four variants in this work.
Offline bin covering is -hard and therefore there is little hope for a polynomial time algorithm solving the problem to optimality, and in the online setting there is no algorithm that can maintain an optimal solution regardless of its running time. We prove that this non-existence of algorithms that maintain an optimal solution holds also for (static or dynamic) algorithms with bounded amortized migration factor (and thus also for algorithms with bounded non-amortized migration factor).
Hence, algorithms satisfying some performance guarantee are studied. In particular an offline algorithm for a maximization problem has an asymptotic performance guarantee of , if , where and are the objective values of an optimal solution or the one produced by respectively for some instance , and is an input independent constant. If holds, is called absolute rather than asymptotic. An online algorithm has a (asymptotic or absolute) competitive ratio of , if after each arrival or departure an (asymptotic or absolute) performance guarantee of for the instance of the present items holds. Note that we use the convention of competitive ratios larger than for maximization problems. For minimization problems similar definitions are used but they use the required inequality . As we study asymptotic competitive ratios in this paper, we will sometimes omit the word asymptotic (and we always use the word absolute for absolute competitive ratios).
In what follows we assume , i. e., that there are no items of size . This is justified by the following. For any algorithm it is possible to add a rule that such an item will always be packed into its own bin, which will be covered. Without loss of generality, we can consider an optimal solution that applies this rule as well. This does not affect the (asymptotic or absolute) competitive ratio.
Known Results for Bin Covering
The offline bin covering problem was first studied by Assmann et al. [1]. It was shown that a simple greedy strategy achieves approximation ratio . For the online version of the bin covering problem, Csirik and Totik showed in [7] that this simple greedy algorithm also works in the online setting and that the competitive ratio of reached by this algorithm is the best possible. Csirik, Johnson, and Kenyon presented an asymptotic polynomial time approximation scheme (APTAS) with approximation ratio in [6]. This was improved to an asymptotic fully polynomial time approximation scheme (AFPTAS) by Jansen and Solis-Oba in [21]. Many different variants of this problem have also been investigated: If a certain number of classes needs to be part of each bin [10, 16]; if items are drawn probabilistically [15, 16]; if bins have different sizes [8, 24]; if the competitiveness is not measured with regard to an optimal offline algorithm [5, 9]. More variants are discussed for example in [18] and lower bounds for several variants are studied in [2]. The dynamic variant was not studied in the online scenario since there is no algorithm with a finite competitive ratio. Specifically, if all items are very small, it can happen that items depart in a way that no bin remains covered, while an optimal solution could pack items differently such that all items depart from a small number of bins, and in this way it will still cover many bins.
Our Results
We present competitive algorithms using both amortized migration and non-amortized migration and develop nearly matching lower bounds (up to an arbitrary small additive term of ). These bounds show the optimality of all of our algorithms for both the static and the dynamic version of the bin covering problem. The main technical contribution of our work is an algorithm with competitive ratio and non-amortized migration of for the dynamic bin covering problem where items arrive and depart. A major obstacle in the design of competitive algorithms for dynamic problems is the impossibility of moving large items on the arrival or departure of small items. We overcome this obstacle by developing a delicate technique to combine the packing of large and small items. The main results of this work are summarized in the following table. Note that the lower bound of in the third row indicates that there is no online algorithm that maintains an optimal solution with amortized migration factor . All of our algorithms run in polynomial time. Curiously, we achieve a polynomial migration factor, while most known migration factors are exponential (e.g., for the makespan minimization problem [22]) with the exception of bin packing [19].
Thus, we show how to overcome the shortcoming of online algorithms in the dynamic setting by using migration and get a constant competitive ratio in the most general setting. Surprisingly, the constant is even smaller than the best possible competitive ratio for pure online algorithms in the static case for which the competitive ratio is , while our bound is for any .
Related Results
Makespan Minimization and Santa Claus:
The migration factor model was introduced by Sanders, Sivadasan, and Skutella in [22]. The paper investigated several algorithms for the makespan minimization problem and also presents an approximation scheme with absolute competitive ratio and non-amortized migration factor . Skutella and Verschae [23] studied a dynamic setting with amortized migration, where jobs may also depart from the instance. They achieved the same absolute competitive ratio, but their algorithm needs an amortized migration of . Their algorithm also works for the Santa Claus (or machine covering) problem, for which they show that even in the static setting no algorithm has absolute competitive ratio and a bounded migration factor. If one aims for a polynomial migration factor for the Santa Claus problem, Gálvez, Soto, and Verschae presented an online variant of the LPT (least processing time) algorithm achieving an absolute competitive ratio of with non-amortized migration factor [17].
For the makespan minimization problem, if jobs can be preempted, Epstein and Levin showed in [13] that an optimal algorithm with a non-amortized migration factor of is achievable and the best possible.
Bin Packing:
Epstein and Levin presented an approximation scheme with the same ratio and the same non-amortized migration factor as in the makespan minimization for the bin packing problem in [11]. This result was improved by Jansen and Klein in [19], who drastically reduced the migration factor to . Berndt, Jansen, and Klein used a similar approach to also handle the dynamic bin packing problem, where items may also depart over time [4]. They also showed that a non-amortized migration factor of is needed for this. A generalized model, where an item has arbitrary movement costs – not necessarily linked to the size of an item – was studied by Feldkord et al. [14]. They showed that for and every , a competitive ratio of is achievable with migration , but no algorithm with migration and ratio exists. By strengthening the lower bound of [4], they also showed that an amortized migration factor of is needed for the standard migration model – where the movement costs are equal to the items sizes – if one wants to achieve a competitive ratio of . A generalization of bin packing, where -dimensional cubic items are packed into as few unit size cubes was studied by Epstein and Levin [12].
2 Non-amortized Migration in the Static Case
We begin our study by analyzing the static case with non-amortized migration. We will first present a lower bound showing that no algorithm with constant non-amortized migration factor can have a competitive ratio below . Then, we present an algorithm that achieves for all a competitive ratio of with non-amortized migration factor .
2.1 Lower Bound
We start with a simple lower bound on the asymptotic competitive ratio of all algorithms with constant non-amortized migration factor. This lower bound can also be proved for a different definition of the asymptotic competitive ratio , where we require .
Proposition 1**.**
There is no algorithm for static online bin covering with a constant non-amortized migration factor and an asymptotic competitive ratio smaller than .
Proof.
Let be an integer and an algorithm for online bin covering with a non-amortized migration factor of . Furthermore, let be the asymptotic competitive ratio of , i. e., we have for some constant value . We construct an instance that is divided into two phases, in each of which of equal size items arrive. The instance corresponding to the first phase is called and the one corresponding to both phases . The optimal (offline) objective value of and will be a multiple of and we will show that the ratio between this value and the objective value that is achieved by is at least either for or for .
In both phases items arrive, in the first they have size and in the second one size . We choose the parameter such that the items from the second phase do not fill a whole bin and such that they cannot be used to migrate items from the first, more precisely, let . Note that the optimal objective value for and is and respectively. See Fig. 1 for feasible packings with these objective values. The optimality follows as each covered bin must have at least two items since the sizes of the items are strictly smaller than . As each of the covered bins has to contain at least items from the first phase, there are at most bins each of which with exactly one item of the first phase. Furthermore, items from the first phase cannot be migrated during the second, as .
Hence, we have . We thus have . As the asymptotic competitive ratio of is , we can also conclude that and . Summing these two inequalities gives . As , we have and thus . Letting grow to infinity thus yields .
∎
2.2 Upper Bound
We will now give our algorithm for this scenario. In addition to the instance , a parameter is also given that regulates the asymptotic competitive ratio and the used migration. The assumption is justified as for , the result follows by the online algorithm with an asymptotic competitive ratio of presented in [7], or by using the algorithm below with .
Theorem 2**.**
For each , there is an algorithm for static online bin covering with polynomial running time, an asymptotic competitive ratio of with an additive constant of , and a non-amortized migration factor of .
The algorithm distinguishes between big, medium and small items. For each item, it calls a corresponding insertion procedure based on this classification into three classes. An item is called big if , medium if , and small otherwise. For a bin , let be the set of small items of . We define and accordingly and also extend these notions to sets of bins . Furthermore, we call a covered bin barely covered, if removing the biggest item of the smallest class of items, i. e., big, medium or small, contained in the bin, results in the bin not being covered anymore. For instance, consider a bin containing four items with sizes , , and , for . This bin contains items of all three classes if . In this case, the biggest item of the smallest class has size , and if , the bin is indeed barely covered. However, if , the bin is not barely covered. If , the bin only has items of two classes, and it is not barely covered, since removing one item of size results in a total size above . Note that showing that removing an arbitrary item of the smallest class of items for a given covered bin results in an uncovered bin is sufficient for showing that it is barely covered.
Let be a barely covered bin. If contains at most one big item, its load is bounded from above by , and if additionally contains no medium item the bound is reduced to . This holds due to the following. Since the big item has size below , the bin contains at least one medium or small item. If the bin has no small items, removing the largest medium item reduces the load to below , and together with the medium item the load is below . If it has a small item, a similar calculation shows that the load is below .
The last two types of bins are benign in the sense that they allow analysis using arguments that are based on sizes. This is not the case for bins containing two big items. Such bins could have a size arbitrarily close to (even if they have no other items). Bins of this type are needed for instances with many big items (for an example we refer to the construction of the lower bound in Proposition 1). However, they cause problems not only because they are wastefully packed, but also because they exclusively contain big items that should only be moved if suitably large items arrive in order to bound migration. The basic idea of the algorithm is to balance the number of bins containing two big items and the number of bins containing one big item and no medium items. The two numbers will be roughly the same, which is obtained using migration on arrivals of big and medium items. As described in the previous paragraph, the guarantees of these bins that are based on loads cancel each other out in the sense that an average load not exceeding can be achieved. In order to keep the number of bins with two big items in check, our algorithm will only produces very few bin types and we will maintain several invariants. This structured approach allows us also to bound the migration needed. We elaborate on the details of the algorithm.
Bin Types and Invariants.
We distinguish different types of bins packed by the algorithm. See Fig. 2 for an overview of covered bins (only).
The bins are partitioned into bins containing two big items (and no other items) ; barely covered bins containing one big item and some medium items ; barely covered bins containing one big item and some small items ; bins that are not covered (partially covered) and contain one big item and no medium items (but it could contain small items) ; and bins that are at most barely covered (they are barely-covered, or not covered) and exclusively contain small or medium items or respectively. Furthermore, let and be the corresponding subsets of barely covered bins (while and are sets of bins that are not covered). We denote the (disjoint) union of and as . The set of bins packed by the algorithm (covered or not covered) is denoted as . All bins covered by the algorithm are in fact barely covered, and no bin (covered or not) contains items of all three classes. Among bins that are not covered, there are no bins containing a big item and a non-empty set of medium items.
We will now introduce the invariants needed. We first give a formal definition and will sometimes follow this by a mnemonic in italics to help the reader in remembering the purpose of this invariant. The first invariant the algorithm ensures that this bin structure is maintained and the second invariant was already indicated above ( denotes the disjoint union of and ):
- I1
The solution has the proposed bin type structure, i. e.,
[TABLE]
and . 2. I2
The sets and are balanced in size, i. e., \big{|}|\mathtt{BB}|-|\mathtt{BS}|\big{|}\leq 1.
Recall that the average load of any bin of together with any bin of does not exceed , so by invariant I2 the average load of bins of possibly excluding one bin is not larger than .
Therefore we have . Furthermore, we have several invariants concerning the distribution of items to different bin types. The intuition behind these invariants is always the same: We have to ensure that no other algorithm is able to use the small and medium items to cover a much large number of bins.
The big items contained in are at least as big as the ones in which in turn are at least as big as the ones in , and the smallest big items are placed in , i. e., for each (i) and ; each (ii) and ; each (iii) and . The smallest biggest items are in and the largest in . Informally, . 2. 4.
The union of items in cannot be used to cover a bin together with a big item from or , i. e., . In the case , there are no restrictions on . We can not build another bin from and . 3. 5.
If a bin containing only small items exists, all bins in are covered, i. e., . We do not have unnecessary bins in the sense that if they exist, their items cannot be used elsewhere.
Lastly, there are some bin types with bins that are not covered, and we have to ensure that they are not wastefully packed:
If there are small items in , they are all included in the bin containing the biggest item in . The next bin of that is planned to be covered by adding small items to it is the most loaded one. 2. 7.
Each of and will contain at most one bin that is not covered, i. e., and . As long as medium and small items arrive and they are packed into and , bins of these sets are opened one by one.
This concludes the definition of all invariants. It is easy to see that the invariants all hold in the beginning when no item has arrived yet. Next, we describe the insertion procedures and argue that the invariants are maintained.
Examples.
In the following, we briefly discuss several examples to build intuition for the invariants. Figure 3 shows four exemplary packings. The first three are consistent with the invariants and the last one is not, and we first discuss the former three and then the latter.
As indicated in the captions, only the allowed bin types (invariant I1) are present in examples 1, 2, 3; and we have , and in examples 1, 2, and 3, respectively, yielding invariant I2 for the three first examples. Concerning the distribution of big items, that is, invariant 3, note that the big items get smaller when going from left to right in each of the examples which corresponds to the correct distribution. In the first two examples, there is exactly one bin in containing only one medium item, which already gives invariant 7 with respect to and it is easy to see that this invariant also holds for example 3. This item is relatively big in the second example, however each big item present in the solution is too small to be combined with the medium item to form a covered bin. In the first example, the big items are bigger, but the medium item is smaller, and the same holds. Hence, invariant 4 holds, and this is also the case for example 3, where each big item is contained in . Note that in the third example contains multiple bins, which may only happen if , due to invariant 4. In examples 2 and 3, we have and hence invariants 6 and 5 trivially hold. In example 1, on the other hand, there is exactly one bin in containing small items, and this bin also contains a big item of maximal size among the ones in , yielding 6 for this example, and we have , yielding 5. Lastly, in each of the three examples there is at most one bin in which is not covered, and hence invariant 7 also holds with respect to .
The last example, on the other hand, is carefully designed such that all invariants are infringed or meaningless: The two bins and contain both small and medium items; and bin is overpacked (covered but not barely covered). Therefore invariant I1 is infringed. Furthermore, there are three bins containing one big and no medium items, but only one bin with two big items. This is in conflict to invariant I2. The two biggest big items are combined in bin , violating invariant 3. Moreover, the bins and both are not covered, and exclusively contain medium items, which could be combined with several big items to form barely covered bins. Hence, both 7 and 4 are infringed. There are two bins in containing small items, infringing invariant 6; and additionally , violating invariant 5.
Insertion Procedures.
We start with the definition of two simple auxiliary procedures used in the following:
- •
is given an item and a set of bins . If all the bins contained in are covered, it creates a new bin containing item , and otherwise it inserts into the most loaded bin that is not covered.
- •
is given a bin and a set of bins . It successively removes a largest non-big item from a least loaded bin from and inserts it into . This is repeated until either is covered or does not contain non-big items.
Consider one application of such that already has a big item. The total size of moved items is smaller than .
Both procedures are used to insert and repack non-big items. Note that calling for a small item and bin set or , or a medium item and bin set , the last two invariants 6 and 7 are maintained. For , the most loaded bin always contains the largest big item, and if there is at least one small item, such a bin is unique. It could happen that as a result of inserting a small item into this bin of the bin is covered and moves to .
For each insertion procedure, we will argue that the invariants are maintained and focus on the critical ones, that is, in each context the invariants, that are not discussed explicitly, trivially hold. For example, we do not discuss I1 in the following, because it will always be easy to see that it is maintained.
Insertion of Small Items.
If the arriving item is small, we call , if , and otherwise. Insertion into a bin of (the most loaded one) may lead to a covered bin, in which case the bin becomes a bin of (but remains in . It is easy to verify, that all invariants, and 5, 6 and 7 in particular, are maintained by this. Furthermore, there is no migration in this case. The insertion of a medium or big item, however, is more complicated.
Insertion of Big Items.
In the case that a big item arrives, we have to be careful where we place it exactly, because, on the one hand, the distributions of big and medium items, that is, invariants 3 and 4, have to be maintained, and, on the other hand, we have to balance out and (I2). We consider placing the item in , or in this order, i. e., we first try to insert into , then into and finally into . Figure 4 illustrates this process.
- •
Insertion into .
We insert into , if either or . Note that the first condition implies , because of 4, and therefore the insertion of into maintains 3 in both situations. The second condition implies , because we set . In either of these cases, we create a new bin and call , thereby ensuring that 4 is maintained if the new bin is covered. If the first condition did hold, is covered afterwards and we do nothing else. Otherwise, there is a bin containing a big item with , and we have . We remove from , yielding , and call a second time. Afterwards, is covered, because . Furthermore, , because was barely covered before and the biggest medium item was removed from due to the second call of . The item is reinserted using a recursive call to the procedure of inserting a big item. However, item will not be considered for insertion into , because neither the first nor second condition holds for this item, and the other insertion options have no recursive calls for insertion into . It is easy to verify that the distribution of medium items in (7) is maintained.
- •
Insertion into .
This step is possible for item that satisfies and . Thus, will have the largest big items as required in Invariant 3 after the insertion is performed. In this case there is no recursive call for inserting a big item.
We insert into , if either or the following two conditions hold: and . Note that trivially holds, if . Inserting into under these conditions already ensures the correct distribution of big items (3) with respect to and , but we still have to be careful concerning the distribution within the two subsets of . The procedure is divided into three simple steps. As a first step, we create a new bin and call . No matter whether is now covered or not, Invariant 5 is satisfied as either is covered and therefore both before and after the call, or is not covered but now (it is possible that both will hold). Note that all properties of the invariants are satisfied, if is already covered. In particular, Invariant 3 holds within because . In the remainder of the second step of the insertion into algorithm we deal with the case that is not covered.
Let denote the set of bins that include small items as well as a big item with . Recall that any bin of has at least one small item, while at most one bin of has small items.
First, assume that but is not covered. There are two cases. In the first case, at least one item of was moved. In this case before we started dealing with , the set was empty, and now is the unique bin of , and its big item is not larger than those of (if the last set is not empty) so the invariants 3 and 6 are maintained. In the second case, was empty, and is now a bin of with only a big item. Since , adding to maintains the invariants 3 and 6. Thus, it is left to deal with the case . In the remainder of the second step of the insertion into algorithm we deal with the case that is not empty.
As is not yet covered, we now have , and this might have been the case before the call of , in particular if we had . Due to the existence of a big item that is smaller than in (such items exist in all bins of ), we have to be careful in order to maintain the correct distribution of big and small items inside of (3 and 6).
In the second step, we construct a set of bins from which small items are removed in order to cover . If , this set has exactly one bin (containing small items) by Invariant 6. If such a bin exists, we denote it by . If , the set includes a bin that contains a big item with and we denote one such bin (with a big item of minimum size in ) by . As , at least one of the bins or must exist, but it can also be the case that both exist. Let be the set of cardinality or , which contains these bins. The next operation of the second step is to call . It is easy to see that no matter whether is covered or not after this operation, the invariants 3 and 6 hold. Specifically, if does not exist, is not necessarily covered, but 3 and 6 hold as all big items of are not smaller than (as every such bin has at least one small item). If exists, then keeps receiving items coming first from and then possibly also from , until it is covered. As the total size of small items of is sufficient for covering since the big item of is smaller than , will be covered, so all big items of are not larger than .
Lastly, we describe the third step, which is performed for all cases above, after has been inserted. The insertion of might have violated I2, that is, we now have . In this case, we perform the last step, namely, we select two bins with minimal big items, merge the big items into a bin and remove and reinsert all small items from and , using insertion of small items. This yields, and I2 holds.
- •
Insertion into .
If was not inserted in any of the last steps, it is inserted into . In this case, we know from the conditions above that , and additionally that implies . We consider two cases.
If (and hence ), we select a bin with a big item of minimal size. We insert into to obtain a bin and remove and reinsert all small items from . This yields and I2 holds.
If , we have (and hence ). In this case, we select a bin with a big item of maximal size, insert into , and remove and reinsert . Because of its size and invariant 4, the item will be inserted into . Note that in both cases invariant 3 is maintained.
Lemma 3**.**
The overall size of items migrated due to the insertion of a big item is upper bounded by .
Proof.
First, note that an insertion into can not trigger the reinsertion of a big item. The insertion into can only trigger the reinsertion of a single big item into and the insertion into can only trigger the reinsertion into or . Hence, each insertion of a big item can trigger at most two other insertions of big items in total and thus only move a total size of this way.
Concerning the direct reassignments:
- •
If is inserted into , this may directly cause reassignments of items with size at most : there may be two calls of in each of which items with overall size at most may be moved and additionally a big item with size at most may be moved.
- •
If is inserted into , the corresponding bound is : there may be two calls of in both of which items with overall size at most may be moved and additionally a big item with size at most and small items with overall size at most may be moved.
- •
If is inserted into , the corresponding bound is : either small items with overall size at most or a big item are moved.
Hence, the total size of items migrated is at most .
∎
Insertion of Medium Items.
If a medium item arrives, is called. Afterwards, the invariant 4 may be infringed and if this happens, we have and , and we continue as follows. We will now describe how to pack a barely covered bin using the items from and a largest big item from to maintain 4 again.
If , I2 implies that contains a single bin including two items and with . We remove from , and call to create a bin. Afterwards, and are at most as big as they were before arrived as the first item we pulled from is at least as big as , and therefore 4 holds. Furthermore and I2 still holds. Lastly, we reinsert the big item .
If, on the other hand, , the corresponding big item with is contained in a bin , because of 3. In this case, we remove the small items from and call . Afterwards 4 holds, but I2 may be infringed due to the removal of a bin from , i. e., . In this case, we remove the two biggest items and from the bins and if merge the two bins. This yields and I2 holds. Afterwards, we reinsert the two items and , which both will be inserted in due to their sizes. No matter whether we had to rebalance and or not, we reinsert the removed small items from as a last step.
Figure 5 contains an illustration of this process.
Lemma 4**.**
The overall size of items migrated due to the insertion of a medium item is upper bounded by .
Proof.
In the first case, one big item is reinserted, resulting in the migration of items with size at most (see Lemma 3). Furthermore, there is one call of moving items with overall size at most . This yields a size of at most .
In the second case, medium items with size at most are moved using and small items with overall size at most are moved in the last step. Furthermore, three big items may be moved and two of them may be reinserted, causing total migration of size at most . Hence, the overall size of migrated items is upper bounded by . ∎
Analysis.
The migration bound stated in Theorem 2 or more precisely is already implied by Lemma 3 and Lemma 4, as a medium item has size above . Furthermore, it is easy to see that:
Remark 5**.**
The presented algorithm for static online bin covering has a polynomial running time.
Hence, the only thing left to show is the stated asymptotic competitive ratio:
Lemma 6**.**
The presented algorithm has an asymptotic competitive ratio of with an additive constant of .
Proof.
First, we consider the case (see Figure 3, second and third). In this case, the claim holds because the bins on average have not too much excess size. More precisely, we obviously have , and invariants I1 and 7 imply:
[TABLE]
Furthermore, we have , due to Invariant I2, and , as holds in the case we are currently considering. Hence:
[TABLE]
A similar argument holds, if but . In this case, we have , because of invariant I2 and thus ; and , because of Invariant 5. Hence:
[TABLE]
Next, we consider the case and (see Figure 3, first example). In this case, we have , because of Invariant 4, and , because of Invariant 5. Note that every bin of has at least one item that is not big, since big items have sizes below , and these bins are covered.
Let be the size of a big item from with maximal size. Then all items in are upper bounded in size by (3) and . We construct a modified instance as follows:
The size of each big item with size below is increased to . 2. 2.
Every big item of size larger than is split into a big item of size and a medium or small item, such that the total size of these two items is equal to the size of the original item. Let be the set of items with sizes of , which we will call -items in the instance after these transformations ( includes also items whose sizes were in ). 3. 3.
For each bin from , select the largest item of that is not big and call it special. By increasing item sizes if necessary, change the sizes of all special items to . Let be the set of special items (whose sizes are now all equal to ). Let be the set of the remaining items not belonging to or (in the instance after the transformations, so there maybe be items that did not exist in resulting from splitting a big item).
The set of items in is just . For the instance , any bin of contains two items of (and no other items). Any bin of has an item of , and one of these bins may also have small items of , but it is not covered. Any bin of has one item of , one item of , and possibly items of . There may be one uncovered bin of , containing items of .
Note that , since any packing for can be used as a packing for with at least the same number of covered bins. Next, we investigate the relationship between and the packing of the algorithm for the original instance . For some optimal solution for without overpacked bins (more than barely covered), let , and be the sets of covered bins with , and [math] items from , respectively. Then we have and due to counting:
[TABLE]
Since each item in is upper bounded by , we have:
[TABLE]
The total size of items (of only) packed into the bin of is below since has a big item of size in , by Invariant 4, since every item of is smaller than . For only one bin may contain items of by Invariant 6, and this bin has an item of size in (and it is not covered), so it also has items of of total size below . Consider a bin of . The total size of items excluding the special item is the same for and . Since such a bin is barely covered and for it has items of one class except for the big item (small or medium), removing the special item results in a load below . The total size of items of in such a bin excluding the -item and the special item is below .
Therefore, we find that
[TABLE]
Hence:
[TABLE]
In the second to last step, we again used invariant I2. ∎
3 Non-amortized Migration in the Dynamic Case
In this section we extend the result of the static case and show:
Theorem 7**.**
For each with , there is an algorithm for dynamic online bin covering with polynomial running time, an asymptotic competitive ratio of with additive constant , and a non-amortized migration factor of .
Motivation and Discussion.
It is not too hard to see that the insertion procedures for big and medium items designed for the static case can be reversed in order to deal with departures of such items. However, small items never cause migration in the static case algorithm and borrowing this approach in the dynamic case causes immediate problems: Let be some positive integer. Consider the case that items of size arrived and were placed into bins, covering each of them perfectly. Next, one item from each bin leaves yielding a solution without any covered bin while the optimum number of covered bins is . Hence, a migration strategy for arbitrarily small items is needed in order to design a competitive algorithm. Now, coming up with a migration strategy to deal with the present example is rather simple, since all the items are of the same size, but in principle small items may differ in size by arbitrary multiplicative factors. That is, it is possible that when a new small item which is relatively small arrives, some of the existing small items cannot be migrated at all. Still, the case with only small items can be dealt with comparatively easily by adapting a technique that was developed for dynamic online bin packing with migration [3]. The basic idea is to sort the items non-increasingly and maintain a packing that corresponds to a partition of this sequence into barely covered bins. If an item arrives, it is inserted into the correct bin and excess items are pushed to the right, that is, to the neighboring bin containing the next items in the ordering, and this process is repeated until the packing is restored. Correspondingly, if an item departs, items are pulled in from the next bin to the right. In this process the arrival or departure of a small item can only cause movements of items that are at most as big as the original one. While this is a useful property, it obviously does not suffice to bound migration: Too many bins have to be repacked. In order to deal with this, the bins are partitioned into chains of appropriate constant length with a buffer bin at the end, which is used to interrupt the migration process. This technique is sufficient for the set of bins containing only small items.
The small items are also placed together with big items in the bins of and in principle the same problem can occur here: Few items with very small overall size can leave many bins uncovered when leaving and hence we need a migration strategy and additional structure for these bins as well. Unfortunately, a straight-forward combination of the chain approach with bins containing big items fails. The main reason for this is that in order to adapt our analysis, we need to cover the bins in containing larger big items with higher priority and furthermore guarantee that there are no (or only few) bins contained in if there are bins containing big items that are not covered, i. e., . It is not hard to see that spreading one sequence of chains out over the bins of and will not suffice.
To overcome these problems, we developed a new technique: We partition the bins of into few, that is, many, groups. Each of the groups is in turn partitioned into parallel chains of length . The groups are defined such that they comply with a non-increasing ordering of both the big and the small items: the first group contains the largest big and small items, the next group the remaining largest, and so on. Similarly, the big or small items contained in a bin of a single parallel chain are at most as big as the ones in the predecessor bin of that chain. However, no such structure is maintained in between the parallel chains of the same group. Now, whenever a buffer bin of a parallel chain becomes empty or overfilled, items are pushed or pulled directly into or out of the next group. This may spark a recursive reaction, but since there are only few groups overall the total migration can be bounded. Furthermore, we are able to guarantee (i) that there is at most one group containing uncovered bins, and that all groups before are covered. Finally, if , we can guarantee (ii) that all bins of are barely covered. Properties (i) and (ii) are the essential properties we need in order to adapt our approach to the dynamic case.
The buffer bins of the parallel chains act as the interface between one group and another, and therefore have a special role in this construction. We require that the buffer bins of the same group have some special properties, e. g., that they can exchange items among each other without migration cost. To guarantee these properties, we simulate the buffer bins of chains belonging to a fixed group using one group buffer bin. Hence, all chains within the same group share the same buffer bin. Because of their special role in the procedure, these group buffer bins are considered as a separate class, denoted by . These bins exclusively contain small items but may be overpacked, that is, unlike any other bin in the construction they may be covered but not barely covered. To avoid confusion, we slightly alter the definition of , excluding the group buffer bins regardless of whether they are at most barely covered or not. Furthermore, we require the bins of to comply with a more restricted notion of being barely covered: bins of this type need to be well-covered. A bin is called well-covered, if it is barely covered and additionally has the following property: If , then . In particular, consider the situation that contains one big item and more than one small item. As is barely covered, removing the largest small item from makes it not covered. But is also well-covered, hence removing all of the small items but the largest one will also leave not covered. We call a bin more than well-covered, if one can remove a subset of items in to make well-covered and at most well-covered, if one can add a (possibly empty) set of items to to make it well-covered.
The Algorithm.
In the following, we will describe in detail the additional structure needed to deal with the small items along with the insertion procedures for small items. We first describe the chain structure used for and then the group structure used for . Next, we discuss the insertion and deletion procedures of medium and big items. The main challenge here is to properly deal with the insertion and deletion of big items in , because these can interfere with the group structure. Lastly, we will argue that the migration, competitive ratio and running time of the overall algorithm is properly bounded. In order to do so we will, in the course of this section, again introduce invariants and argue that they are maintained by the algorithm. Indeed, some of the invariants can be transferred directly or with only small changes from the static case:
- I1
The solution has the proposed bin type structure, i. e., and . 2. I2
The sets and are balanced in size, i. e., \big{|}|\mathtt{BB}|-|\mathtt{BS}|\big{|}\leq 1. 3. I3
The big items contained in are at least as big as the ones in which in turn are at least as big as the ones in , i. e., for each and ; or and . 4. I4
The items in cannot be used to cover a bin together with a big item from or , i. e., . 5. I5
If there is a bin which only contains small items and is not a group buffer bin, then all bins in are covered, i. e., . 6. I6
The set contains at most one bin that is not covered.
In the following, we slightly change our notions of bins, that is, we allow empty bins. Until now, we assumed that a bin ceases to exist as soon as it becomes empty. In the following, however, there are some situations in which empty bins are maintained by the algorithm. This will be made clear in each case. Furthermore, without loss of generality we assume that is an integer.
3.1 Chains
Preliminaries.
We formally define a chain as a totally ordered finite set of bins, where each bin contains at most one big item and no medium items, such that the following conditions are fulfilled. The ordering of the chain is consistent with a non-increasing ordering of the small items contained in , that is, for bins and small items and , we have , if precedes in . Furthermore, the corresponding condition for big items holds as well, and if there is a bin in containing no big item, then the successors of contain no big items as well.
Let be a chain, , and a set of small items. We say that is eligible for and , if remains a chain after is inserted into . Furthermore, we denote the -th bin in the ordering of as . We define two basic operations on chains, which are recursive procedures. Intuitively, puts a set of small items into bin and pushes the now superfluous small items to the next bin. In contrast, pulls small items from these next bins to cover . More formally, these operations behave as follows:
- •
is given a chain , a bin , and a set of small items eligible for and . The set of items is inserted into . If is now overpacked, that is, more than well-covered, we repeatedly remove a smallest small item from until is well-covered and call the set of removed items . If is the last bin in the chain, the set is returned. Otherwise there is a successor of and is called.
- •
is given a chain and a bin . If is not covered and not the last bin in the chain, we repeatedly move the biggest small item from to , where is the successor of in , until either becomes well-covered or does not contain small items anymore. Afterwards is called.
Remember that a bin is called well-covered, if it is barely covered and additionally we have that implies . Note that in both procedures the inputs of the recursive calls are legal, e.g., when or are called, is still a chain, , and is eligible for and . This immediately yields:
Remark 8**.**
After a call of or , the set remains a chain.
If is the set of items moved away from a bin due to a call of , we say that was pushed out of and moreover, if is pushed out of the last bin of the chain, we say that it was pushed out of the chain. Correspondingly, if was moved away from a bin due to a call of , we say that was pulled out of . Our next goal is to formulate and prove some easy technical results concerning these operations. These results will be among the main tools for bounding the migration due to the small items. We consider first and second.
Lemma 9**.**
Let be a chain, be at most well-covered, and be a set of small items eligible for and such that forms a bin that is at most well-covered. Furthermore, assume that or . Finally, let be the set of items that are pushed out of , due to a call of . Then is well-covered after the call and we have:
* forms a bin that is at most well-covered.* 2. 2.
. 3. 3.
. 4. 4.
If has a direct successor in , then is eligible for and and (before the recursive call of ).
Proof.
Note that is well-covered, as . We now distinguish two cases, namely and . In the first case, note that no item belonging to will be pushed out of , or, more precisely: if is the subset of that is pushed out, there is a set of items remaining in that does not belong to and that is equivalent to in the sense that there exists a bijection between the two, mapping items of equal size onto each other. Therefore, is at most well-covered, because was at most well-covered. In the second case, we have and hence by assumption. Let . Note that the items that are pushed out of each have size at most , and there can be at most one item with size in because was at most well-covered before was inserted. Hence is at most well-covered, because replacing the item with size from — if it exists — with the biggest item from , yields a set of items completely contained in before the call to . The above considerations also show .
Since was at most well-covered, removing the smallest items from with overall size after was inserted will suffice to make it at most well-covered again. The exact value may not be met and therefore one extra item may be needed whose size is bounded by , due to the already established property that . Note that these considerations also hold, if was well-covered with only one small item, or and is well-covered. This implies the third point and the fourth holds, because the smallest items are pushed out of and is a chain. ∎
Lemma 10**.**
Let be a chain, a bin that is not covered and not the last bin in , and its successor. Furthermore, let be the set of items that are pulled out of due to a call of . We have:
. 2. 2.
* is well-covered after the call, if was well-covered.* 3. 3.
.
Proof.
The first assertion follows directly from the definition of . Note that forms a covered bin due to the definition of chains, if was well-covered. This together with the definition of implies the second assertion and this also holds if . Furthermore, it suffices to pull items with size out of in order to cover . However, the exact value may not be met and therefore one extra item may be needed whose size is bounded by and this proves the last claim. ∎
Sequential Chains.
We maintain a partition of into sequential chains , …, with for and . Herein, the exact value of depends on the instance. The last bin of each chain is its buffer bin. See Figure 6 for an illustration.
We require that all bins that are not buffer bins are well-covered. Buffer bins, on the other hand, are non-empty and at most well-covered. The set of buffer bins is denoted by . These properties are summarized in the following invariant:
has the described chain structure, in particular, and .
The distribution of small items in is already limited by our definition of chains. However, we will require an even stronger property such that all of the orderings of the small items are consistent with each other:
The non-increasing ordering of the small items in by size is consistent with both the ordering of the chains and their internal ordering.
More precisely, due to this invariant for each item and , we have , if is lexicographically smaller than . We next describe the insertion and deletion of a small item into maintaining these invariants.
Insertion.
We describe the insertion of a set of small items into in two insertion scenarios: In scenario 1, a new item was inserted into the instance, that is, , and in scenario 2, a set of items with and was moved from to . In both scenarios, we treat the case as if there was exactly one chain with one bin, which is empty. In scenario 1, we select the first bin (with respect to the ordering of the chains and their internal ordering) containing items that are smaller than , or the last bin if no such bin exists. Let be the chain is contained in. In scenario 2, is the first chain and its first bin. In both cases, we call . Due to the choice of , Remark 8 and a simple inductive application of Lemma 9, we can conclude that the ordering of the small items is maintained (invariant 8) and each non-buffer bin in remains well-covered (7). Let be the set of items that are pushed out of . If , we know that the buffer bin of is now well-covered, due to Lemma 9, and furthermore forms a bin that is at most well-covered, again due to Lemma 9. Hence, we turn the buffer bin into a regular bin and declare the new buffer bin of . If now has length , we split it evenly into two chains each of which contains bins and declare the last bin of the first chain its buffer bin. This yields two chains with length , thereby maintaining invariant 7. An example of this insertion is illustrated in Figure 7.
Remark 11**.**
The overall size of migrated items due to the insertion of into is at most , and therefore in scenario 1.
Proof.
Let be the -th set pushed out of a bin due to the call of . A simple inductive application of assertions (2) and (3) of Lemma 9 yields that . There are at most bins in the chain, and hence the overall size of migrated items is at most . ∎
Deletion.
Next, we consider the case that is deleted from a bin belonging to chain (that is a part of ). If is still well-covered or a buffer bin, we do nothing. Hence, we design a procedure to deal with the case that a non-buffer bin has become not covered. Similar to the insertion case, this procedure will work regardless of whether is not covered because was deleted, or because some set of small items has been removed from to be placed in another group of bins. We call . Since the invariants 7 and 8 did hold before and due to Remark 8 and a simple inductive application of Lemma 10, we know that the ordering of the small items is maintained (invariant 8) and each non-buffer bin in except for the bin directly preceding the buffer remains well-covered. If is well-covered as well, the chain structure (invariant 7) is maintained, and we do nothing else. Otherwise, the old buffer bin of is deleted and becomes the new buffer bin, which is not a problem, if or is the last chain. Hence, we consider the case that and there is a direct successor chain of . If the first bin of is removed from this chain and declared the new buffer bin of , and otherwise and are concatenated and we call the resulting chain again . In both cases, we call , and the invariants 8 and 7 hold afterwards (and this call to will not result in the need to concatenate two chains).
Remark 12**.**
The overall size of migrated items is at most , where is the maximum size of a small item in any bin succeeding . In particular, if was deleted from this amounts to .
Proof.
Let be the -th set pulled out of a bin due to one of the at most two calls of . Note that there can be at most such bins. A simple inductive application of assertion (3) of Lemma 10 yields that . In the case that an item was deleted from , we additionally have and . ∎
3.2 Groups
We maintain a partition of into groups , …, with for and . Note that for each and . These properties are summarized in the following invariant:
has the described group structure.
Furthermore, it will be useful in the following to consider the bins containing exclusively small items as the last group, that is, . Each group , for , is in turn partitioned into sets such that each of these sets has cardinality except for the last which may be smaller. For each of these sets there is a buffer bin and the set of these buffer bins is called . As mentioned above, these buffer bins have a special role that will be described in more detail below. The sets together with their buffer bins form parallel chains, and since all the bins of such a chain are contained in the corresponding group, we sometimes say that the parallel chains are contained in or part of their respective group. See Figure 8 for an illustration.
Each bin in a parallel chain is at most well-covered. The well-covered bins are all placed in a sequence at the start of the chain, and there can be at most one bin of the chain containing small items that is not covered, and this bin is positioned directly following the last well-covered bin of the chain. Note that this implies . Again, we summarize:
Each group has the described internal parallel chain structure.
Note that due to the definition of chains, the above invariant also restricts the internal distribution of big and small items in each group. With the next two invariants, we control the distribution of big and small items between the different groups.
The ordering of the groups (including ) is consistent with a non-increasing ordering of both the big and the small items. 2. 12.
There is a group-index such that each bin in each group preceding is well-covered and each succeeding group does not contain small items. *Small items will always be used to create well-covered bins. *
More precisely, the former invariant together with 10 yields the following. Let and , where and are (parallel or sequential) chains belonging to group and respectively and belong to a common class (either both are big or both are small). Then , implies and the same holds, if and . Furthermore, due to the latter invariant, in some sense, there is always exactly one group being filled with or emptied of small items (i. e., the group of index of invariant 12). Next, we discuss the buffer bins of parallel chains in more detail.
Group Buffer Bins.
If we can always maintain the group structure and the chain structures described above, we are able to guarantee an asymptotic competitive ratio of . Unfortunately, maintaining this structure will be rather complicated. Firstly, the buffer bins of parallel chains behave very different from other bins. In order to have a notion of well-covered buffer bins, we assume that the buffer bin of each parallel chain contains a virtual big item that is of the same size as the big item in the second to last bin of the chain. This virtual big item will only be used in the theoretical analysis.
Furthermore, in a parallel chain setting, each chain by itself is ordered with regards to the small and big items. But the distribution of item sizes of chains within the same group might be very complicated. For example, we might want to add a small item into a chain in group . This will trigger a push of small items along this chain and might remove some small items from the buffer bin of . The natural approach would be to try to insert these items into the subsequent group , but there might be another chain in group that contains items smaller than those in . Hence, we first would need to insert the items of into , triggering even more repacking. To prevent this cascade of repacking, we observe that the smallest small items in must be contained in the buffer bins. Now, if we push small items along , we will first rearrange the small items in the buffer bins such that the buffer bin of contains only the smallest items. In this way, we can indeed push the removed items to . To simplify this rearrangement of small items in buffer bins, we will make the following two assumptions that may seem counter-intuitive at first glance: Firstly, the buffer bins of the same group are allowed to exchange items without migration costs; and secondly, items may be split between buffer bins of the same group, with part of an item placed in one buffer bin and the other part in another.
We justify these assumptions as well as the virtual big items, by simulating these bins using one group buffer bin for each group (as indicated in Figure 8). All the small items from the buffer bins of are in fact placed in the group buffer bin of and the buffer bins of the chains are only virtually maintained by the algorithm. Clearly, splitting items and moving them without cost does not pose a problem anymore, as all of these items are placed on the same bin and do not leave it. The set of group buffer bins is denoted by . Note that we do neither consider the (virtual) buffer bins of the parallel chains to be a part of , nor the actual group buffer bins to be a part of .
Let be the buffer bin of a parallel chain . If an item is placed fractionally in this item is at most as big as any other item placed in a preceding bin of the chain. Furthermore, if contains small item pieces, we guarantee that there is a small item fully contained in with the property that is at least as big as any other small item for which item pieces are placed in . Due to this property, the definition of well-covered can be extended to the buffer bins quite naturally: the bin is called well-covered, if (i) it is covered, if (ii) the small item pieces together with the virtual big item but excluding , cannot cover a bin where is a largest small item fully contained in , and if (iii) the virtual big item and together can cover a bin, then there is no other small item piece placed in .
The buffer bins of each group and the corresponding group buffer bin have the described structure.
If is called on the parallel chain , fractional item pieces may be pushed out of . When this case occurs, we will carefully redistribute the item pieces in the buffer bins of the group, or remove the full item from the group. The operation , on the other hand, could pull fractional items further into the chain and we would like to avoid that also. However, as described above, we guarantee that the biggest small item in the buffer bin is fully placed in it. Hence, it should be pulled first. Afterwards, if still contains small item pieces, we simply choose a small item with maximal size that is at least fractionally placed on , and pull all pieces of onto . Since we only move item pieces from other buffer bins of the group, no additional migration costs occur.
Insertion.
When a small item arrives, we have to be careful to maintain the described structure when inserting it. In particular, we have to maintain the parallel chain structure in each group (invariant 10) and the correct distribution of small items (11 and 12). For the group structure (9) and the other invariants, it will be easy to see that they are maintained.
The first step is to choose the appropriate group depending on the size of and with respect to the correct distribution of the small items (11 and 12). More precisely, is either (i) the first group containing an item that is smaller than if such a group exists; or (ii) the last group containing small items, if that group is the last group or contains a bin that is not covered; or (iii) the group directly after the last group containing small items, otherwise.
Instead of describing the insertion of into , we take a slightly more general approach and consider two scenarios, where a set of small items has to be inserted into , similar to the insertion into . We do so, because the insertion procedure works recursively. In scenario 1 we have , and in scenario 2 all items in are at least as big as any small item in , and adding a big item from to forms a bin that is at most well covered. For the case we already discussed the same scenarios and refer to the section on sequential chains. Hence we assume .
We distinguish two cases in the following depending on the existence of bins without any small items. If contains a chain that includes a bin without any small item, the procedure is rather easy: we choose an appropriate bin with respect to the parallel chain structure (10 and 12). More precisely, in scenario 1, we choose the first bin containing an item that is smaller than if such a bin exists; and otherwise the first bin that is not covered and is either the first bin of the chain or has a well-covered predecessor. In scenario 2, we simply pick the first bin of the chain. We perform . Remark 8 and an easy inductive application of Lemma 9 yield that no items are pushed out of and all invariants are maintained.
On the other hand, if each bin in contains small items, only the buffer bins may not be covered. This complicates the maintenance of our invariants.
We pick a chain with the property that the size of a largest small item contained in its buffer bin is minimal. This chain has the property that each small item placed in its buffer bin could also be placed in any other buffer bin of the group without violation of the ordering of small items in the chain (10). Again, we choose an appropriate bin with respect to the parallel chain structure, that is, the first bin in scenario 2, or in scenario 1 the first bin containing an item that is smaller than if such a bin exists, or the last bin of the chain. We call and denote the set of items pushed out of as .
If , the insertion procedure is now complete and all invariants hold (see above). Hence, we consider the case . Note that may contain the biggest small item previously placed in the buffer bin of . However, in this case all items now contained in the buffer bin are not fractional and hence, the new biggest item is neither. In any case, invariant 13 is maintained. Ideally, we would like to simply insert into the next group , but the structure of might be unsuited to do so without violating our invariants. We will thus construct a more suitable set from and and insert this set into . The remaining items will be placed on the buffer bins of .
More formally, let be a set of small items constructed greedily by choosing the smallest available item and putting it into until . Ties are broken in favor of items (fractionally) contained in . Clearly, we have and . We remove all items or item pieces belonging to from and and define . Note, that in this process of creating , no buffer bin can become empty, because no item that is the biggest small item of a buffer bin can be included in due to the choice of chain . Hence, invariant 13 is maintained. Next, we place the items and item pieces from onto buffer bins of : If a piece of an item was previously placed on a buffer bin , we can imagine that removing it left a gap. As , the space freed up by constructing is at least . Hence, we can place the items from fractionally into these gaps. Note that at this point all invariants hold and contains items that are appropriate for the insertion in with respect to the distribution of small items in the groups (invariant 11). As a last step, we split into two sets and such that their insertion into is consistent with scenario 2. The sets are defined as follows. Let be the size of the biggest item piece contained in . The first set is chosen such that , , and (with ). We set and first insert and then .
Lemma 13**.**
Inserting and into is consistent with scenario 2, and this includes the case .
Proof.
For the case note that and which is sufficient for scenario 2 in this case. We assume in the following and consider two cases. Let be the biggest item (fractionally) contained in .
In the first case, we assume that is big enough to cover a bin together with the biggest (big) item contained in . Note that due to invariant 11 the big items contained in are at least as big as . Since the buffer bin of chain was at most well-covered, this implies that . Remember that we choose the chain in a way such that the size of the largest small item, call it , in its buffer bin is minimal. As , either is this largest small item placed on before the push, or scenario 1 applies and was just inserted into the instance. In both cases we have . Due to our choice of , any largest small item contained in a buffer bin of is large enough to cover a bin together with any big item contained in . Therefore, each buffer bin contains exactly one small item and that item is at least as big as . This in turn implies that , and , yielding the assertion in this case.
In the second case, is not big enough to cover a bin together with . Hence, fits the requirements. Furthermore, note that is at most as big as minus the biggest item piece contained in that set. This implies that is suitably small as well: either was fully contained in the buffer bin before (yielding the assertion), or scenario 1 applies and . In the latter case, has to be the biggest item (and item piece) contained in and an item that is bigger than remains in the buffer bin of . Hence, is also suitably small. ∎
Lemma 14**.**
The overall size of items that are migrated due to the insertion of a small item is .
Proof.
Let and be the index of the group is inserted to. For the case , we refer to Remark 11 that already guarantees the claimed bound. Hence, we assume . Furthermore, let for and be a set of items that is (recursively) inserted into . Note that at most sets are inserted into for each (due to the insertion of both parts of ) and (invariant 9).
We first consider . When is inserted into this group, is called exactly once (not counting recursive calls). Let be the -th set pushed out of a bin due to this call. A simple inductive application of Lemma 9 yields that . The corresponding chain has length at most . Hence, the overall size of items moved in this group due to the insertion of is at most . Let and be the sets that are inserted into the next group. Considering the choice of these sets and the lengths of the parallel chains, we have , and therefore this upper bound holds for both sets independently. This proves the base case of the inductive claim that . The claim for holds by noting that (using 11), and that the chain to which is inserted has at most bins (including the buffer bin).
Furthermore, the overall size of migrated items in group due to the insertion of is at most and this bound also holds for (see Remark 11). Hence, the overall size of migrated items is bounded by . ∎
Deletion.
We now consider the case that a small item is deleted. Like in the case of insertion, we have to be careful to maintain the parallel chain structure in each group (invariant 10) and the correct distribution of small items (11 and 12). Let be removed from a bin positioned in a chain in a group . We already considered the case and hence assume . There are several cases in which we do nothing: If (i) is still well-covered; or if (ii) is a buffer bin; or if (iii) we have and is the last group containing small items and was the last bin in that contained small items. In these cases, it is easy to see that the group structure and all invariants are maintained. For the steps that we take otherwise, we again take a slightly more general approach, because they are recursive in nature, and because they will also be useful when considering big and medium items.
A gap bin is a bin that is part of the group structure belonging to some parallel or sequential chain and should be covered with respect to the invariants 10, 12 and 8, but (due to repacking) is currently not. More precisely, is not a buffer bin, and there are small items positioned in subsequent bins, which may either be part of the same parallel or sequential chain, or may be part of a subsequent group or sequential chain. Furthermore, we call a gap bin maximal, if there are no gap bins among the subsequent bins. In the following, we design a procedure used to repair such a maximal gap bin . It may be called recursively in situations in which there are more gap bins and therefore the parallel chain structure (invariant 10) and the correct distribution of small items (12) may not hold. However, we can guarantee that for each initial (non-recursive) call of , the bin will be the only gap bin, and we will guarantee that there are no gap bins left after the call (including all recursive calls). Now, it is easy to see that the bin is indeed a maximal gap bin and we will handle the remaining cases by a call of .
Let be a maximal gap bin positioned in a chain in a group . First, we discuss the special case . In the section on chains, we already designed a procedure for the case that a non-buffer bin becomes not covered, that is, in the scenario discussed there, we have only a single (maximal) gap bin in the group. In all application scenarios of in the last group, this will actually be enough, but it is also very easy to see that the described procedure will work for any maximal gap bin, the only difference being that invariant 7 may not hold because of other gap bins that might be present.
From now on, we assume . As a first step, we call . Afterwards, remains a chain, and as well as each bin which was followed by a well-covered bin before is well-covered (see Remark 8 and Lemma 10). Hence, if is the last group containing small items, or the second to last bin in remains well-covered, we do nothing else, because all invariants hold (except for gap bins which may be present in preceding groups or a parallel chain). Otherwise, is not covered, but all bins between and are well-covered. In this case, we repeatedly move the largest small item from the subsequent group to until either does not contain small items anymore or becomes well-covered. Afterwards, each bin in the chain starting from has the correct structure with respect to the correct distribution of small items (invariants 11 and 12). Note that, if there is a small item in that can cover a bin together with the big item from , than the same holds for the biggest small item from and did not contain small items before, because these would be even bigger (due to 11) and cover the bin. Hence, in that case only one item would be pulled from and it would be the only small item in afterwards. Furthermore, note that at most one bin from can lose all of its small items in the above process, if it was well-covered to begin with, and if this happens, all the pulled items were pulled from this very bin (due to the distribution of big items 11). Therefore, each small item that was pulled from was previously contained in the first bin of a chain.
If we stopped pulling items from because it did not contain small items anymore, we do nothing else, because then has become the last group containing small items, and does not have to be covered with respect to invariant 12. Hence, we consider the case that still contains small items. By pulling the items from , we might have created multiple maximal gap bins. We now could consider each such bin individually to recurse, but in order to have bounded migration, we need to guarantee that only a constant number of maximal gap bins, namely four, have to be considered. We will achieve this by moving items within the first bins of the chains of such that at most four gap bins remain.
To this end, we first consider the case that does also contain small items, i. e., is not the last group containing small items. Let be the set of first bins in chains belonging to . We may assume that contains more than four bins that are not well-covered because otherwise there is nothing to do. In this case, each of the bins in still contains at least one small item and no small item in the group can cover a bin together with the biggest big item in the group (see considerations above). We pick a set with and the property that a smallest small item contained in a bin belonging to is at least as big as a smallest small item from a bin belonging to , i. e., . Due to that choice, any small item from can be moved to any bin from without violating the ordering of the small items (Invariant 10). We now repeatedly pick a bin from with maximal load and move a biggest small item from that bin to a bin that is not covered. By this process each bin can receive items whose size is at most twice as big as the items that were pulled from this bin. Furthermore, for each bin contained in , the overall size of small items contained in before small items were pulled to was at least half as big as the overall size of items that were pulled. This is due to the distribution of big items (invariant 11) and due to the fact that there was no small item in big enough to cover a bin together with the big item from in this case (see considerations above). Hence, each bin in can be covered by this process and we can recurse on the remaining at most four gap bins in .
If, on the other hand, is the last group containing small items there are two cases. In the case that , we can use the same approach as before with one difference. In this case there can be bins that are positioned at the start of the chain but do not need to be covered, because there are no small items in any subsequent bin of the chain. Hence, we can simply exclude these bins in the considerations. Lastly, if , we do not have parallel chains in and all items have been pulled from the same bin. In any case, for each maximal gap bin in we call .
Note that the call of repairs the gap bin as well as all created gap bins via recursive calls. Hence, after the call of in the deletion procedure all invariants and the correct distribution of small items (11 and 12) in particular hold.
Lemma 15**.**
Let be a maximal gap bin. The overall size of items that are migrated due to a call of is at most . Furthermore, the migration due to the deletion of an item is bounded by .
Proof.
The initial call of may cause several recursive calls in later groups. Let be a maximal gap bin for which such a call occurs, and its chain, its group, be its free space (at the time of the call), and be the maximal size of a small item in any subsequent bin. We first consider the case . The call of results in a call of . Let be the -th set pulled out of a bin due to this call. A simple inductive application of Lemma 10 yields that , and we have . Hence, the overall size of items pulled from the last non-buffer bin of is at most , and the overall size of items migrated due to the call of is at most . In the next step, items may be pulled to from the next group, and because of the above observation their size is as well upper bounded by . This in turn implies, that the repacking that may be caused in the next group in order to bound the number of emerging gap bins is upper bounded by . After this repacking, at most maximal gap bins remain in the next group. It is easy to see that for each of these gap bins we have as well. Summing up, the migration directly caused by the call of (excluding recursive calls) is bounded by . Due to Remark 12 this bounds also holds for the case .
Now, let be the index of the group is positioned in, and the last group in which a (recursive) call of occurs. Furthermore, let for , a maximal gap bin created in , and the maximal size of a small item in any subsequent bin. Note that at most such gap bins are created in for and the bound of also holds for the last group. Clearly, we have and we set . The observations above yield that the migration directly caused by the call of is at most
[TABLE]
because for each (due to invariant 11) and . Therefore the overall migration can be bounded by:
[TABLE]
In the case that an item is deleted, we have and , yielding the proposed bound for that case. ∎
3.3 Big and Medium Items
To deal with the arrival or departure of big and medium items, we mainly use the ideas developed in the static case. However, changing bins belonging to is now much more complicated because we have to be careful to maintain the group and chain structure (invariants 9 and following). For example, removing a big item and its bin from will decrement the size of the corresponding group and possibly . Furthermore, the corresponding parallel chain may become too short.
In this section, we first design some auxiliary procedures to carefully manipulate the group structure. Utilizing these, we next describe the deletion and insertion procedures of big items, and lastly the procedures for medium items. The latter are much simpler but may involve the insertion or deletion of big items from and hence are dealt with in the end.
Preliminaries.
We introduce a series of auxiliary procedures used for small local changes in the groups maintaining their internal structure. These procedures use and the insertion procedure for small items as subroutines, and are used in situations in which the group structure (invariant 9) may be slightly disturbed. In particular, the sizes of the groups may be different and – the total number of groups – may be disturbed by some additive constant. It is easy to see that this is not a problem regarding the analysis of and the insertion procedure for small items, because the sizes of the groups do not influence and are not influenced by these procedures; and a change to by some additive constant merely results in some additional constant factor in the analysis of their migration. Furthermore, and may not be balanced (invariant I2) before or after the call of one of the auxiliary procedures. This will be handled, when they are used.
- •
is called to insert a big item into a group with . To do so, we create a new bin containing . There are two cases. If contains a parallel chain with length smaller than , bin is inserted into at a position that maintains the correct distribution of big items in the chain (invariant 10). More precisely, right before the buffer bin, if all big items in are at least as big as , or right in front of the first bin containing a big item that is smaller than . If was inserted right in front of the buffer bin, we adjust the size of the virtual big item placed in the buffer bin of to be , thereby maintaining invariant 13. Otherwise, a new parallel chain is created in containing only and a buffer bin whose virtual big item has size . Lastly, now may be a maximal gap bin and we call in this case. Afterwards, the parallel chain structure (invariant 10), as well as the correct distribution of small items (12) are guaranteed.
- •
is used to repair the internal structure of a group with after the big item of a bin positioned in was removed. Let be the parallel chain is positioned in. We remove all small items from and delete the bin. Next, we remove all small items from the buffer bin of . If now has length one, we delete the chain, and if additionally has become empty, we also delete the group. Otherwise, we consider two cases: If is the only chain with length smaller than , we adjust the size of the virtual big item in its buffer to be the same as the size of the big item in its direct predecessor, thereby maintaining invariant 13. In the second case there is another chain with length smaller and hence has length (due to 10). We remove the last non-buffer bin from , and remove all small items from and the buffer bin of . Then, we insert into at the position maintaining the correct distribution of big items (10). If was inserted right in front of the buffer bin, we adjust the size of the virtual big item placed in the buffer of (maintaining 13). If now has length , we delete it, and otherwise we adjust the size of the corresponding virtual big item in its buffer bin as well, again maintaining 10 and 13. Now may be a maximal gap bin and we call in this case. Lastly, we reinsert all small items that have been removed. Note that afterwards the parallel chain structure (invariant 10), as well as the correct distribution of small items (12) are guaranteed.
- •
is used to decrement the size of a group , with , by pushing a big item of minimal size to the next group. We select a non-buffer bin from containing a big item of minimal size, remove from , and call . If , we then call . Otherwise, we create a new group belonging to with only one parallel chain. The chain has two bins, namely a bin containing only and a buffer bin whose virtual item has size .
- •
is used to increment the size of a group , with , by pulling a big item of maximal size from the next group. We select a bin from containing a big item of maximal size, remove from , call , and then .
Lemma 16**.**
The overall size of items migrated due to a call of one of the auxiliary procedures above is at most .
Proof.
In both and at most one big item and small items with overall size of at most are removed. The small items are reinserted causing migration of at most (see Lemma 14), and there is a call of yielding the same bound (see Lemma 15). Both in and one big item is moved and the other two auxiliary procedures are called once. ∎
Deletion of Big Items.
When a big item is deleted, there are three cases we have to consider based on the bin that item was positioned in. Firstly, if , we simply delete the bin and reinsert the corresponding medium items starting with the largest one. Next, if , we have to be a bit more careful in order to keep the sets and balanced (invariant I2). If did hold before, we select a bin containing a big item of maximal size (with a preference for itself), replace with the remaining item from , and reinsert (thereby deleting ). If, on the other hand, did hold, we select a big item of minimal size from and move it to . Afterwards, I2 holds, but the removal of from may have violated several invariants concerning the structure of . To deal with this, we use the deletion procedure for the third case , which is by far the most complicated and described in the following.
Let be the group is positioned in. We perform . Now, is decreased by one and may have decreased by one. We first deal with the former and then consider the latter. In particular, if , we iteratively perform for one group after another with . Afterwards, may have been decreased by one and we have for and . If the group structure, that is, 9, again holds. Otherwise, there are too many bins positioned in group for and up to too many in . Hence, for each , we perform many calls of . Afterwards, there are too many bins in and we perform calls of , thereby creating up to one additional group. The last step is to rebalance and , if necessary, that is, if , we select a bin containing a big item of maximal size. If necessary, we switch the second item in such that the big items in are as big as any other in . Then we delete and reinsert the big items. These big items will be inserted into but will not incur further recursive calls for insertion or deletion of big items.
Insertion of Big Items.
The steps that we take, when a big item has to be inserted in the dynamic case are very similar to the static case: We consider inserting into , and in this order and based on the same conditions. The insertion for works exactly as in the static case and the one for is changed only slightly. In particular, there are two cases considered in the procedure, namely and . In the former, a bin is selected containing a big item of minimal size, and this item is used to form a new bin together with . The only change to the procedure is that we deal with the removal of from using the deletion procedure for big items. We now describe how to insert into .
When is to be inserted into we first select the correct group with respect to the distribution of big items (invariant 11), that is, if is at most as big as any other big item in , or the first group containing a big item smaller than otherwise. We call . Now, is increased by one and may have increased by one, that is, invariant 9 may not hold. We first deal with the former and then consider the latter. In particular, we iteratively call for one group after another with . Furthermore, if the last group was of full size, that is before the above operations, we also call . Afterwards, may have been increased by one and we have for and . Hence, if the group structure(9) again holds. Otherwise, there are bins too few positioned in group for .For each , we perform many calls of . Furthermore, if , we perform many calls of , thereby possibly deleting the last group. Lastly, the insertion of might have violated I2, that is, we now have . In this case, we select a big item from and create a bin containing two dummy items of the same size as . Afterwards I2 and all other invariants hold. We then delete the two dummy items one after another using the deletion procedures described above.
Medium items.
Dealing with medium items in the dynamic case is not a big problem, because we can essentially use the same ideas as in the static case. In fact, we have to make only one small adjustment to the insertion procedure in the static case: When the arriving medium item has been inserted into and we have the situation that and , then a big item is to be removed from . We handle this as follows: We replace by a dummy item of the same size, form a new bin containing and call . Afterwards I4 holds. Then we delete the big dummy item and call the corresponding deletion procedure.
When a medium item is deleted from its bin , we distinguish a few cases. If remains barely covered, we do nothing. Otherwise, if , we delete the bin and reinsert all the medium items. Note that these items will simply be reinserted into via and cause no further migration, because of invariant I4. Lastly if , we call . If is barely covered afterwards, we do nothing else. Otherwise, and we remove the big item from (yielding ), and reinsert . Note that in this case will not be inserted into .
Lemma 17**.**
The overall size of items that are migrated due to the insertion or deletion of a big or medium item is .
Proof.
We consider the same cases as above and in the same order.
If is big and deleted from a bin , then medium items with size at most are reinserted. Because the largest item is reinserted first and because of invariants I4 and I3, only one of these items can trigger further migration and all others will be inserted into . Hence, we get the same migration as for medium items plus some constant.
If , the deletion may cause a reinsertion of a big item, or the deletion of a big item positioned in , as well as further migration. In the first case, the corresponding big item will be inserted into , because of its size, and because of the considered case, the insertion cannot cause further deletions of big items. Similarly, in the second case, the deletion cannot cause further insertions of big items. Hence, the migration is given by the migration for insertions or deletions of big items into plus some constant.
If we may perform one call of , calls of , calls of and some additional constant migration. Furthermore, there may be two big items that are reinserted. Because of the choice of the items and invariant I3, they are inserted into , and because of the corresponding case no deletions of big items are caused by these insertions. Hence, the migration in this case is at most (see Lemma 16) plus the migration due to the possible insertions of big items.
We consider the case that is big and has to be inserted. As described in Lemma 3 inserting a big item into may directly cause migration, and the insertion of a big item into or . Furthermore, the insertion of into may cause migration and either a deletion of a big item from or the reinsertion of a big item, which will be placed into . In both cases this causes no further insertions or deletions of big items. Hence, in both cases the migration is essentially given by the migration for the insertion or deletion of a big item into .
If a big item is inserted into , we may perform one call of , calls of , calls of and some additional constant migration. Furthermore, two deletions of big items from may be caused. Because of the corresponding case no reinsertions of big items are caused by these deletions. Hence, the migration in this case is at most (see Lemma 16) plus the migration due to the possible insertions of big items.
If is a medium item and has to be inserted, we have migration and the deletion or insertion of a big item may be caused. In case of a deletion the corresponding item was positioned in . If the item is deleted, this may cause migration as well as the reinsertion of a big item. Hence, the migration in this case is at most .
Summarizing, the overall size of items that are migrated due to the insertion or deletion of a big or medium item is . ∎
3.4 Analysis
In this section, we finish the proof of Theorem 7. We already proved bounds on the migration that may be caused due to insertions and deletions of algorithms (see Lemmas 14,15 and 17). Note that medium items may cause the migration of items with overall size but may have size themselves yielding the bound of stated in Theorem 7. Furthermore, we argued that the invariants are maintained by the insertion and deletion procedures throughout the section. Using these invariants, we prove the stated asymptotic competitive ratio and additive constant.
Lemma 18**.**
The algorithm for the dynamic case has an asymptotic competitive ratio of with additive constant .
Proof.
First, we consider the case . In this case, the claim holds because the bins on average have not too much excess size. More precisely, we obviously have , and the invariants I1 and I6 imply:
[TABLE]
Furthermore, we have , due to 9 and 10; , due to 7; , due to I2; and , because of the case we are considering. Hence:
[TABLE]
A similar argument holds, if and . In this case, we have and , because of invariant I2; , because of 9 and 10; and , because of invariant I5. Hence:
[TABLE]
Next, we consider the case and . In this case, we have , because of Invariant I4, and , because of Invariant I5. According to invariant 12, there is a such that each bin in each group preceding is well-covered and each succeeding group does not contain small items, and because , we have . Let be the size of a big item from with minimal size. Because of the invariants I3 and 11, the items in and each group succeeding are upper bounded in size by . We construct a modified instance as follows:
The remaining big items (the ones bigger than ) are split into a big item of size and a medium or small item. Let be the set of items with size . 2. 2.
For each bin from , we increase the size of a biggest item that is not big to . Let be the set of these items and be the set of the remaining items not belonging to or .
Note that . For some optimal solution for in which each bin is at most barely covered, let , and be the numbers of covered bins with , or [math] items from respectively. We have:
[TABLE]
Furthermore, and, due to 10, 9, I4, 12 and the choice of , we have:
[TABLE]
Hence:
[TABLE]
Lastly, we conclude the proof of Theorem 7 by arguing that the running time bound holds.
Lemma 19**.**
The insertion and deletion procedures in the dynamic case have polynomial running time in both the input size and .
Proof.
We first consider the insertion or deletion of small items. When one of these procedures is called, there may be many recursive calls. For each of these calls it is rather ease to see that the running time is linear in the number of items. Concerning the insertion or deletion of big or medium items, we already saw in the migration analysis (Lemma 17) that only a constant number of recursive calls of big and medium items may be caused. Furthermore, small items (and there are at most such items) may removed or reinserted due to these calls. ∎
4 Amortized Migration
We will now take a look at the setting, where the migration is amortized. Here we are concerned with the maximum ratio of the migration performed divided by the total size of items that have arrived up to some point. This is easier than the standard non-amortized migration considered before.
4.1 Dynamic Case
For the dynamic case, we will show that the lower bound of on the competitive ratio also holds if amortized migration is allowed. Hence, our above algorithm that only uses non-amortized migration is optimal (except for an extra ). This result can also be proved for the other definition of asymptotic competitive ratio.
Proposition 20**.**
There is no algorithm for dynamic online bin covering with a constant amortized migration factor and an asymptotic competitive ratio smaller than .
Proof.
Let be an algorithm for dynamic online bin covering with an amortized migration factor of . Suppose that has asymptotic competitive ratio for some constant value , i. e., for each instance we have for some constant . We will now construct for each even integer an instance . This instance is comprised of phases, where is an even number that is specified later on and depends on and . In each of the phases some number of equally sized items either arrives or departs. The instance corresponding to the first phase is called and the one corresponding to the first phases is called . The optimal (offline) objective value for each of these instances will be a multiple of , i. e., . We will show that the ratio between this value and the objective value achieved by is at least for at least one value of with constant amortized migration factor.
We now describe the instance : In the first phase big items with size arrive; and for each odd there are small items with size arriving in phase and departing in phase . We choose the parameter such that small items cannot fill a whole bin, and such that the total size of small items is upper bounded by the size of a big item, e.g., . Note that for each the optimal (offline) objective value for is if is even, and if is odd (see Fig. 9).
Claim 21**.**
For each even integer , there is some index such that .
Proof.
If for some even or for some odd , we are done. Hence, let denote the property that for all even and for all odd , and we analyze whether can be obtained by . Since two big items are needed to cover a bin and small items are not sufficient for covering a bin, implies that at least bins have to contain at least big items, if is even; and at least bins have to contain exactly one big item, if is odd.
Hence, to maintain that holds in two consecutive phases, some big item has to be moved, and therefore the migration performed in each phase is at least . However, the total size of items arriving or departing in every phase is only
[TABLE]
In the first inequality, we use . In the last inequality, we use implying and thus .
Hence, the total size of migrated items is at least and the total load of items arriving or departing is strictly smaller than . As has amortized migration factor , it is allowed to reassign a total size of , after items of size have arrived or departed. The total size of arrived and departed items equals in our setting. Hence, is allowed to migrate a total size . Choosing – the number of phases – such that then gives . Hence can not migrate a total size of . As it needs to migrate at least such a total size to maintain property , we can conclude that can not hold. Hence, there is some index such that , concluding our proof. ∎
This is sufficient to prove the proposition: From above, we know that for each even , there is some value such that . The asymptotic competitive ratio of then implies and thus
[TABLE]
This is equivalent to . As has asymptotic competitive ratio and , we have and thus . As can be made arbitrarily large, this is a contradiction to the assumption that both and are constant values. Hence, an asymptotic competitive ratio of is not achievable with constant amortized migration factor .
∎
4.2 Static Case
In contrast to the dynamic case, where amortized migration does not help to improve upon the lower bound of on the competitive ratio, amortization allows to design a simple algorithm for the static case, achieving a competitive ratio of with amortized migration of . Some of the ideas applied here were used for bin packing [14] in the past. The small value will again satisfy .
In order to achieve this goal, we make use of an asymptotic fully polynomial time approximation scheme (AFPTAS), denoted by , for the offline version of the problem due to Jansen and Solis-Oba [21]. For an instance and an approximation parameter , the algorithm produces a packing that covers bins with in time that is polynomial in the input size and . Let be a constant such that
[TABLE]
holds for every input .
Our algorithm will be called and its profit for input and is denoted by . Denote the instance after items were presented, that is, at time , as . Our online algorithm will have the same guarantee as the offline algorithm in terms of the order of growth of the additive term, i. e., we will show , and more specifically, we will show that for every time . There will be a sequence of special times denoted by for which it will hold that and therefore will hold for every .
Algorithm will apply (with the same value of ) in every step, i. e., when a new item arrives. This is done in order to obtain an approximated value of the profit of an optimal solution. As we saw before, arguments that are based on total size are valid for approximating this value by a factor of , but not within a smaller factor. In the special times defined in what follows, the output of will be used in order to obtain a new solution, and the input is completely repacked such that it is packed as in this solution (). In this case, all items are removed from their bins and repacked identically to the output of . This is done instead of assigning the new item. In other times which are not special, only the profit of will be used, and the new item is packed into a new bin.
Thus, at times that are not special, algorithm will always greedily assign a new item to a new non-covered bin, and on occasion it will define the current time as special and then it completely repacks the instance with the help of . We define special times as follows. The first special time , which is the first time in which we repack the instance using is when (by and ). We have since after the arrival of just one item no solution has profit above . Before time , the profit of is zero. The other special times are defined as follows. Let (for ) be the last special time, i. e., the last time that a repacking was performed. For the current time , if , the new item is packed into a new bin and is not a special time. Otherwise, we let , i. e., is a special time, and instead of packing the new item immediately, we perform the next repacking. Thus, time , is the first time for which , and thus while , where .
Clearly, the running time of our online algorithm is polynomial in and , since it is the sum of running times of for all prefixes of the input. Before we discuss the migration factor, we show that this algorithm always maintains a near-optimal solution. We will use the property that holds at special times, and analyze the other times.
At any time (before the first repacking), we have that while , and by (1) we get . For every special time we have , since at any special time, once the repacking is applied, the packing of is identical to that of .
Now consider a time satisfying for some , and if is not the last special time, then we also require . Thus, no special times are defined at times , and we have
[TABLE]
Since all items are assigned to new bins, and covered bins remain such, we have . Due to the repacking at the special time , we find , and get
[TABLE]
Combining the last two inequalities (2) and (3) gives
[TABLE]
By (1) for time , , and we get
[TABLE]
as .
Hence, achieves an asymptotic competitive ratio of , and an appropriate scaling of allows us to obtain competitive ratio .
Finally, we will show that has an amortized migration factor of . Let be the number of special times (which are ). Let denote the optimal profit at time , which is a monotonically non-decreasing sequence. Let denote the total size of the first input items. The total size of migrated items is at most , while the total size of items is at least . Let , where for every we have , and additionally, .
We claim that satisfies . The inequality holds since is the optimal profit at a certain time while is the profit of some solution for the same input. Since and by (1) we get , which implies .
Moreover, there exists an optimal solution where every bin has load in , and there is at most one bin that is not covered. Thus, .
We find by :
[TABLE]
By
[TABLE]
and by
[TABLE]
we find
[TABLE]
This analysis holds also for every prefix of the input if the input was repacked at least once (and otherwise the amortized migration factor is zero). Hence, the amortized migration factor of is at most and we obtain the following theorem.
Theorem 22**.**
For every , there is an algorithm for static online bin covering with polynomial running time, an asymptotic competitive ratio of , and an amortized migration factor of .
In the following, we will show that an error in the amortized setting is inevitable, even if we allow an unbounded running time.
Theorem 23**.**
There is no (possibly exponential time) algorithm for static online bin covering that maintains an optimal solution with constant amortized migration factor .
Proof.
We say that a bin is perfectly covered, if it contains items of total size exactly , and call a solution perfect if all of its bins are perfectly covered. Obviously, if there is a perfect solution to a bin covering instance, it is optimal and each optimal solution for this instance has to be perfect.
Let be a positive even integer. Our input consists of phases. The first phase (phase [math]) consists of items of total size and phase (for ) consists of items of total size . Let be the instance after phase arrived.
We will ensure that the optimum is realized by a unique perfect solution (up to some transpositions). Furthermore, the total size of items that need to be moved to transform an optimal solution of to an optimal solution of is at least . Hence, items with total size have to be moved to maintain an optimal solution at all times while the total size of all arriving items is yielding that the needed amortized migration is . Since the construction works for arbitrarily big values of , this suffices to prove the claim, as this rules out a constant amortized migration factor.
We will proceed by first describing all occurring items in detail and noting some basic properties, then we define the phases, describe the optimal solutions and finally we prove their uniqueness and the necessary migration.
Let . The items are either huge, large, medium or tiny and each of these classes contains items of levels. More precisely, for each level we have:
- •
One huge item with size .
- •
One large item of type A with size , and one large item of type B with size .
- •
One medium item of type A with size , and one large item of type B with size .
- •
tiny items each with size .
We now state some simple properties of these items:
Claim 24**.**
It holds
; 2. 2.
* (i. e., all tiny items together cannot fill a bin completely);* 3. 3.
, , , , , ; 4. 4.
, , ; 5. 5.
, , , 6. 6.
* and for all and all .*
For completeness, the simple proof of this fact can be found in the appendix.
Hence, large and medium items of the same type and level can be used to pack a bin perfectly and every other combination of two large or medium items does not cover a bin perfectly. Let and be sizes of some huge, large, medium and tiny item respectively. Summarizing the claim, we have (i) all tiny items together cannot fill a whole bin, (ii) , (iii) , (iv) , and (v) . Hence, in a perfect solution to an instance comprised of a subset of the above items, a bin may contain
(1) exactly one large item together with the unique matching medium item;
(2) at most two items that are medium or large, and at least one tiny item; or
(3) exactly one huge, and at least one tiny item.
Furthermore, if contains the first levels of huge items, we have:
Claim 25**.**
In a perfect solution of , the first levels of huge items have to be packed together with the first levels of tiny items in a unique way.
Proof.
To see this, consider the bin containing the huge item of level in a perfect solution. Due to point 6 in Claim 24, cannot contain any large or medium item, as the solution is perfect. Hence, must contain some tiny items. These tiny items in must have a total size of . As and for all , we need at least tiny items to cover bin .
Now, suppose that there is some bin that does not contain all tiny items of level and let this be minimal. Hence, for each , the bin contains the tiny items of level and all of these tiny items are thus packed. As needs to contain tiny items, it hence must contain at least one tiny item of size at least (due to the monotonicity of ). Hence, the sum of the tiny items in is at least
[TABLE]
Hence, is not perfectly covered, a contradiction to the assumption.
∎
We proceed with the definition of the phases: Phase [math] consists of all large items of type A, all medium items of type B and the tiny items of level . Note that the large items of type and the medium items of type are not yet available. As (see Claim 24), the total volume of items in phase [math] is . This (perfect) packing also shows that (see Fig. 10).
Claim 26**.**
Putting one item of size , one item of size , and one item of size into a bin is the unique optimal perfect packing (up to the packing of the tiny items) for phase [math].
Proof.
Due to the definition of the sizes, two large items have total size strictly larger than and two medium items have total size strictly smaller than . The total size of items in phase [math] is exactly , the total size of all tiny items is not enough to cover a single bin (Claim 24), and we have exactly large and medium items. Hence, every bin in a perfect packing must contain one large item and one medium item. Now let be the bin containing .
Suppose that the solution described above is not unique. Hence, there is some bin that contains an item of size with . If , the monotonicity of shows that this bin is not perfectly covered. If , the pidgeonhole principle shows that there must be some bin containing an item of size with , which is again a contradiction. ∎
For each , phase consist of the huge item of level , the large type B item of level , the medium type A item of level and the tiny items of level if , and no tiny items otherwise. The items of instance can be packed perfectly as follows. The huge and tiny items of level to are packed in the unique possible way described above; the large and medium type B items of level to are matched to form perfectly packed bins, and similarly the large and medium type A items of level to are matched. Lastly, for each , we have and we pack the remaining items correspondingly (see Fig. 11). This packing has perfectly covered bins.
Claim 27**.**
The packing described above is unique.
Proof.
Claim 25 implies that the huge items are packed together with the fitting tiny ones in perfectly covered bins. There are only tiny items left and each bin that does not correspond to a perfect match of a medium and large item has to contain a tiny item as described in the proof of Claim 26. As we still need to fill bins perfectly, of these bins need to be packed by perfect matches. This is exactly the number of perfect matches available and we thus need to pack all of them.
Furthermore, large items cannot be combined in one perfectly covered bin (Claim 24) and therefore each of them has to be packed into a single bin together with a tiny item. For each such bin there is exactly one medium item left that fits perfectly, namely the one chosen above. ∎
In order to transform the unique perfect solution of instance into the one for , at least non-tiny items have to be moved (see Fig. 11). Each of these items has a size of at least . Hence, a total migration of is needed while the total size of the instance is . As we are only allowed to repack a total size of , this implies , a contradiction to the assumption that is a constant.
This concludes the proof.
∎
Appendix A Proof of Claim 24
Proof of 24.
We simply calculate:
- •
- •
- •
2. 2.
We have
[TABLE] 3. 3.
We also calculate:
- •
- •
- •
- •
- •
- •
4. 4.
Again, we calculate
- •
Note that for all and hence .
- •
- •
Note that for and hence 5. 5.
Finally, some calculations show that
- •
Note that and hence .
- •
- •
- •
From , we have . 6. 6.
This follows from the above points. Note that is the smallest huge item and the smallest medium item. Hence, point 5 implies that the sum of these two already exceeds . As every medium or large item is larger than due to points 3 and 4, the claim follows.
∎
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Susan F. Assmann, David S. Johnson, Daniel J. Kleitman, and Joseph Y.-T. Leung. On a dual version of the one-dimensional bin packing problem. J. Algorithms , 5(4):502–525, 1984. URL: https://doi.org/10.1016/0196-6774(84)90004-X , doi:10.1016/0196-6774(84)90004-X . · doi ↗
- 2[2] János Balogh, Leah Epstein, and Asaf Levin. Lower bounds for online bin covering-type problems. Journal of Scheduling , pages 1–11, 2018.
- 3[3] Sebastian Berndt, Klaus Jansen, and Kim-Manuel Klein. Fully dynamic bin packing revisited. In Naveen Garg, Klaus Jansen, Anup Rao, and José D. P. Rolim, editors, Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM 2015, August 24-26, 2015, Princeton, NJ, USA , volume 40 of LIP Ics , pages 135–151. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 2015. URL: https://doi.org/10.4230/LIP Ics.APPROX-RANDOM.2015.135 , doi:10.42 · doi ↗
- 4[4] Sebastian Berndt, Klaus Jansen, and Kim-Manuel Klein. Fully dynamic bin packing revisited. Mathematical Programming , 2018. doi:10.1007/s 10107-018-1325-x . · doi ↗
- 5[5] Marie G. Christ, Lene M. Favrholdt, and Kim S. Larsen. Online bin covering: Expectations vs. guarantees. Theor. Comput. Sci. , 556:71–84, 2014. URL: https://doi.org/10.1016/j.tcs.2014.06.029 , doi:10.1016/j.tcs.2014.06.029 . · doi ↗
- 6[6] János Csirik, David S. Johnson, and Claire Kenyon. Better approximation algorithms for bin covering. In S. Rao Kosaraju, editor, Proceedings of the Twelfth Annual Symposium on Discrete Algorithms, January 7-9, 2001, Washington, DC, USA. , pages 557–566. ACM/SIAM, 2001. URL: http://dl.acm.org/citation.cfm?id=365411.365533 .
- 7[7] János Csirik and V. Totik. Online algorithms for a dual version of bin packing. Discrete Applied Mathematics , 21(2):163–167, 1988. URL: https://doi.org/10.1016/0166-218X(88)90052-2 , doi:10.1016/0166-218X(88)90052-2 . · doi ↗
- 8[8] Leah Epstein. Online variable sized covering. Inf. Comput. , 171(2):294–305, 2001. URL: https://doi.org/10.1006/inco.2001.3087 , doi:10.1006/inco.2001.3087 . · doi ↗
