Operations Research Letters 18 (1996) 193~199
ELSEVIER
Probabilistic
analysis of a bin covering algorithm’
Sunan Han, Dawei Hong, Joseph Y-T. Leung* Department
of’ComputerScience and Engineering, Universiy of Nebraska - Lincoln. Lincoln, NE 68588-0115, LISA Received 1 January 1995; revised 1 August 1995
Abstract
In the bin covering problem we are asked to pack a list X(n) = (x1, x2, . ,x,) of n items, each with size no larger than one, into the maximum number of bins such that the sum of the sizes of the items in each bin is at least one. In this article we analyze the asymptotic average-case behavior of the Iterated-Lowest-Fit-Decreasing (IUD) algorithm proposed by Assmann et al. Let OPT(X(n)) denote the maximum number of bins that can be covered by X(n) and let ZLFD(X(n)) denote the number of bins covered by the ILFD algorithm. Assuming that X(n) is a random sample from an arbitrary probability measure p over [0, 11, we show the existence of a constant d(p) and a constructible sequence {Z(n) E [0,11”: n > 11 such that I(ILFD(3(n))/n) - d(p)1 < l/n and lim,,, (ILFD(X(n))/n) = d(p), almost surely. Since (ILFD(X(n))/n) always lies in [0,11, it follows that lim,,, (E[ILFD(X(n))]/n) = d(p) as well. We also show that the expected values of the ratio r,,,,(X(n)) = OPT(X(n))/ILFD(X(n)), over all possible probability measures for X(n), lie in [l, $1, the same range as the deterministic case. Kqvwords:
Bin covering;
Bin packing;
NP-hard;
Heuristic;
Average-case
1. Introduction We consider the bin covering problem introduced by Assmann et al. [l] and stated as follows: Given a list of n items X(n) = (x1, . . ,x,), with each item having a size in [0, 11,pack X(n) into the maximum number of bins such that the sum of the sizes of the items in each bin is at least one. Since the problem is NP-hard, much effort has been devoted to the design and analysis of fast heuristic algorithms for it; see [2] for a survey. In particular,
*Corresponding author. ’ Research supported in part by the ONR Grant N00014-91J-1383 and in part by the CCIS of UNL. 0167-6377/96/$15.00 cc 1996 Elsevier Science B.V. All rights reserved SSDI 0167-6377(95)00053-4
analysis
there is an O(nlog2 n)-time heuristic, called the Iterated-Lowest-Fit-Decreasing (IUD) algorithm, proposed and analyzed for the problem [l]. Let OPT(X(n)) denote the maximum number of bins tht can be covered by X(n) and let ILFD(X(n)) denote the number of bins covered by the ZLFD algorithm. It was shown in [l] that ZLFo(X(n)) b $OPT(X(n)) - 1, for any list X(n). To the best of our knowledge, the 1LFD algorithm has the best worst-case bound. The main concern of this article is the average-case analysis of the ILFD algorithm. sample Let X(n) =(x1, .,. ,x,) be a random from an arbitrary probability measure 11over [0, 11. By the theory of superadditive processes [S], it is easy to show the existence of a constant ~(11) such
194
S. Han
et al. / Operations Research Letters 18 (1996) 193-199
that lim,, a (OPT(X(n))/n) = c(p), almost surely. Since OPT(X(n))/n always lies in [0,11, it follows that limn+co (E[OPT(X(n))]/n) = c(p) as well. We call c(p) the covering constant with respect to p, or covering constant in brief. Rhee and Talagrand [S] and Rhee [7] have given deep probabilistic analyses of optimal bin covering. In [7] the behavior of OPT(X(n)) for any point X(n) E [0,11”was studied. It was shown that OPT(X(n))
3 m(p) - D(X(n)) - K log2 Iz,
(1.1)
where ~(X(PZ)) = SUP {np([t, 11) - /{i < n:xi 3 t}l: 0 < t d l} and K is a universal constant no greater than 6. Csirik et al. [3] gave another elegant averagecase analysis of the bin covering problem. Assuming that X(n) is a random sample from the uniform distribution over [0,11, it was shown that E[OPT(X(n))] = n/2 + O(G) and E[NF(X(n))] = (n + 2)/e - 1 + o(l), where NF(X(n)) denotes the number of bins covered by the Next-Fit (NF) algorithm. Before we state the ILFD algorithm, we need to introduce the Lowest-Fit-Decreasing (LFD) algorithm which packs a given list X(n) = (x1, . . . ,x,) of IZ items into m bins as follows: After presorting the items in nonincreasing size, pack the items in order into the lowest level bin (with ties resolved by choosing the lowest indexed bin). The ILFD algorithm employs the LFD algorithm as a subroutine as follows: Conduct a binary search between predetermined lower and upper bounds for the maximum number of bins. For each m obtained in the binary search. pack X(n) into the m bins by the LFD algorithm. If the lowest bin level of the resulting packing is at least one, search the upper half of the range; otherwise, the lower half. This process is iterated until the search range is no more than one. In our probabilistic model we assume that X(n) = (Xl, . . . ,x,,) is a random sample from an arbitrary probability measure /J over [O,l]. We wish to show the existence of a constant d(p) such that lim,, m (ZLFD(X(n))/n) = d(p), almost surely. Since ZLFD(X(n))/n always lies in [0,11, it follows = d(p) as well. that lim,, m (E[ILFD(X(n))]/n) Recall that the existence of c(p) was guaranteed by the super-additive property of OPT(X(n)); i.e.,
OPT(al, . . ,a,) + OPT(a,+l, . . . ,un+,,J d OPT(al, . . . ,a,) .‘. >a,,a,+l, . . . ,anfm )foranyitemlists(a,, and (u,+i, . . . ,a .+,). Unfortunately, ILFD(X(n)) does not have this property, as the following example shows: a, = u2 = u3 = a4 = &, Let u5=&,a6=&,a,=~,us=~anda9=~.By the ZLFD algorithm, it is easy to see that ILFD(ul, a2, a3) = 1 and ILFD(a,, as, a6, al,ag, as) = 3, but ILFD(ul,az, . . . , a9) = 3. Thus we can no longer use the theory of superadditive processes to establish the existence of d(u). In this article we use a different method to establish the existence of d(p). We show that for any probability measure p over [O,l], there is a constructible sequence (E(n) = (t\“, . . . ,(p’) E [0,1-j”: n 3 1) and a constant a(p) such that
(1.2) and almost lim
n-r,
surely
ILFDW(n)) n
=
a4
(1.3)
Thus d(p) is the desired constant d(p). In addition, we study the expected values of the ratio rlLFD(X(~)) = OPT(X(n))/ILFD(X(n)), over all possible probability measures for X(n). From the converges to above results, it is clear that r,,,,X(n) r(p) = c(p)/@) almost surely, provided that d(p) > 0. Consequently, E [r,LFD(X(n))] converges to r(p) as well. We are interested in determining the range in which u(p) lies. From the worst-case example given in [l], it is easy to see that rrLFo(X(n)) can asymptotically approach any number in [l, $1. One would hope that the expected values of r,LFo(X(n)) lies in a narrower range. Unfortunately, this is not the case, as we show that for any number a E [l, $1, there is a probability measure pa such that r&) = a.
2. Preliminaries Consider a family L of Bore1 measurable functions. For each n 3 1 there is exactly one function in L defined on [0,11”. With a slight abuse of notation, we denote this function by L(x,, . . . ,x,),
195
S. Han et al.1 Operations Research Letters 18 11996) 193-199
where (x1, . . , x,) E [0,11”. Each function in L satisfies the following five properties: (Pl) For all n and (xi, . . . ,x,)E [O,l]“, L(x,, . . . ,x,) 3 0. any permutation (ir, . . , i,) of (P2) For (1, ... ,?i), L(Xl, ... 1 X,) = L(Xj,, ... ,Xin). (P3) Foranym>nand(y,, . . ..y.)~[O,l]“‘,if xi < yi for each i, 1 d i d n, then L(xI, . . . ,x,) < L(‘1, ... ,ym). (P4) For any positive integer k, let (k x1, a point in [0, 11”” with the . . . ) k. x,) denote ((i - 1)k + 1)th to the (ik)th components being Xi, 1 d id n. Then, kL(xl, . . . ,x,) < L(k.x,, . . . ,k.x,) d k(L(x,, . . . .x,) +f(n)), where f(n) is a function of n such thatf(n) = o(n). (P5) There is a positive constant 6 such that for jXi_1,Xi+l, . . . ,X,) > every i, 1 d id n, L(X,, L(Xl, . . . ,.x,) -- 6 for all x E [0,11”. For a given probability measure p over [0,11, define a function F- ’ from [0, l] to [0, l] as follows: F-‘(z)
= min {t : p([O, t]) > z and 0 < t d l}. (2.1)
Define the sequence of points y1>, 1: as follows: For all IZ3 c”!“’= F-l (i/n). Then we theorem for which we will the proof; a more detailed in [4].
{Z(n) = (, 1, IL(z(n))/n - h(p)1 d max (6/n, f (n)ln1; (2) almost surely, lim,, X (L(X(n))/n) = h(p); (3) for any positive integer p,
lim
*+7c
E
~-
UX(n)) n
lation,
it is not difficult to show that
L(3mo)) -___ W(n0)) m0
n0
<max{f+~,~+(l+~)~}.
It is not difficult to see that (2.2), (P4) and (P5) imply that lim,, z (L(E(n))/n) exists. We denote this limit by h(p). Moreover, from (2.2) we have for any fixed n and for all i 3 1, L(B(An)) j.n
_~
L(Z(n)) n
<max{~+Gj.~+(l+f)~}.
(2.3)
Letting i, -+ x in (2.3), we obtain (1). We now proceed to prove (2). Let U be a random variable uniformly distributed over [0,11. Consider the random variable Y = F-‘(U), where F-’ is as defined in (2.1). Let ui , . . , u, be a random sample from U, and let ucl), . ,u~,) be its order statistics. Then let y1 = F-‘(uI), . .y, = F-‘(u,) be the random sample of Y, and let ycl, = F-‘(I.+,,), . . . ,y,,, = F-‘(IA,,,) be its order statistics. By the Kolmogorov-Smirnov statistics and the definition of F- ‘, it is not difficult to see that for any s > 0,
>
1 _
Me-2”2,
where M is a universal implies that
=0. Wp II
Proof. Let m. and no be integers with m. > no > 0, and let i = Lm,&,]. With (Pl)-(PS) and by calcu-
(2.2)
> 1 - Mep2”2.
(2.4) constant.
Expression
(2.4)
S. Han et al. / Operations Research Letters 18 (1996) 19&l 99
196
1 6 i < n. If we reorder the two lists suck that and y,, 3 Y,, 2 ... 3 yi,, then xii G yi, for each 1 < k < n.
By this, (P3), (P5) and (P2), we have
Xit
Pr
W(n)) UY19 .” ,Y,) -___ n n
< 6(s& \
+ 1)
Pr
(2.5) and with (2.5) we have
UX(n)) ___n (I d(s &
+ 1) +fM n
> 1 - MeC2”‘. Then (2) follows from this and the Borel-Cantelli lemma. By (P5), L(X(n))/n always lies in [0, S], and hence (3) follows directly from (2). 0
3. Probabilistic
analysis of ILFD
In this section we analyze the average-case performance of the ZLFD algorithm. We first show that ZLFD, as a function defined on [0, l]“, satisfies (Pl)-(PS), thereby obtaining the results of Theorem 1 specialized for ILFD. Theorem 2. For any probability measure p over [0, l] there is a constant d(p) suck that (1) IILFD(Z(n))/n - d(n)) d l/n; (2) almost surely, lim,,, (ILFD(X(n))/n) = d(n); (3) ,for any positive integer p, lim E n-x [I
(JLED(X(n)) n
II .
_ d(p) ’
xi2
3
...
>
-Xi,,
n
> 1 - MeC2”‘. Based on (1) of the theorem
3
= o
Proof. The theorem follows immediately from Theorem 1 if we can show that ILFD satisfies (Pl)(PS) withf(n) = 1 and 6 = 1. Clearly, ZLFD satisfies (Pl) and (P2). We now show that ILFD satisfies (P3). First, by induction on n, we can prove the following claim, whose proof will be left to the interested reader. Claim 1. Let (x1, . ,x,) and (yl, . . . ,Y,) be two list of numbers suck that n d m and Xi < yi for each
Recall that the ZLFD algorithm packs the items in nonincreasing size. By Claim 1, we can simply consider two lists (xi, . . , x,) and ( yl, . . , y,) with ndm, such that Xi>Xi+i for i=l,..., n-l, yj 3 yj+ 1 for j = 1, . . . , m - 1, and Xi < yi for i= 1, . , n. Consider the packing of (xi, . . ,x,) and ( y,, . , ym) into 25 bins by the LFD algorithm, where the Xi’s are packed into the first J bins and the yi’s are packed into the second J bins. The following claim shows that if the bins in each group are sorted in nonincreasing order of levels, then the level of each bin in the first group is no more than that of the corresponding bin in the second group. By the level of a bin, we mean the sum of the sizes of the items packed in the bin. Claim 2. At each step after xi and Yi have been packed, 1 < i G n, tf we reorder the bins in the two groups by nonincreasing order of levels, then the level oJ’each bin in thejrst J bins is no more than that of the corresponding bin in the second J bins. We will prove Claim 2 by induction on i. The basis case, i = 1, is trivial. Assuming that it is true for all i < k, we wish to show that it is also true for i = k. Consider the levels of the bins after xi, . . . ) xk- 1 have been packed into the first J bins, and y, , . . . , y, _ , packed into the second J bins. Let the bins in each group be reordered so that they order of levels. Let are in nonincreasing 1:” 3 l’:‘> . . . > 1:” denote the levels of the first J bins and/lj2’ 2 l(22)3 ... 3 I$*’ denotes the levels of the second J bins. By the induction hypothesis, 15” d 152’for each 1 d j d J. According to the LFD algorithm, xk and yk will be packed into the last bin in each of the groups, with the resulting levels 1:” + xk and 11” + yk, respectively. Since xk d yk, we have l$l’ + .xk d lp’ + yk. If we now consider the two lists (l:i’,l$l’, . . ,I$” + xk) and (l’:‘, I$*‘, . . . ) li2) + yk), then Claim 2 is also true for i = k, by Claim 1. By Claim 2, ZLFD( yl, . . . , y,) 2 ZLFD(x,, . . . , x,); i.e., fLFD satisfies (P3).
197
S. Han et al./ Operations Research Letters 1X (I 9961 I93 - I99
To show that ILFD satisfies (P4) withf(n) = 1, let us assume that ILFD(xi, . . ,x,) = N; i.e., the LFD algorithm can pack (xi, . ,x,) into N bins such that the sum of the sizes of the items in each bin is at least one. Consider packing into a rec(k.x 1. ,.. , k. x,) by the LFD algorithm tangular array of bins with k rows and N columns. The items are packed in a column major order; i.e., the bins in the first column used first, the second column next, and so on. Clearly, the LFD algorithm will produce a packing consisting of k copies of the packing of (xi, . . ,x,). This shows that kILFD(x,, . . . ,x,) d ILFD(k.x,, . . . ,k.x,). To show that ILFD(k.s,, ,k.x,) < k(ZLFD(xl, . , .u,) + 1) let us suppose that ILFD(k. xl, . . . ) k’ x,,) > k(N + 1). If we consider the packing of(k.s,, . . , k. x,) into a rectangular array of bins with k rows and N + 1 columns, it is easy to see that the LFD algorithm can also pack (xi, . . . ,.x,) into N + 1 bins such that the sum of the sizes of the items in each bin is at least one. This contradicts the fact that ILFD(xl, . . ,x,) = N. Thus ZLFD satisfies (P4) withf(n) = 1 for all n 2 1. Finally, we show that ZLFD satisfies (P.5) with (5 = 1. Let X(n) = (xi, ,x,) and X’(n) = (xi, . . . ) xi-1tXi+13 . . . , x,). Let ZLFD(X(n)) = N. Suppose that in the ILFD packing of X(n), Xi is packed in the same bin along with x,,, . . . ,x,,. Consider the list X(n) = X(n) - (Xi,X,,, . . . ,x,). It is clear that the LFD algorithm can pack X(n) into N - 1 bins such that the sum of the sizes of the items in each bin is at least one. Thus ILFD(X(n)) 3 N - 1. By (P2). X’(n) can be regarded as the concatenation of 8(n) with the list (x,~, . . ,.Y,,). Thus, by (P3), ILFD(X’(n)) > ZLFD@(n)) 3 N - 1 = ILFD(X(n)) - 1. This means that ILFD satisfies (Pj)withii=l. 0 We now turn our attention to the investigation of the range for r(p), over all possible probability measures. Let fi be a real number in [$, 1). Note that (1 - /?)n < /?n/2 for all n > 1. Since we will be considering large values of n, without loss of generality, we can approximate the value of any linear function of n to be an integer. (This will enable us to present the idea of the proof more conveniently.) Let us consider a special list (ai, . . , a,) of n items, where there are (1 - ,f3)n type-l items
items =$, and fin type-2 that are linearly increasing from s to 5. Consider an optimal packing of the above list. We can pack the type-l items into (1 - j?)n/3 bins and the type-2 items into /In/2 bins such that the sum of the sizes of the items in each bin is exactly one. Thus we have OPT(u,, . . . ,u,) = (2 + b)n/6. Now consider the ILFD packing of the same list. It is clear that ILFD(u,, . . . ,u,) 3 @/2, since we can cover at least (In/2 bins by the type-2 items. On the other hand, ILFD(al, . . . ,u,) < fin/2 t 2. This is because during each iteration of the ILFD algorithm, the type-2 items are packed before the typeLFD algorithm. Since 1 items by the (1 - fi)n d @/2. it is impossible to cover /In/2 + 2 bins. Thus ILFD(ul , , a,) is approximately /A1/2, and hence OPT(ul, ,a,,)~lLFD(ul, ,m,) is approximately (2 + fl)/3fl. Let x = (2 + B)/3p. Then 1 < x d 4, since i 6 p < 1. Fix an x E ( 1, $1. If we define a probability measure ,M~over [O. l] such ,a,), then that for all n 3 1, Z(n) is exactly ((I,. r(pJ = r. The above ideas form the basis of the proof of the following theorem.
u1
=
“.
=q_
q-/J)n+l,
p,,,
.”
> a,
Theorem 3. For any CIE (l,$], there is a probability measure pz over [0, l] such that r(p,) = x. Furthermore, (pz) = 1for any probability measure p symmetric on [0,11. Proof. We first show that for any r E (1, $1, there is a probability measure pa such that r&) = r. Let /I = 2/(3cx - 1). Then 5 < fi < 1. Consider the probability measure /A%:
1, p&O, t]) =
3bt + (1 - 2p). i 0,
+ s [pi?.TOJ23 > s ‘s JO uoyun3 T? Si ([S‘()])ti $EqJ 8U!JON .I] - [ > S [[” 103
cocu
-3pUOU
s! $1 '11 _ 1 Wt?yl xaI3 uvq1 ssa[ Jaq -urnu LUE aq s IaT ‘uZ/! - [ 3 (( 11 - 1 ‘o])r/ saydur! pue ‘I = ((‘3 - 1 ‘o])d s! rl axus ‘uZ/[ + UZ
lsnur ((W_zdo
a3uaq uZl.2 < ([l~‘ol)~ + ([ 11‘o])rl ‘+~auuuds
(9,551) 81
SJallaT
y3.tVSa~
fj
z=
:
((u&&l wI1
a3uaq put2 ‘f/OF + Z/(0! - u) apn@eur 30 aq wql aas 01 ka sy I! ‘(f+(I’f) 4~
(f’f)
/! - [ Q (CZJ‘Ol)~Pue UZ/? Q (C’l‘Ol)~ ‘I-d JO uoyugap aqt dq ‘uaql @z/(I + I - uZ)) I _d = z3 puz @Z/i) I_.rl = ‘2 $a[ ‘(L’f) anold OJ ,56[-[6[
. ‘O?< ? [[E .I03 put?
suommdo
/ ‘Iv la UVH
‘s
861
S. Han et al./ Operations
Research Letters
on the distribution. What are the necessary and sufficient conditions under which the ILFD algorithms are asymptotically optimal in the average case? References
Cl1 SF.
Assmann, D.S. Johnson, D.J. Kleitman and J.Y-T. Leung. “On a dual version of the one-dimensional bin packing problem”, J. Algorithms 5, 502-525 (1984). PI E.G. Coffman Jr., M.R. Garey and D.S. Johnson, “Approximation algorithms for bin packing an updated survey”, in: G. Ausiello, M. Lucertini and P. Serafini (eds.), Algorithm Drsign,fbr Computer System Design, Springer, Berlin, 1984, pp. 49 106. c31 J. Csirik. J.B.G. Frenk, G. Galambos and A.H.G. Rinnooy Kan, “Probabilistic analysis of algorithms for dual bin packing problems”. .I. iZ/gorithms 12, 189-203 (1991).
1H (I 996) 193-199
199
[41 S. Han, D. Hong and J.Y-T. Leung, “Random processes for bin covering and bin packing”, Tech. Report. UNL-CSE92-13. Department of Computer Science and Engineering, University of Nebraska Lincoln, Lincoln. NE 68588 -0115. 1992. “Subadditive processes”, Lecture Notes I51 J.F.C. Kingman, in Mathematics, Vol. 539. Springer. Berlin. 1976. pp. 167m 223. C61K.L. Krause, Y.Y. Shen and H.D. Schwetman. “Analysis of several task scheduling algorithms for a model of multiprogramming computer systems”. J. 4CM 22, 522 550 ( 1975). [71 W.T. Rhee, “A note on optimal bin packing and optimal bin covering with items of random size”. S14M J. Cornput. 19. 7055710 (1990). PI W.T. Rhee and M. Talagrand, “Optimal bin covering with items of random size”, SIAM J. Cornput. 18. 487 498 (1989).