A 1312 approximation algorithm for bin packing with extendable bins

A 1312 approximation algorithm for bin packing with extendable bins

ELSEVIER Information Processing Letters 65 (1998) 229-233 A 13 / 12 approximation algorithm for bin packing with extendable bins Paolo Dell’Olmo a*1...

430KB Sizes 1 Downloads 108 Views

ELSEVIER

Information Processing Letters 65 (1998) 229-233

A 13 / 12 approximation algorithm for bin packing with extendable bins Paolo Dell’Olmo a*1,Hans Kellerer by2,Maria Grazia SperanzaC,*, Zsolt Tuzady3 a Dipartimento di Informatica Sistemi e Produzione. Universita “Tor Vergata”, Roma, Italy b lnstitut fii? Statistik, Gkonometrie und Operations Research, Uniuersitiit Graz, Universitiifstraje IS, A-8010 Graz, Austria c Dipartimento Metodi Quantitativi, Universita degli Studi di Brescia, Contrada Santa Chiara 48/b, I-25122 Brescia, Italy e Computer and Automation Institute, Hungarian Academy of Sciences, Kende u. 13-17. H-1111 Budapest, Hungary Received 6 August 1996; revised 4 December 1997 Communicated by P.M.B. Vitanyi

Abstract A set of items has to be assigned to a set of bins with size one. If necessary, the size of the bins can be extended. The objective is to minimize the total size, i.e., the sum of the sizes of the bins. The Longest Processing Time heuristic is applied to this NP-hard problem. For this approximation algorithm we prove a worst-case bound of 13/12 which is shown to be tight when the number of bins is even. @ 1998 Elsevier Science B.V. Keywords: Bin packing; Scheduling; Approximation algorithms; Worst-case performance

1. Introduction In the standard bin packing problem, a list of items and an inexhaustible set of bins are given and one is asked to pack the items into the minimum number of bins. Bins have identical fixed size, i.e., the total size of the items packed in any single bin cannot exceed 1. A lot of approximation results exist for the standard bin packing problem (see, e.g., [ 1] ) . In the problem we investigate here, the number of available bins is limited but the size of a bin is ex-

* Corresponding author. Email: [email protected]. ’ Email: [email protected]. ’ Email: [email protected]. 3Email: [email protected]. Research of the author was SUDported in part by the Hungarian Scientific Research Fund, gram OTKA T-016416.

tendable, that is, the total size of the items packed in any bin can exceed 1, if necessary. One is asked to minimize the total size of the bins. Specifically we are given a set 7 of n items of size (or length) pi. The items will be ordered such that PI z P2 k ... 2 pn. Since an item i is characterized by its length, we will identify i with its length pi. We are also given m bins Bt , . . . , B,. (We will often identify bins with the items assigned to them.) The set of bins and 7 form an instance Z = (I, m) . For a subset T of items its length C(T) denotes the sum of the items in T. The load !( Bj) of a bin Bj is just the length of the items contained in Bj. Finally, the size W( Bj) of a bin Bj is defined by w( Bj) = max{e(Bj), 1). The objective is to minimize the total size of the bins, i.e., the sum of the sizes of the bins.

0020-0190/98/$19.00 @ 1998 Elsevier Science B.V. All rights reserved. PII SOO20-0190(97)00216-O

230

I? Dell’Olmoet al./InformarionProcessingLetters65 (1998) 229-233

