22
JOURNAL OF ALGORITHMS 6, 49-70 (1985) A New Proof for the First-Fit Decreasing Bin-Packing Algorithm BRJZNDAS. &KER Bell Loboratories, Murray Hill, New Jersey 07974 Received August 18,1983 This paper provides a new proof of a classical result of bin-packing, namely the 7 performance bound for the first-fit decreasing algorithm. In bin-packing, a list of real numbers in (0, l] is to be packed into a minimal number of bins, each of which holds a total of at most 1. The first-fit decreasing (FFD) algorithm packs each number in order of nonincreasing size into the first bin in which it fits. In his doctoral dissertation, D. S. Johnson (“Near-Optimal Bin Packing Algorithms,” Doctoral thesis, MIT, Cambridge, Mass., 1973) proved that for every list L, FFD( L) Q y OPT( Z,) + 4, where FFD( L) and OPT(L) denote the number of bins used by FFD and an optimal packing, respectively. Unfortunately, his proof required more than 100 pages! This paper contains a much shorter and simpler proof that FFD( L) < yOPT( L) + 3. 6 1985 Academic Press. IIK. 1. INTRODUCTION This paper provides a new proof of a classical result for bin-packing, namely the y performance bound for the first-fit decreasing algorithm [l, 21. In bin-packing, a list L of pieces, i.e., numbers in the range (0, 11, are to be packed into bins such that each bin holds a total of a most 1, and the goal is to minimize the number of bins used. The first-fit decreasing (FFD) algorithm first sorts the list into nonincreasing order, and then processes the pieces in that order by placing each piece into the first bin into which it fits. More precisely, suppose the sorted pieces are p1 > p2 > - * * > p,, where pi denotes both a piece and its size, and that the bins are indexed as B,, B,,... . FFD processes the pieces in the order pl, p2,. . . , p,. For 1 6 i < n, if j is the least k such that B, holds a total of a most 1 - pi when pi is to be packed, then FFD places pi in Bj. For a list L, let FFD(L) denote the number of bins used by FFD and let OPT(L) denote the minimal number of bins into which L can be packed. In his dissertation, Johnson [l] showed that for every list L, FFD( L) d yOPT(L) + 4. Unfor- 49 0196-6774/85 $3.00 Copyright 0 1985 by Academic Press. Inc. All rights of reproduction in any form reserved.

A new proof for the first-fit decreasing bin-packing algorithm

Embed Size (px)

Citation preview

JOURNAL OF ALGORITHMS 6, 49-70 (1985)

A New Proof for the First-Fit Decreasing Bin-Packing Algorithm

BRJZNDAS. &KER

Bell Loboratories, Murray Hill, New Jersey 07974

Received August 18,1983

This paper provides a new proof of a classical result of bin-packing, namely the 7 performance bound for the first-fit decreasing algorithm. In bin-packing, a list of real numbers in (0, l] is to be packed into a minimal number of bins, each of which holds a total of at most 1. The first-fit decreasing (FFD) algorithm packs each number in order of nonincreasing size into the first bin in which it fits. In his doctoral dissertation, D. S. Johnson (“Near-Optimal Bin Packing Algorithms,” Doctoral thesis, MIT, Cambridge, Mass., 1973) proved that for every list L, FFD( L) Q y OPT( Z,) + 4, where FFD( L) and OPT(L) denote the number of bins used by FFD and an optimal packing, respectively. Unfortunately, his proof required more than 100 pages! This paper contains a much shorter and simpler proof that FFD( L) < yOPT( L) + 3. 6 1985 Academic Press. IIK.

1. INTRODUCTION

This paper provides a new proof of a classical result for bin-packing, namely the y performance bound for the first-fit decreasing algorithm [l, 21. In bin-packing, a list L of pieces, i.e., numbers in the range (0, 11, are to be packed into bins such that each bin holds a total of a most 1, and the goal is to minimize the number of bins used. The first-fit decreasing (FFD) algorithm first sorts the list into nonincreasing order, and then processes the pieces in that order by placing each piece into the first bin into which it fits. More precisely, suppose the sorted pieces are p1 > p2 > - * * > p,, where pi denotes both a piece and its size, and that the bins are indexed as B,, B,,... . FFD processes the pieces in the order pl, p2,. . . , p,. For 1 6 i < n, if j is the least k such that B, holds a total of a most 1 - pi when pi is to be packed, then FFD places pi in Bj. For a list L, let FFD(L) denote the number of bins used by FFD and let OPT(L) denote the minimal number of bins into which L can be packed. In his dissertation, Johnson [l] showed that for every list L, FFD( L) d yOPT(L) + 4. Unfor-

49 0196-6774/85 $3.00

Copyright 0 1985 by Academic Press. Inc. All rights of reproduction in any form reserved.

50 BRENDA S. BAKER

tunately, the proof required more than 100 pages! The proof was outlined in a journal article [2] but the details were not published due to their length. This paper gives a simpler and much shorter proof that for every list L,

FFD(L) < yOPT(L) + 3.

The key to the new proof lies in assigning a weight to each piece such that

(a) Except for a bounded number of bins, every bin in the FFD packing contains a total weight of a least one;

(b) Weight in excess of y in bins with pieces > f in an optimal packing is balanced by bins with total weight < y in bins with no pieces > $.

The result will follow from showing that the average weight per bin in the optimal packing is at most +. The major portion of the proof is divided into four cases according to the size of the smallest piece in the list.

This proof strategy is simpler than that of [l, 21. Like our proof, the proof in [1,2] aims to obtain two lemmas, one bounding the total weight in the FFD bins from below, and the other bounding the total weight in bins of the optimal packing from above. However, in order to obtain a weighting function which will accomplish these goals, the original proof assigns weights to sets of pieces rather than to individual pieces. Intuitively, its weighting function discounts the weight of certain pieces in the set accord- ing to the relative sizes of other pieces in the sets, in order to make the total weight small enough to obtain the second lemma. The discounting of weights causes the first lemma to require more than 40 pages in the original proof. By clever choice of weighting functions, the proof in this paper accomplishes the discounting directly, while keeping the proof of (a) to one paragraph for each of the four cases. For the second lemma, the original proof expends much effort in trying to keep track of which pieces are packed with pieces > $ in either the FFD or optimal packing, but not in both. In addition, there is a lengthy (40 page) case analysis of bins with different assortments of piece sizes. In this paper, much of the former work is avoided by means of a key lemma which relates the relative weights of second-largest pieces in bins containing pieces > 4 in the FFD and optimal packings. Some further analysis in each case identifies bins with weight possibly > y in the optimal packing and reduces the proof of (b) to a short case analysis of bins containing only pieces < f in the optimal packing. Overall, the approach in this paper leads to a proof which is considerably shorter and less complex than the original proof.

It should be mentioned that the bound of 9 is tight, that is, there are no constants (Y and p with (II < y such that for every list L, FFD(L) < aOPT( L) + @. The reader is referred to [2] for a proof of tightness.

A NEW PROOF FOR FIRST-FIT 51

TABLE 1 A Weighting Function

2. DEFINITIONS

For i > 1, the ith largest piece in a bin B of packing P will be referred to as the ith piece in the bin and denoted by p( B, i, P). Ties between pieces of identical size may be broken arbitrarily.

For the purposes of this paper, a weighting function W is a nondecreasing step function with domain [x, l] for some x, 0 < x -C 1, and range { BQ 0 < i 6 m } c [0, 11, such that W, > Wj for 0 6 i <j G m. For 0 d i B m, define Ri = { y J W( y) = q }. Each Ri is called a region of W. Weighting functions will usually be specified by tables such as Table 1.

For any piece p, the weight of p is W(p), and the density of p is W( p)/p. If B is a bin of a packing P, let W( B, P) denote the total weight of pieces in B. For i > 1, let W( B, i, P) denote the weight of the i th piece in B (or 0 if B does not have an i th piece) in P. For a set S of bins and a packing P, define W(S, P) = Cs,= ,W( B, P) and W(S, i, P) = c BE ,WB, i, 0

Suppose the bins are indexed as B,, B,, . . . , in the order in which a first piece is packed into them by FFD. A piece p is a regular piece if FFD packs it into a Bi at a time when all higher-numbered bins are empty. Otherwise, p is a fullback piece. A bin other than the last (highest- numbered) bin of an FFD packing is a regular bin with respect to a weighting function W if all its regular pieces are from a single region Ri of W. Otherwise, a bin other than the last bin is a transition bin.

3. THE PROOF STRATEGY AND THE EASY CASES

This section begins the proof of the main theorem:

THEOREM. For any list L, FFD( L) < yOFT( L) + 3.

Let P be an FFD packing of L and P* an optimal packing of L. Let x denote the first regular piece packed in the last bin of P. Without loss of

52 BRENDA S. BAKER

generality, it may be assumed that no pieces are packed after x, i.e., x is the smallest piece in L. Also, we may assume that each piece of size > 4 is packed in the same bin in P and P*. Let G be the set of bins containing a piece of size > $. A bin in G is called a G-bin.

If x Q &, then all bins except the last are at least & full (since x didn’t fit in them) and FFD( L) 6 ($)OPT(L) + 1. If x > 4, then FFD(L) = OFT(L). If 4 > x > f, then pieces of size greater than 1 - x 2 $ are packed alone in bins in both P and P*, while the remaining pieces, which are of size at most i, are paired in bins of both P and P* (except for a possible odd piece); hence FFD( L) = OPT(L). So we may assumed 5 < x < f. Note that the lower bound on x implies that a G-bin contains at most three pieces.

Ideally, we would like to design a weighting function W such that each bin of P has total weight at least one, while each bin of P* has total weight at most y. Such a weighting function has proved elusive.

Instead, we weaken the goal as follows. For any weighting function W, define w = C p E LW( p) - W(G, 2, P) - W(G, 3, P). We would like to de- fine a weighting function W such that

(i) w > FFD(L) - 3,

(ii) the total weight in each bin 4 G in P* is at most v,

(iii) the weight of each first piece in a G-bin is 1,

(iv) the weight of third pieces in G-bins of P* is no greater than 4,

(v) the total weight of second pieces in G-bins in P* is no greater than the total weight of second and third pieces in G-bins in P.

Together, the above would prove the theorem since

FFD(L)-3~ w= c W(p)- W(G,2,P)- W(G,3,P) PCL

d c W(p) - W(W, f’*) PCL

Unfortunately, we cannot find weighting functions that allow us to obtain all of (i)-(v) simultaneously for every list L. We can show that (v) holds for any W. However, for some lists, (i) necessitates allowing pieces of size $ - c to have weight f ; but assigning them weights this large ruins (iv). Conse- quently, the proof is divided into four cases, according to whether:

(a) + cx< f, (b) $ c x < $ and there is no regular piece in ((1 - x)/4, $1,

A NEW PROOF FOR FIRST-FIT 53

(c) & < x Q ) and there is a regular piece in ((1 - x)/4, $1, or

(d) f <xd +.

Cases (a) and (b) are proved by obtaining a weighting function W such that all of (i)-(v) hold. For cases (c) and (d), weighting functions are picked that allow us to prove (i) and (iii) while weakening (iv) and strengthening (ii) and (v). Thus, the excess weight of third pieces in some G-bins will bebalanced by total weight < ?$ in other G-bins. That is, we will show that W < 9 by computing an upper bound on the average weight per bin. The next section will describe the proofs for the latter two cases; the remainder of this section motivates the weighting functions used and proves cases (a) and (b).

The weighting functions in all of the four cases are variations on the following function W. Let k = [l/x 1.

w*(y) = ; 1

ifyE x,-, [ 1 k

1 - = WC4 j I ,j=2 ,..., k-l,

ifyE i - l-x 1 j ‘7

1 ,j=2 ,..., k-l,

= 1 if y E(t,l].

It is easily verified that these cases are well defined and partition [x, 11. For this weighting function, every regular bin B (except possibly the last

bin) contains a total weight of at least 1, arrived at as follows: For some j, B either has j regular pieces of weight l/j, or j regular pieces of weight (1 - W(x))/j. In the latter case, the regular pieces occupy a cumulative width of at most 1 - x, leaving enough space for a fallback piece of size at least x and weight at least W*(x). Thus, if there are r transition bins and one final bin, w* = 1 p&Wp) - W(G,2, 0 - W*(G, 3, P) ’ FFD(L) - r - 1. By considering the weight in transition bins, in each case it is possible to reduce the constant r + 1 to 3, giving (i).

Next, we prove that (v) holds for every weighting function.

LEMMA 1. Let x > & and let W be a weighting function. The total weight of second pieces in G-bins of P* is at most the total weight of second and third pieces in G-bins of P.

Proof Suppose W has weights K, 0 < i < m. First, we show that the number of second pieces of weight at least w in G-bins of P* is at most the number of second or third pieces of weight at least w in G-bins of P, for O<i<m.

54 BRENDA S. BAKER

If every piece of size at most 5 and weight at least Wj is packed in a G-bin in P as a second or third piece, then the number of second pieces of weight at least W, in P* can be no larger. So suppose that p is a smallest piece of size at most i and weight at least W, that is not packed in a G-bin in P. Consider any bin B E G. If B contains a second piece of size at least p in P*, then the first piece in B is of size at most 1 - p, and B also contains a second piece of size at least p in P (otherwise, p would have been packed in B). If in P*, B contains a second piece q of weight at least W, and size less than p, then by choice of p, q is packed in a G-bin in P. Since x > &, q must be a second or third piece in a G-bin in P. Thus, the number of second pieces of weight at least W, in P* is at most the number of second and third pieces of weight at least W, in P.

Let the second and third pieces in G-bins of P be pl, p2,. . . , p, in nonincreasing order. Let the second pieces in G-bins of P* be p:, p;, . . . , p,* in nonincreasing order. We claim that r < n and for 1 < i < r, W( pt) < W( pi). For otherwise, for some i, the number of second pieces of weight at least W( p,?) in G-bins of P* would be larger than the number of second or third pieces of weight at least W(p,+) in G-bins of P, contradicting the previous paragraph. Consequently, the total weight of second pieces in G-bins of P* is at most the total weight of second and third pieces in G-bins of P. 0

The remainder of this section proves the result for cases (a) and (b). The next section proves the result for cases (c) and (d).

Case (a). a < x < ). We will show that all of (i)-(v) hold for W*. In this case, W* is given by Table 2. Obviously, there is at most one transition bin in P outside of G. From the discussion of W*, we see that all bins of P - G except for this transition bin and the final bin contain total weight at least one, and w* 2 IPI - 2, giving (i). For (ii), suppose B 6C G. The maximum weight of any piece in B is i. Therefore, if B contains at most two pieces, W*(B, P*) Q 2(f) = 1. Suppose B contains three pieces, p1 2

P2 a P3. Then p2 Q (1 - x)/2, since otherwise p1 + p2 + p3 > 2((1 - x)/2) + x = 1, and W*(B, P*) Q i + 2(i) = g. Consequently, (ii) holds.

TABLE 2 Weighting Function for Case (a)

i R, 4

2 [x,(1 - xv21

1 ((1 - x)/2,f] i

0 ct.11 1

A NEW PROOF FOR FIRST-FIT 55

TABLE 3 Weighting Function for Case (b)

i R, K

5 [dl 1

4 (f,(l - x)/3] ;

3 ((1 - x)/3,;] f

2 ;p -;:“j $ 1 1 x 2,: i

2

0 (hl] 1

By the definition of IV, (iii) holds. By Lemma 1, (v) holds. Since there are no third pieces, (iv) holds. In summary, all of (i)-(v) hold, and from above, these prove the theorem for this case.

Case (b). & < x < 5 and there is no regular piece in ((1 - x)/4, i]. Again, we define a weighting function W such that all of (i)-(v) hold. Define W by W( y ) = w*( y ) for y > $, and W( y ) = 4 for y < i. Thus, W is given by Table 3. By the proof for W*, a regular bin of P with regular pieces > $ contains total weight at least 1. For a regular bin with regular pieces < a, the definition of this case implies that the regular pieces are actually < (1 - x)/4, and the bin contains 5 pieces of weight i. Thus, every regular bin of P contains a total weight at least 1. Recall that the density of a piece is its weight divided by its size. Dividing each weight by an upper bound on piece size for that weight shows that every piece has density at least t. Since each bin except the last is at least $ full, each bin except the last contains weight at least ($)($) = 3. Since at most 4 transition bins and thelastbincanhaveweight <l,w> FFD(L)-4(&)-l >FFD(L)-3. Thus, (i) holds for this case.

By the definition of W and Lemma 1, (iii) and (v) hold. Since every third piece in a bin of G has weight f, (iv) holds. A case analysis will show that for every bin B @ G, W(B, P*) d 2, proving (ii).

So let B @ G. For 1 < i < 5, case i will assume that B contains i pieces PI, P2,. e-3 pi with p, > p2 > . . . > p;.

Cases 1,2. B has at most two pieces in P*. Then W( B, P*) < 2(i) = 1. Case 3. B has 3 pieces in P*. If p2 < f, then W(B, P*) Q $ + 2(f)

= 3. Suppose p2 > f and p1 G (1 - x)/2. Since p3 6 f, W(B, P*) d 2( 4) + f = $$. Finally, suppose p2 > f and p1 > (1 - x)/2. Since p1 + p* + (1 - x)/3 > (1 - x)/2 + 4 + (1 - x)/3 = ; - (;)x > 8 - (2)(i) = 1, p3 < (1 - x)/3. Since 2((1 - x)/2) + x = 1, p2 < (1 - x)/2. Therefore, W( B, P*) 6 f + 3 + & = 2.

56 BRENDA S. BAKER

Case 4. B has 4 pieces in P*. If pz d a, then W(B, P*) < f + 3(i) = B. Suppose p2 > + and p1 > 3. Since 2(i) + 2x > : + I!(&) ’ 1,p2 < f. Since (1 - x)/2 + + + 2x = + + (5)X > + + <$>(&) > 1, p1 d (1 - x)/2. Since + + + + x = 2 + x > 1, pj < a. Therefore, W(B, P*) < 5 + f + 2(t) = Q. Finally, suppose p2 > $ and p1 < f . Since 3((1 - x)/3) + p4 a i - x + x = 1, p3 & (1 - x)/3. Also, p4 < $. Therefore, W(B, P*) < 2(f) + 6 + f = g.

Case 5. P has 5 pieces in P*. Since f + p2 + p3 + p4 + ps > f + 4x >+-t+>l, pl<*. Since $+p,+p4+ps>,3+3x>f+&>L p2 < $. Therefore, W(B, P*) < g + 4(i) = 8.

Thus, all of (i)-(v) hold, proving the theorem for this case. 0

4. THE HARD CASES

We are now left with cases in which we are forced to deal with third pieces of weight i. Not only can an individual G-bin have total weight greater than y in P *, but it is possible that W(G, P*) - W(G, 2, P) - W(G, 3, P) > ($!)lGI because of the pieces of weight a that are third pieces in P*. Fortunately, we will be able to show that excess weight in G-bins is balanced by weight at most 2 in bins not in G.

LEMMA 2. Let W be a weighting junction. Suppose G can be partitioned into subsets A and A- with the joilowing properties:

(1) W(G, P*) - W(G,2, P) - W(G,3, P) < ++?-Jq + ;IAI;

(2) for each B E A, B contains at least two pieces in P, p(B, 2, P) > i, and p(B, 2, P) is not packed in a G-bin in P*;

(3) ijS = { p(B,2, P)IB E A}, and for any non-G-bin B, s(B) denotes the number of pieces of S that are packed in B in P*, then

W(B, p*) f 3 ifs(B) < 1,

<g ifs(B) = 2,

r8 ifs(B) = 3, f!l

f 60 ifs(B) = 4.

Then w < vOPT(L).

Proof. For 0 6 i Q 4, let ri denote the number of bins containing exactly i pieces of S in P*. Since each piece of S is > 4 by (2), no more than 4 pieces of S can fit in any bin. Therefore [A( = Xfplirt and IP* - GI

A NEW PROOF FOR FIRST-FIT

= CfS,,ri. Furthermore,

57

= ++lGl + YIP* - GI.

= yloPT( L) I. q

In the whole proof of the theorem, the exact fraction y arises only from the occurrence of the term (2 + 2($))r, = 3(y)r2 in the above proof of Lemma 2.

In each of the remaining two cases, the result will follow from obtaining a set A satisfying Lemma 2 and showing that W > FFD(L) - 3. In each case, G-bins (including bins in x) may have third pieces of weight a. To deal with these, we need to tighten Lemma 1, which states that the total weight of second pieces in G-bins of P* is at most the total weight of second and third pieces in G-bins of P. Intuitively, the proof of Lemma 1 showed that a second piece in P* of weight at least w may be selected from second or third pieces in G-bins of P, or from non-G-bins of P at the expense of moving some other second piece of weight at least w from a G-bin of P to a non-G-bin of P*. We want to show that in calculating the number of these pieces, we can exclude second pieces of P that are not in G-bins in P* and are replaced in P* by second pieces of weight less than w in the same bin. After proving this for each weight, we will bound the total weight of all second pieces in P* to get a stronger version of Lemma 1.

LEMMA 3. Let W be a weighting function, and c. a weight. The number of second pieces of weight at least w. in G-bins of P* is at most the number of second and third pieces of weight at least W, in G-bins of P minus (L,I, where L, is the set of G-bins B such that

(1) the secondpiece in B in P has weight at least y,

(2) the secondpiece in B in P* has weight less than Wi, and (3) the second piece of B in P is not packed in a G-bin in P*.

58 BRENDA S. BAKER

Proof. The proof is a more refined version of the proof of Lemma 1. First, suppose that all pieces of weight at least W, and size at most 4 are

packed in G-bins of P. Since x > 3, these are all second or third pieces. The number of pieces of weight at least Wi packed in non-G-bins in P* is at least (~5~1. Since these pieces are not second pieces in G-bins of P*, the lemma follows in this case.

Now, suppose that there is a smallest piece p of weight at least Wi and size at most 4 that is not packed in a G-bin in P. Divide the G-bins into three groups:

(1) 4% (2) GP, the set of G-bins that have second pieces > p in both P and

P*, and (3) G - Li - Gp.

If a G-bin B contains a second piece 2 p in P*, then the first piece in B has size at most 1 - p, and B also contains a second piece of size at least p in P. (Otherwise, p would have been packed in B.) Thus, the number of second pieces > p in P* is at most the number of second pieces of weight at least y in GP in P.

Each second piece q in a G-bin of P* of size < p but weight Wi is packed in a G-bin of P by definition of p. Now, q cannot be a second piece in a bin of Li in P, since such pieces are not in G-bins in P* by definition of Li. It also cannot be a second piece in a bin of GP in P because of its size. In P, therefore, q is either a third piece in a G-bin, or is a second piece in a bin of G - Li - Gp.

From the concluding sentences of the preceding two paragraphs, we find that the number of second pieces of weight at least K in P* is at most the number of third pieces of weight at least Wi in G-bins of P plus the number of second pieces of weight at least w in G - L, in P. This and the fact that every bin of L, has a second piece in P imply that the number of second pieces of weight >, W, in P* is at most the number of second and third pieces of weight 2 W; in G-bins of P minus 1.&l. 0

Let L be the union of the Lj’s. Lemma 3 suggests that we should be able to strengthen Lemma 1 by subtracting off for each B in L the difference in the weights of its second pieces in P and P*. Some algebra will be needed to apply Lemma 3 to get this result, since the Li’s of Lemma 3 are not disjoint. To this end, define tii, i < j, to be the number of G-bins B such that

(a) the second piece of B in P has weight Wi,

(b) the second piece of B in P* has weight I+$ and (c) the second piece of B in P is not packed in a G-bin in P*.

A NEW PROOF FOR FIRST-FIT 59

In addition, we want to strengthen Lemma 1 further by subtracting off W(X) from each third piece in P. To motivate doing this, note that every bin that has a second piece in P* also has a second piece in P. Intuitively, the first W(x) of a second piece in P* is matched by the first W(x) of a second piece in P, and the remaining weight is matched by the excess over W(x) of either a second or a third piece in P. This argument is made precise in the proof of Lemma 4.

LEMMA 4 (STRONGER VERSION OF LEMMA 1). Let W be a weighting junction. Let v be the number of third pieces in G-bins of P. The total weight of second pieces in G-bins of P* is at most the total weight of second and third pieces in G-bins of P minus A, where

m-l

h = VW(X) + C C t;j(Wi - Wj). ;=1 j>i

Proof. Suppose W has weights &, 1 < i < m. Let di and dt be the number of second pieces of weight W;. in G-bins in P and P*, respectively. Let vi be the number of pieces of weight W; that are third pieces in G-bins of P.

The key to applying Lemma 3 is to express weights in terms of the difference of successive weights Wj and Wj+l, so that algebra can be used to handle the nondisjointness of the Li’s in Lemma 3. Thus, we have

W(G,2, P*) = t d;y j=l

= W,; di’ + f d;Lmfl(w, - y+l) j=l j=l i=j

= W, 2 dy + m&w; - Wi+l) c d,? j=l i=l j<i

Rephrasing Lemma 3 in terms of the new notation, we have that for any i,

c d,* < c dj + c vi - c c tjk. j<l j<i j9i j<i k>i

Every G-bin containing a second piece in P* also contains a second piece in P. Therefore,

Ed,?< Ed,. j=l j=l

60 BRENDA S. BAKER

Combining the latter two inequalities with the previous equation, we have

W(GJ, P*) < W, F d,

m-1

+ ;FICw,- W+l) Cdj+ C’J- C Ct,k . j<i j<i j<i k>i 1

By applying additional algebraic transformations to the dj’s, uj’s, and tjk’s as we did above for the dj’s but in the reverse direction, we obtain

W(G,2, P*) < f d,W, + m&(w, - W,) - mc’ c tij(w, - Wj). i=l i=l I=1 j>i

= W(G,2, P) + W(G,3, P) - uW(x)

m-l

- .c- c tij(K - q. i=l j>i

In order to obtain the sets A and z needed for Lemma 2, we need to group certain bins according to where their second pieces in P end up in P*. For i, j > 0, define a bin to be an ij-bin if it is a G-bin containing exactly i pieces in P and exactly j pieces in P*. For any G-bin B, define TO(B) to be the bin containing p( B, 2, P) in P*, and define

FROM( B) = { B’ 1 B’ is a 23-bin of G with TO( B’) = B } .

Note the restriction to 23-bins. Also, note that for B E G, 1 FROM( B)I < 2. For B E G, define T(B), the tree rooted at B, to be the smallest set such

that B E 7’(B) and for any B’ E T(B), FROM(B’) c T(B). A tree is illustrated in Fig. 1. For B’ E T(B), FROM( B’) is the set of children of B’ in the tree, and if B’ # B, TO( B’) is the parent of B’. We will show that G can be partitioned into sets of trees, and that except for the trees of bins in A, these trees will have average weights of at most y per bin under the weighting functions in cases (c) and (d).

LEMMA 5. Let B bea 23-bin of G. Thenp(B,2, P*) <p(B,2, P).

P( B3,ZP) PC k&P) PIGV)

Trn B3 BZ Bl B

FIG. 1. Part of an FFD packing P illustrating T(B) for a bin B, where FROM(B) = { B, ), FROM( B, ) = ( B,, B, ), tree (B) = ( B, B,, B,, B3 ), and arrows indicate where pieces end up in P*.

A NEW PROOF FOR FIRST-FIT 61

Prook Suppose p( B, 2, P) < p( B, 2, P*). Since B contains three pieces in P* and its first piece is the same in P and P*,

and B must have three pieces in P. 0

The following lemma is a key result because it allows us to bound the size of trees (Corollaries 6.1 and 6.2). Bounding the size of trees will be helpful because each tree in x will contain at least one bin whose weight is not a problem, because either (1) it has no third piece in P*, (2) its third piece has weight i, (3) it also has a third piece in P, or (4) it contributes to t,j for some i and j. As long as the tree containing this bin is not too large, this bin will keep the average weight low for the bins in the tree.

LEMMA 6. If B and TO(B) are 23-bins, then p(TO(B), 2, P) > p(B, 2, P*) + p(B, 3, P*), and either (1) TO(TO(B)) 4 G, or (2) TO(TO(B)) E G and TO(TO(B)) has at most two pieces in P*.

Proof: By definition of TO(B), p( B, 2, P) is either the second or third piece in TO(B) in P *. By Proposition 1, p(B, 2, P) G p(TO(B), 2, P*) -K p(TO( B), 2, P), implying that p(TO( B), 2, P) was packed by FFD before p(B, 2, P). Since x didn’t fit with p(B, 1, P) and p(B, 2, P) in B in P, p( B, 1, P) + p( B, 2, P) + x > 1. Since a third piece fits with p(TO( B), 1, P) and p( B, 2, P) in P*, p(TO( B), 1, P) + p( B, 2, P) + x Q 1 and p(B, 1, P) > p(TO(B), 1, P), i.e., B is a lower-numbered bin than TO(B). Since p(TO(B), 2, P) was packed before p(B, 2, P) but was not packed in B in P, p(B, 1, P) + p(TO(B), 2, P) > 1. Consequently, p(TO( B), 2, P) > p( B, 2, P*) + p( B, 3, P*). Since $ 4 p(TO( B), 2, P) + x > i + 3x > i + 3(h) > 1, p(TO(B), 2, P) cannot fit in a G-bin contain- ing a third piece in P*. q

Define the depth of a tree r(B) to be one if T(B) = {B}, and 1 + max B, E rROM(sj depth (T( B’)) otherwise.

COROLLARY 6.1. No tree has depth more than three. If a G-bin B has three pieces in P*, then T(B) has depth at most two.

Prooj: Recall that the definition of FROM restricts FROM(B) to 23- bins. If some tree has depth more than three, then for some B, TO(TO(B)) is a 23-bin, which is impossible by Lemma 6. Similarly, if B has three pieces, then by Lemma 6 there is no 23-bin B’ such that TO( B’) is a 23-bin and B = TO(TO( B’)). 0

COROLLARY 6.2. Let B E G. If B has 3 pieces in P*, then (T( B)I < 3. If B has 2 pieces in P*, then IT(B)1 < 4.

62 BRENDA S. BAKER

Proof If B has 3 pieces in P*, then T(B) = {B} U FROM(B) by Corollary 6.1. Since [FROM(B)1 < 2, IT(B)1 < 3. If B has two pieces in P*, then T(B) has depth at most three by Corollary 6.1. Since 1 FROM( B)I < 1 and 1 FROM(B’)l < 2 for B’ E FROM(B), lT( B)I < 4. 0

Next, we define sets D, E, X, and Y of G-bins whose trees partition G. These sets are defined as follows:

(1) D is the set of 33-bins of G;

(2) E is the set of G-bins with at most two pieces in P*;

(3) X is the set of 23-bins B of G such that TO(B) e G and p(B, 2, P) > (1 - x)/2;

(4) Y is the set of 23-bins B and G such that TO(B) 4 G, and p(R 2, P) < (1 - x)/2.

LEMMA 7. T(D), T(E), T(X), and T(Y) form a purtition of G.

Proof: First, we show that every G-bin is in T( D U E U X U Y). There are no 12-bins or 13-bins, since any G-bin with more than one piece in P* could hold a second piece of size x in P. Consequently, every G-bin is in D u E U X u Y except possibly for 23-bins B such that TO(B) E G. So suppose B is such a bin. If TO(B) E G but TO(B) is not a 23-bin, then TO(B) E D u E and B E T( D U E). If TO(B) is a 23-bin, then by Lemma 6 either TO(TO(B)) 4 G, or TO(TO(B)) is a G-bin with at most two pieces in P*. In the former case, TO(B) E X U Y and B E T( X U Y).

In the latter case, TO(TO(B)) E E and B E T(E). Note that D, E, X and Y are disjoint sets. Since TO is a function, their

sets of trees must be disjoint. Therefore, the sets of trees partition G. q

In cases (c) and (d), the set A that will satisfy Lemma 2 will be a subset of Y. In order to analyze the weights of non-G-bins to show that A satisfies property (3) of Lemma 2, it will be necessary to show that the second pieces in the bins of A have a limited range of weights. The following lemma will be helpful.

LEMMA 8. Let B,, B2 E Y. If p(B,, 3, P*) > (1 - x)/4, then p(B,, 2, P) a PC&, 2, p*).

Proof: Suppose to the contrary that p( B,, 2, P) < p( B,, 2, P*). First, suppose p(B,, 1, P) z p(Bz, 1, P). In this case, p(B,, 1, P) +

p(B,, 2, P) + x < p(B,, 1, P) + p(B,, 2, P*) + x d 1 since B, is a 23-bin. But then, B, must have 3 pieces in P, and it is not a 23-bin.

On the other hand, suppose p(B,, 1, P) > p(B,, 1, P), i.e., B, is a lower-numbered bin than B,. Since p(B,, 2, P) < p( B,, 2, P*) < p(B,, 2, P) by Proposition 1, and p(B,, 2, P) was not packed in B, in P, p( B,, 2, P) must not have fit in B,, i.e., p(B,, 1, P) + p(B,, 2, P) > 1. But B, holds

A NEW PROOF FOR FIRST-FIT 63

TABLE 4 Weighting Function for Case (c)

i Ri 4 I [X*Z> 1 5 6 [z,(l - zv31 1

5 [(I - z)/3,(1 - x)/31 d

4 (Q-XV39 +I L T

3 (b (1 - w] 3 8

2 ((1 - z)/&(l - x)/2] f 1 ((1 - XP>f] 1 * 0 (91 1

p(B,, 1, P) and two pieces > (1 - x)/4 in P*, implying p(B,, 2, P) > 1 - p(B,, 1, P) 2 2((1 - x)/4) = (1 - x)/2, contradicting the upper bound on p (B,, 2, P) in the definition of Y. 0

The above results make it possible to handle the two remaining cases.

Case (c). & < x < $ and there is a regular piece in ((1 - x)/4, $1. Let z be the smallest regular piece in ((1 - x)/4, $1. Note that $ < (1 - x)/4 < z < + 6 (1 - z)/3 < & < (1 - X)/3 < + < 2 < (1 - z)/2 < f ( (l- x)/2 < 8. Define W by Table 4.

This weighting function is constructed such that in each bin, for some j either there are j regular pieces of weight l/j, or there are j regular pieces of weight (1 - W(x))/j and a fallback piece of weight at least W(x), or there are j regular pieces of weight (1 - W(z))/’ and a fallback piece of weight at least W(z). Therefore, every regular bin @ G contains a total weight of at least 1. Every G-bin a has first piece of weight 1. Note that the weights $ and ; would need to be larger if this case did not require the existence of a regular piece (and hence potential fallback pieces) of size z. Larger weights would unfortunately cause problems in obtaining condition (3) of Lemma 2.

Recall that the density of a piece p is W( p)/p. Dividing each weight by an upper bound on piece sizes with that weight shows that every piece has density at least $. Since x < , -5, each bin except possibly the last is at least $ full, and the total weight in each bin except the last is at least ($)($) = $. Consequently, the shortfall (amount by which the total weight falls short of 1) for each transition bin is at most 6. Since there are at most 6 transition bins outside of G and the last bin has weight at least $, w > FFD(L) - 6(&) - $ > FFD( L) - 3.

64 BRENDA S. BAKER

The remainder of the proof of this case identifies a set A c G satisfying Lemma 2, implying that w d (y)OPT( L). Recall that Y is the set of 23-bins B of G such that TO(B) @ G and p( B, 2, P) < (1 - x)/2.

Let Z be the set of bins B in T(Y) such that p(B, 3, P*) < z. We claim that T(Y) - Y c Z. For suppose B E T(Y) - Y and B P Z. By Corollary 6.1, the trees of bins in Y have depth at most two. Hence, TO(B) E Y. But by Lemma 6, p(TO(B), 2, P) > p(B, 2, P*) + p(B, 3, P*) a 2z > (1 - x)/2, implying TO(B) 4 Y.

Let A be the set of bins B E Y - Z such that either

(1) ~(4 2,0, P(B, 2, p*) E R, u R,, or

(2) PCB, 2, P), p(B92, P*) E R, u R, u R,.

We claim that either all bins of A satisfy (1) or all bins of A satisfy (2). For otherwise, there would be bins B, and B, in A such that p(B,, 2, P*) > p(B,,2, P) and p(B,,3, P*) > z > (1 - x)/4, violating Lemma 8.

Let J be the set of bins B E Y - Z such that p(B, 2, P) E U:==ZRi and p( B, 2, P*) E R, u R,.

By the definitions of Y and Z and Proposition 1, for B E Y - Z, (1 - x)/2 2 p(B, 2, p) > p(B, 2, P*) > p(B, 3, P*) 2 z, implying that p(B,2, P),p(B,2, P*)EU~-,R,. Moreover, byPropositionl,if p(B,2, P) E Ri and p( B, 2, P*) E Rj, then j >, i. Therefore, Y - Z = A U J. By the above and Lemma 7, 7’(D), T(E), T(X), Z, A, and J partition G.

Note that every bin in D contains a third piece of weight at least f in P, every bin in Z contains a third piece of weight exactly i in P*, and bins in E contain no third pieces in P*. Other bins can have a third piece of weight at most 4 1 in P*. Consequently,

W(G,3, P*) - W(G,3, P) G fIT( - flDl + @@)I - iFI

+$IT(X)l + $lJl + flZl + $41. (1)

Recall that

for i < j. By the definition of tij and J,

2 i tij 2 IJI. i=2 j=5

Recall that X is the set of 23-bins such that TO(B) 4 G and p( B, 2, P) > (1 - x)/2. Since each B E X contains three pieces in P*, p( B, 2, P*) < f

A NEW PROOF FOR FIRST-FIT 65

- x < 3. Therefore,

c hk a VI*

k>l

As in Lemma 4, let ui denote the number of pieces in Ri that are third pieces in G-bins in P. Since all third pieces have size at most $ < (1 - z)/3, ui = 0 for i # 6,7. By the observations above, Lemma 4, and the definitions of ui and W,

J+‘(‘W,P*) 4 W(GJ,P) + u6(& - w,) - ; c tjk(w; - w,) i=l k>i

By Corollary 6.2, IT(D)1 Q 3101, IT( < 4lEI, and IT(X)1 < 31x1. Combining formulas (1) and (2) and applying these inequalities gives

W(G,P*)- W(G,2,P)- W(G,3,P)

< W(G,l, P*) + $lT(D)l +($j - ,)I01 + $IT(E)I +(& - i)IEI

+ WWI - &IX1 + $Jl - &lJI + $1z1+ $41

Q IGI +(a - &#‘@)I +(a - 6)lT(E)I +(a - &)IT(X)I + +$fI + )lzl+ $4l

( $lG - Al + &II.

We claim that A satisfies the conditions of Lemma 2. We have just shown that A satisfies condition (1). By definition of A, each bin in A has a second piece in P of size at least z, and this piece is not packed in a G-bin in P*. Since z > t, A satisfies condition (2) of Lemma 2. As in the statement of condition (3), let S = { p(B,2, P)IB E A}, and define s(B) to be the number of pieces of S in B, for B 4 G. From above, either every piece of S is in R, U R, U R,, or every piece of S is in R, U R,. A case analysis will show that A satisfies condition (3). For 1 Q i Q 5, Case i and its subcases will bound W( B, P*) for each bin B @ G such that B contains exactly i pieces in P*. In case i, the i pieces of B in P* will be denoted by pj, l<j<i,withp,>p,> a.. zpi.

66 BRENDA S. BAKER

Cases 1,2. B has at most 2 pieces in P*. Then W( B, P*) < 2( t> = 1 and s(B) < 2.

Case 3. B has 3 pieces in P*. Since 2((1 - x)/2) + x = 1, p2 < (1 - x)/2. Also, p3 < ).

Case 3a. p1 > (1 - x)/2 and p3 > (1 - x)/3. Since p1 + 4 + p3 > (1 - x)/2 + f + (1 - x)/3 = i - (2)x > 1, p2 d i. Therefore, w(B, P*) Q 3 + 2(i) = $. Since p1 > (1 - x)/2, p1 4 S, and s(B) < 2.

Case 3b. p1 > (1 - x)/2 and p3 < (1 - x)/3. From above, p2 < (1 - x)/2. Therefore, W(B, P*) < i + 3 + & = 8. Since p1 @ S, s(B) Q 2.

Case 3c. p1 G (1 - x)/2. Since p3 < 4, W(B, P*) Q 2(3) + f = %. Also, s(B) < 3.

Case 4. B has 4 pieces in P*. Case 4a. p1 > (1 - x)/2. Since x Q 4, (1 - x)/2 > $. Since p1 + +

+ pj + p4 >, (1 - x)/2 + a + 2x > 3 + a + fi > 1, p2 d 4 < (1 - z)/3. Since p1 + 22 + p4 > (1 - x)/2 + 2((1 - x)/4) + x = 1, P3 < Z. Therefore, W(B, P*) < 4 + i + 3 = $. Since pl, p3, p4 @ &s(B) G 1.

Case 4b. (1 - x) 2 > p1 > ; and p2 > (1 - x)/3. Since p1 + p2 + a +p4 > f + (1 - x)/3 + $ + x >, fi + (5)x >B + (3)(k) ’ 1, p3 < i Q (1 - 2)/3. Since p1 + p2 + 2((1 - x)/4) > ) + (1 - X)/3 + (1 -x)/2 = 2 - (2)~ 2 1, p4 6 (1 - x)/4 < I. Note that p1 or p2 cannot be in S at the time as p3, and p4 @i S. Therefore s(B) d 2.

Since $ + p3 + p4 2 3 + 2x > 1, p2 < $. Since (1 - z)/2 + p2 + z + p4 > (1 - z)/2 + (1 - x)/3 + z + x = 2 + z/2 + 2x/3 >, 2 + 7x/6 > 2 + (i)(h) > 1, either p1 Q (1 - z) /2 or p3 c z. In the former case, W( B, P*) Q $ + f + a + f < G. In the latter case, W( B, P*) Q $ + )+$=j$.

Case 4c. (1 - x)/2 > p1 > f and (1 - x)/3 > p2 > (1 - z)/3. Since p1 + f + p4 >, + + + + & > 1, p3 < a < (1 - z)/3. Thus, W(B, P*) < f + 6 + 2(i) = g. since p1 + p2 + 22 > f + (1 - z)/3 + 22 = 3 + 5z/3 > 3 + + = 1, p4 < z. Since p4 4 S and p1 cannot be in S along with p2 or

~3, s(B) G 2. Case 4d. (1 - x)/2 2 pi > i and (1 - z)/3 > p2. Note that p1 can-

not be in S at the same time as p2, p3, or p4. If p4 < z, then S(B) < 2 and W(B, P*) G 3 + 2(f) + j = $$. Suppose p4 Z z. Since (1 - z)/2 + p2 + p3 + p4 > (1 - z)/2 + 32 = + + 5z/2 > 1, p1 < (1 - z)/2. So W(B, P*) < $ + 3($) = $ < $$ and s(B) Q 3.

Case 4e. f>pI>p2>(1-x)/3andp4>z. Since 3 ((1 - z)/3) + z = 1, p3 < (1 - z)/3 6 (1 - x)/3. Therefore, p3 and p4 cannot be in S along with p1 or p2 and s(B) < 2. Also, W(B, P*) Q 2(i) + 2(a) = g.

Case 4f. fap1ap2>(1-x)/3andp,<z. Since3((1-x)/3)+ x = 1, p3 G (1 - x)/3. Since p1 and p2 cannot be in S along with p3 or p4, s(B) < 2. Also, W(B, P*) G 2(i) + & + i = 8.

A NEW PROOF FOR FIRST-FIT 67

Case4g. f 2 pr > (1 - x)/3 z p2. Since p1 + 2 2 (1 E- x/3 > $ - & > 1, p4 < $ < (1 - z)/3. Therefore, + 2(A) + a = g. Since p1 cannot be in S along with s(B) < 3.

Case 4h. p1 Q (1 - x)/3. Since B contains 4 pieces, z)/3, and W(B, P*) 4 3(A) + $ = $$. Also, s(B) Q 4.

Case 5. B has 5 pieces in P*. Case 5a. p2 < z. Since 4 +p2 + pj + p4 + ps > f + 4x

- x)/3 + ; = W(B, P*) < f

P27 Ps, or P47

p4< + <Cl--

> * + 4(A) > l,p, < f. Consequently, s(B) 6 1 and W(B, P*) d $ + 4(i) = 8.

Case 5b. p2 3 z. Since (1 - z)/3 + p2 + p3 + p4 + p5 > (1 - z)/3 + z + 3x = 8 + 2z/3 + 3x > f + (s)(i) + 3(h) > 1, pr < (1 - z)/3. Since 42 + x > 4((1 - x)/4) + x = 1, p4 < z. Therefore, W(B, P*) < 3($) + 2(t) = Q. We claim that pj e S. For suppose otherwise. By definition of S, p3 = p( B’, 2, P) for some 23-bin B’ whose smallest piece in P* is > z > (1 - x)/4. Let a be the first piece in B’. Since B’ is a 23-bin, a + p3 + x > 1. But a + 2((1 - x)/4) Q 1. Therefore p3 > 4 - 3x/2. But from B we have 3p, + 2x 6 1. Consequently, f - 3x/2 < pJ G (1 - 2x)/3, or i c 5x/6, contradicting x < ). Therefore p3 e S and s(B) ( 2.

This completes the proof of Case (c). 0

Case (d). + < x d $. Let y be the smallest regular piece in ((1 - x)/3, i] if such a piece exists, and $ otherwise. Note that a ( (1 - x)/3 < y < 4 < (1 - y)/2 < + & (1 - x)/2 < 4. Define a weighting function W by Table 5.

Every bin of G contains a first piece of weight 1. As before, in each regular bin, for some j there are either j pieces of weight l/‘, or j pieces of weight (1 - W(y))/j and a fallback piece of weight at least W(y), or j pieces of weight (1 - W(x))/j and a fallback piece of weight at least W(x). Note that the density of every piece is at least $ and that every bin except the last is at least a full. Therefore, every bin except the last has weight at

TABLE 5 Weighting Function for Case (d)

i 4 K

4 [X!Y> 1

3 [Y,Q -yPl f 2 ((1 -Yv2,(1- xv21 i 1 L * 0 1

68 BRENDA S. BAKER

least (i)(z) = 6. The shortfall for the (at most 3) transition bins and the last bin is at most 3(s) + 1 < 3, and consequently w 2 FFD(L) - 3.

This case will be completed by showing the existence of a set A c G that satisfies Lemma 2. Recall that Y is the set of 23-bins B such that TO(B) 4 G and p(B, 2, P) < (1 - x)/2. We claim that for B E Y, T(B) = B. For suppose otherwise. If B’ is a 23-bin with TO(B’) = B, then

p( B, 2, P) > 2x > $ > (1 - x)/2 by Lemma 6. But then B 4 Y. We con- clude that Y = T(Y), and by Lemma 7, T(D), T(E), T(X), and Y partition G.

Let A be the set of bins B in Y such that for some i E {2,3,4}, both p(B, 2, P), p(B,2, P*) E Rj. Let I be the set of bins B in Y with p(B,2, P) E R, and p(B,2, P*) E R, U R,. Let J be the set of bins B in Y with p(B,2, P) E R, and p(B,2, P*) E R,. By Proposition 1, for any bin B E Y, p( B, 2, P) > p( B, 2, P*). Consequently, if p( B, 2, P) E Ri and p( B, 2, P*) E Rj, then j 2 i. Also, by definition of Y, for any B E Y, p(B, 2, P) & (1 - x)/2, implying that p(B,2, P) E R, for some i a 2. Therefore, A, I, and f partition Y.

Since third pieces always have weight $, bins of D have three pieces in P, and bins of E have no third piece in P*, we have

W(G,3, P*) - W(G,3, P) d iIT - flDl + $IT(E)I

- SIEI + $IT( X)1 + +lYl. (3) Recall that

tij=l{BE GlTO(B)@ G,~(B,~,P)E R;,andP(B,2,p*)~ R,}I

for i 9 j. By the definitions of I and .J, t,, + t,, z 111 and t,, 2 1./l. Since each bin B E X has three pieces in P*, p(B, 2, P*) < t - x < (1 - x)/2,

while by definition of X, p( B, 2, P) > (1 - x)/2. Therefore,

c t1, 2 1x1. k>l

Noting that every third piece is in R, and applying Lemma 4 and the above observations, we have

W(G,2,P*)< W(G,27P)- i Ct,(Wi- y) i-l j>i

< J+‘(W, P) - c t,,(Wl - w,) k>l

- i bk(K - w,) - t3,(W, - w,) k-3

< W(G,2, P) - $X1 - hII1 - 6151. (4)

A NEW PROOF FOR FIRST-FIT 69

By Corollary 6.2, IT(D)! d 3(0(, IT(E)! < 4(E(, and IT(X)I Q 31x1. Corn- bining the above inequalities and formulas (3) and (4), we have

W(G,P*) - W(G,2,P) - W(G,3,P)

+ ~1~(x)1 - g/xi + 4111 - Blrl + $lJl - hlJl + aI4

( IGI +(a - h)IT(@I +(i - &)IT(E)l

+(a - $)lqx)l+ &I4 + ilJl+ $14

< +fif-(G - Al + $41.

From above, A satisfies conditions (1) and (2) of Lemma 2. Let S = { p( B, 2, P) lB E A}. Recall that a bin in A has second pieces in the same Ri in both P and P*. Since every piece is larger than 5 > (1 - x)/4, Lemma 8 implies that for B,, B, in A, p(B,, 2, P) > p(B,, 2, P*) and p( B,, 2, P) 2 p( B, 2, P*). Therefore, B, and B, must have second pieces in the same Ri. Consequently, for some i E { 2,3,4}, every piece in S is in Ri. A case analysis of bins B $5 G will verify condition (3) of Lemma 2. Case i will assume that B contains i pieces pl, p2,. . . , pi in P*, with p1 > p2 > . . . >, pi.

Cases 1,2. B has at most 2 pieces in P*. In this case, W(B, P*) < 2(+) = 1 and s(B) < 2.

Case 3. B has 3 pieces in P*. First, suppose p2 > (1 - y)/2. Since 2((1 - x)/2) + pj a 1 - x + x = 1, p2 < (1 - x)/2. Since p1 + p2 + y > 2((1 - y)/2) + y = 1, p2 < y. Therefore, W( B, P*) Q $ + $ + a = z < $$. Since p2 and pJ cannot both be in s, s(B) 6 2.

So we may assume pz $ (1 - ~)/2. Suppose that p1 > (1 - x)/2. Then W( B, P*) < 4 + 2(4) = g. Since p1 4 S, s(B) < 2. Finally, suppose that p1 Q (1 - x)/2. Then W(B, P*) < i + 2(f) < g and s(B) d 3.

Case 4. B has 4 pieces in P*. If y > pl, W(B, P*) d 4(f) = 1 and s(B) < 4. So we may assume that p1 >, y. Suppose that y > p2. Since (l-x)/2+p,+p,+p,>(l-x)/2+3x=++5x/2>1, pl<(l- x)/2. SO W( B, P*) < 4 + 3($) = i < g and s(B) < 3. Finally, suppose that p2 2 y. Since 3y + p4 > 3((1 - x)/3) + x = 1, p3 < y. Since (1-y)/2+pz+p3+p4a(1-y)/2+y+2x=5+y/2+2x>t+ 5x/2 > 5 + ($)(+) = 1, p1 < (1 - y)/2. So W(B, P*) Q 2(;) + 2($) = 8. Since pl, p2 > y and p3, p4 < Y, s(B) G 2.

This concludes the proof of Case (d) and of the main theorem. 0

70 BRENDA S. BAKER

ACKNOWLEDGMENTS

The author would like to thank M. R. Garey and D. S. Johnson for their comments.

REFERENCES

1. D. S. JOHNSON, “Near-Optimal Bin Packing Algorithms,” Doctoral thesis, MIT, Cambridge, Mass., 1973.

2. D. S. JOHNSON, A. DEMERS, J. D. ULLMAN, M. R. GAREY, AND R. L. GRAHAM, Worst-case

performance bounds for simple one-dimensional packing algorithms, SIAM J. Comput. 3, No. 4 (1974), 299-325.