This particular bin packing problem arises in a variety of scheduling and storage allocation problems. Consider, for instance, the case of a set of tasks which must be assigned to a set of identical resources (e.g., workers) which are available at a fixed cost for a given amount of time (the regular time) and can be acquired at an additional cost, proportional to the time (the extra time), in case of need. The problem of assigning the tasks with the objective of minimizing the total cost is equivalent to the above bin packing problem. A different application is a scheduling problem on two machines where two types of tasks have to be executed. Suppose that the tasks of the first type require both machines for some time, and then only the first machine for an additional processing time (a bin), identical for all tasks, and the tasks of the second type (the items) require execution on the second machine only. The objective function is the minimization of the makespan. Finally, the bin packing model can be applied to the storage allocation problems in which extra capacity can be obtained from a fixed set of locations (bins) with given capacity at a proportional cost and we are asked to minimize the total cost. It can be easily seen by a reduction from 3PARTITION (see [2]) that this problem is strongly NP-hard. Therefore, approximation algorithms should be applied which can find near-optimal solutions in reasonable time. In this paper we will analyze the worst-case performance of the well-known Longest Processing Time (LPT) algorithm. This heuristic was introduced by Graham [3] as an approximation to the multiprocessor scheduling problem with the objective of minimizing the makespan. LPT sorts the items in non-increasing order into a list and assigns at each iteration the first item of the list to a bin with smallest load on it. The time complexity of LPT is O(n(logm + logn)). We will show that it yields a worst-case performance of 13 / 12 which is tight when the number of bins is even. In [ 41 the on-line version of this bin packing problem is considered. It is shown that the worst-case performance of a list scheduling heuristic is 514, while no heuristic can have performance ratio better than 7/6. Moreover, a heuristic is presented with performance ratio 1.228. Let us finish this introduction with some further notation. Consider the solution given by the LPT heuristic. In general, some of the bins are covered possibly with an item which partially exceeds the original size

of the bin, while some other bins still have idle space. Given a partial solution, i.e., a partition of a subset of 7 or an assignment of a subset of the items to the bins, we say that a bin Bj is uncovered if the load of Bj is smaller than one. If the load is not smaller than 1, we say that the bin Bj is covered. We call the idle space of an uncovered bin Bj the difference between 1 and the load of Bj. An item pi is said to cover bin Bj if Bj is not covered before pi is assigned to Bj by LPT but is covered immediately after. Item pi is also called a covering item. Furthermore, items not exceeding l/3 are called small items, whereas items greater than l/3 are called big items. The big items are partitioned into the very big items, which are the items greater than 213 and the medium items, which are the remaining big items between l/3 and 213.

2. An approximation

result for the LPT heuristic

In this section the worst-case behavior of LPT for our problem will be analyzed. We will prove a performance ratio of 13/12 which is tight for m even. Consider a relation R of the given problem where each small item is preemptable, i.e., its execution can be interrupted and restarted at any time; it is even allowed to execute a small item simultaneously on different bins, i.e., different parts of the same item can be executed at the same time on different bins. The optimum assignment of tasks in R is called optimum semipreemptive solution OFT,. Let us denote by C”(2) the total size of bins produced by the LPT heuristic and by C* (1) the total size of the bins produced by the optimum semipreemptive solution on instance 1. (We will often write briefly C” instead of C”(Z) and C* instead of C*(Z).) It will be shown that C”(Z)/C*(Z) < 13/12 for any instance Z of tasks and bins. For that reason the notation of a minimal counterexample is introduced. Definition 1. A counterexample is defined to be an instance Z = (7, m) of tasks and m bins such that C”(Z)/C*(X) > 13/12. A counterexample is called minimal if (i) there is no counterexample with a smaller number of bins, and (ii) there is no counterexample with a smaller number of big items.

l? Dell’Olmo

et al. /Information

Processing

Letters 65 (1998) 229-233

231

The existence of counterexample implies the existence of a minimal counterexample. Assume in the sequel that the instance Z = (7, m) provides a minimal counterexample. To exploit the “minimality”, the concept of domination is introduced.

in the minimal counterexample 2. Such an item would be alone in a bin of the LPT partition. It can be easily seen that removing this item and reducing the number of bins from m to m - 1 would yield a counterexample with a smaller number of bins.

Definition 2. We say that bin Bj* (of OPT,) dominates bin Bk = {xi,. . . , x,} (of the LPT solution) if there is a partition P;“, . . . , Pr* of the big items of By suchthatC(P,*) >xifori=l,...,r.

Lemma 4. In a minimal counterexample there is no bin in the LPT solution which contains items a, b (a > b) such that a + b > 1 and a < 2/3.

Lemma 3 (Domination Lemma). Let Bk be a covered bin of the LPT solution in a minimal counterexample, Then no bin By of OPT, will dominate Bk. Proof. Suppose BT dominates Bk. Consider the instance 1’ obtained by deleting the items of Bk and the corresponding bin Bk. The LPT assignment will be identical to that for 1 except that bin Bk is missing. Therefore, C”(z’> = C”(z) - W(Bk). Now construct a new assignment for the instance 1’ from OPT,. Delete each item Xi (i = 1, . . . , r) which was in Bk from the solution OPT, and replace it with the corresponding elements of the partition set Pi*. Distribute all remaining small items of By arbitrarily over the bins and “delete” bin BJ’. Let R denote the total length of the items of BT not contained in any of the partition sets. Since [(Pi*) - xi 2 0 for i = 1,...1 r and !( Bk) = w( Bk), as Bk is a covered bin, we conclude C*(Z’)

< C*(Z)

- w(B;)

+ e(QP;)

-xi)

+ R

i=l = C*(z)

-

w(B;)

= c*(T)

-

W(Bk).

= C”(z)

-

+ w(B;)

- !(Bk)

But C”(z’)

>

;c*(r’)

This implies 2. c7

W(Bk) +

>

$*(z)

-

w(Bk)

&W(&).

a contradiction

to the minimality

of

We may assume in the sequel that each covering item is the last item assigned to a bin by LPT. Otherwise, all bins in the LPT solution have size at least 1 and the heuristic is obviously optimal. Furthermore, there is no item with length greater than or equal to 1

Proof. Let the bins be numbered in such a way that item pi is assigned to bin Bi (i = 1, . . . , m) by LPT. Of course, item pm+i is assigned to the bin with smallest load, starting with assignment of item pm+1 to bin B,. Let bin Bk be the “first” bin, i.e., the bin with smallest index, such that Bk = {a, b} with a + b > 1 and a < 213. Of course, a = pk. From a < 213 and b > l/3 we conclude b = pZ,+kfl. If in OPT, at most two items of TI := {PI,. . . , p~,+k+l} are contained in any bin, then there is a bin containing two items of Tt where one of these two items is not smaller than a. If in OPT, there is a bin with three items x, y, z of Tl, we get x+y > a and z 2 b since a < 2/3 and b is the smallest element of T,. In either case, we have found a bin which dominates the covered bin Bk, a contradiction to the Domination Lemma. 0 Let p denote the number of covering items in the LPT solution and ki the number of big covering items, respectively. The big covering items are also called critical items. Lemma 5. The critical items in a minimal counterexample have the following properties: (a) The critical items are exactly the kl smallest among the big items. All critical items are medium items. (b) There is an optimal semipreemptive solution in which all the critical items are assigned to covered bins which contain either a very big item and medium item or three medium items. Proof. If kl = 0, then the result is trivial. Thus, we assume that kl > 0. There are at most m very big items. Otherwise, a straightforward contradiction to the Domination Lemma can be found, similar to the argument in the proof of Lemma 4.

232

P: Dell’Olmo

et al. /Information

Denote by r the number of very big items. Observe the situation just before the first critical item is assigned by LPT. Because of Lemma 4 there are r bins containing a single very big item and m - I bins containing two medium items. At that time each bin has load greater than 2/3 but smaller than 1. Obviously, each of the following medium items will become a covering item. Claim (a) follows. By exchanging a very big item with a medium item we can guarantee that there is no bin in OPT, which contains two very big items, since the total size will not be increased by that procedure. Let rt be the number of bins in OPT, which contains a very big item and a medium item. Hence, there are r - rt bins which contain very big items but no other big items. There remain m - r bins with exactly 2(m - r) + kt - rt medium items, where the total number of medium items is 2(m - r) + kt. At least kt - 11 of them have 3 medium items. Altogether, at least kl bins exist with total length of the big items greater than 1. Therefore, we have found an optimal semipreemptive solution with a set of K1 of at least kl covered bins which contain only big items and at least one medium item per bin. By exchanging any critical item not assigned to an element of KI with a medium item of a bin Bj in K1, the load of bin Bj is still greater than 1. Claim (a) guarantees that the total size will not increase. Therefore, claim (b) follows. 0 Lemma 6. There are no critical items in a minimal counterexample. Proof. Assume kl > 0 and let S + k1/3 be the total length of all critical items. By replacing all critical items by items of length l/3 we get a new instance 1’. According to Lemma 4, the assignment of items to bins by LPT does not change and CH(l’) = CH(2) - 8. By Lemma 5 an optimal semipreemptive solution can be constructed where all critical items are elements of bins with big items only. After the “shrinking” of the critical items the load of the corresponding bins still is not smaller than one. Consequently, C* (2’) < C* (Z) - 6. This contradicts the minimality of the given counterexample. 0 Corollary 7. The total length of all big items in a minimal counterexample is not greater than m. Fur-

Processing

Letters 65 (1998) 229-233

thermore, the big items can be assigned to bins without covering any bin. Main Theorem.

Moreover,

For any instance 1, we have

this bound is tight for every even m.

Proof. First of all, recall we are working with a minimal counterexample. We can assume that the total length of all items S is not greater than m. Otherwise, let S = m + S with 6 > 0. From Corollary 7 and the assumption that small items are preemptable, C* = S follows. Obtain a new instance 1’ by deleting the smallest items of total length 6 (possibly breaking one item only). Then, CH(Z’) > CH(X) - 6. From Corollary 7 we know that all deleted items are small items. Since small items are preemptable, we obtain C* (1’) = C* (2) - 8 = m and Z’ represents a new counterexample, that is an instance with worse performance ratio, in which the total length of items equals m. Now renumber the bins such that the bins B1,. . . , B, are covered and the remaining bins are uncovered by LPT. Let US denote by aj + bj, with j=l , . . . ,p, the length of the item which covers Bj, with aj and bj the parts filling and exceeding the idle space, respectively. Moreover, let cj denote the idle space available in bin Bj, j = p + 1,. . . , m. Since S < m, CT=, bj 6 C,“,,, Cj. Moreover, ai 2 cj, for m, due to the fact that i= l,... ,pandj=p+l,..., LPT assigns each item of 7 to the largest idle space available. Thus, >P

(m-p)kUj

j=l

2

Cj bpebj* j=l

j=p+l

It follows, by adding (m - p) CT=, bj to both sides, that P

(m-p)C(aj+bj) j=l

P

>mCbj. j=l

As

(m-P)

&aj+bj) j=l

< (m
I? Dell’Olmo et al. /Information

by Lemma 6, and (m-P)P 3



we get

bj < ; j=l

and CH 6 13/12m. This contradicts the existence of a minimal counterexample. The tightness of the bound for even m can be seen by considering an instance with m items of length l/2 and +rn items of length 1.3. The LF’T heuristic yields 13m, whereas the optimum solution has a value ofm. 0 Remark 8. It can be easily seen that for an add number of bins the performance ratio of LFT is at mast 13 ' This bound is still not tight. However, conE-m'

Processing Letters 65 (1998) 229-233

233

sidering instances with m bins, m items of length 112 and i(m - 1) items of length l/3, the ratio between heuristic and optimum solution value is z - &. Of course, this differs only very slightly from the upper bound.

References [l]

E.G. Coffman, M.R. Garey, D.S. Johnson, Approximation algorithms for bin packing - An update survey, in: G. Ausiello, M. Lucettini, P Serafini (Eds.), Algorithm Design for Computer System Design, Springer, New York, 1984, pp. 49-106. [2] M.R. Garey, D.S. Johnson, Computers and Intractability: A guide to the Theory of NP-completeness, W.H. Freeman, San Francisco, 1979. [3] R.L. Graham, Bounds on multiprocessing timing anomalies, SIAM J. Appl. Math. 17 (1969) 263-269. [4] M.G. Speranza, Zs. Tuza, On-line approximation algorithms for scheduling tasks on identical machines with extendable working time, Ann. of Oper. Res. (to appear).