19
CEJOR (2010) 18:221–239 DOI 10.1007/s10100-009-0109-z ORIGINAL PAPER A note on online hypercube packing Xin Han · Deshi Ye · Yong Zhou Published online: 16 September 2009 © Springer-Verlag 2009 Abstract In this paper, we study an online multi-dimensional bin packing problem where all items are hypercubes. Hypercubes of different size arrive one by one, and we are asked to pack each of them without knowledge of the next pieces so that the number of bins used is minimized. Based on the techniques from one dimen- sional bin packing and specifically the algorithm Super Harmonic by Seiden (J ACM 49:640–671, 2002), we extend the framework for online bin packing problems devel- oped by Seiden to the hypercube packing problem. To the best of our knowledge, this is the first paper to apply a version of Super Harmonic (and not of the Improved Harmonic algorithm) for online square packing, although the Super Harmonic has been already known before. Note that the best previous result was obtained by Epstein and van Stee (Acta Inform 41(9):595–606, 2005b) using an instance of Improved Harmonic. In this paper we show that Super Harmonic is more powerful than Improve Harmonic for online hypercube packing, and then we obtain better upper bounds on asymptotic competitive ratios. More precisely, we get an upper bound of 2.1187 for A preliminary version of this paper appeared in Proceedings of fourth Workshop on Approximation and Online Algorithms (WAOA 2006). The research of Deshi Ye was supported in part by State Key Development Program for Basic Research of China (“973” project, No. 2007CB310900) and NSFC (10601048). X. Han Department of Mathematical Informatics, Graduate School of Information and Technology, University of Tokyo, Tokyo 113-8656, Japan e-mail: [email protected] D. Ye (B ) College of Computer Science, Zhejiang University, 310027 Hangzhou, China e-mail: [email protected] Y. Zhou Graduate School of Science, Hokkaido University, Sapporo, Japan e-mail: [email protected] 123

A note on online hypercube packing

  • Upload
    xin-han

  • View
    213

  • Download
    1

Embed Size (px)

Citation preview

Page 1: A note on online hypercube packing

CEJOR (2010) 18:221–239DOI 10.1007/s10100-009-0109-z

ORIGINAL PAPER

A note on online hypercube packing

Xin Han · Deshi Ye · Yong Zhou

Published online: 16 September 2009© Springer-Verlag 2009

Abstract In this paper, we study an online multi-dimensional bin packing problemwhere all items are hypercubes. Hypercubes of different size arrive one by one, andwe are asked to pack each of them without knowledge of the next pieces so thatthe number of bins used is minimized. Based on the techniques from one dimen-sional bin packing and specifically the algorithm Super Harmonic by Seiden (J ACM49:640–671, 2002), we extend the framework for online bin packing problems devel-oped by Seiden to the hypercube packing problem. To the best of our knowledge,this is the first paper to apply a version of Super Harmonic (and not of the ImprovedHarmonic algorithm) for online square packing, although the Super Harmonic hasbeen already known before. Note that the best previous result was obtained by Epsteinand van Stee (Acta Inform 41(9):595–606, 2005b) using an instance of ImprovedHarmonic. In this paper we show that Super Harmonic is more powerful than ImproveHarmonic for online hypercube packing, and then we obtain better upper bounds onasymptotic competitive ratios. More precisely, we get an upper bound of 2.1187 for

A preliminary version of this paper appeared in Proceedings of fourth Workshop on Approximation andOnline Algorithms (WAOA 2006).The research of Deshi Ye was supported in part by State Key Development Program for Basic Research ofChina (“973” project, No. 2007CB310900) and NSFC (10601048).

X. HanDepartment of Mathematical Informatics, Graduate School of Information and Technology,University of Tokyo, Tokyo 113-8656, Japane-mail: [email protected]

D. Ye (B)College of Computer Science, Zhejiang University, 310027 Hangzhou, Chinae-mail: [email protected]

Y. ZhouGraduate School of Science, Hokkaido University, Sapporo, Japane-mail: [email protected]

123

Page 2: A note on online hypercube packing

222 X. Han et al.

square packing and an upper bound of 2.6161 for cube packing, which improve uponthe previous upper bounds 2.24437 and 2.9421 (Epstein and van Stee in Acta Inform41(9):595–606, 2005b) for the two problems, respectively.

Keywords Online algorithms · Hypercube packing · Competitive ratio · Approxi-mation algorithms · Harmonic algorithm

1 Introduction

The classical bin packing problem is one of basic problems in computer science andcombinatorial optimization etc. There are a lot of applications in real world. In thispaper, we study multi-dimensional bin packing problems, which is also related togeometry packing problems and harder than the classical bin packing problem. TheMulti-dimensional bin packing problem is defined as below.

Input: An input list L of items, where each of items is a d-dimensional box, d ≥ 1is an integer, and in each dimension, the side length of an item is bounded by one.

Output: Pack all the items in L into hypercube bins and minimize the number ofbins used such that (i) no two items in a bin overlap with each other, (ii) item’s sidesare parallel to bin’s sides. Note that for d = 1, the problem degenerates to the classicalone-dimensional bin packing problem.

In the following, we focus on a special case of multi-dimensional bin packing prob-lem, i.e., online hypercube packing problem, in which each of items is a hypercubeand items arrive one by one, each piece must be immediately and irrevocably assignedto a d-dimensional unit bin without any information on subsequence items.

Asymptotic competitive ratio: We use the standard asymptotic competitive ratioto evaluate an online algorithm for bin packing problem. Given an input list L, letA(L) be the cost (number of bins used) obtained by applying algorithm A to L and letO PT (L) be the corresponding optimal value. Then the asymptotic competitive ratiofor algorithm AR∞A is defined as below:

R∞A = limk→∞ sup max

L{A(L)/O PT (L)|O PT (L) = k}.

Previous results: The classical one-dimensional online bin packing problem hasbeen extensively studied. Johnson et al. (1974) showed that the First Fit algorithmhas the competitive ratio 1.7. Yao (1980) improved the upper bound of the compet-itive ratio to 5/3. Lee and Lee (1985) presented an algorithm with the competitiveratio of 1.63597. Ramanan et al. (1989) improved the upper bound to 1.61217. Thebest known upper bound is 1.58889 Seiden (2002). On the lower bounds, Yao (1980)showed that no online algorithm has performance ratio less that 1.5. Brown (1979)and Liang (1980) independently improved this lower bound to 1.53635. The currentchampionship of lower bound is 1.54014 Vliet (1992).

On the online hypercube packing problem, Coppersmith and Paghavan (1989)showed an upper bound of 43/16 = 2.6875 for online square packing and an upper

123

Page 3: A note on online hypercube packing

A note on online hypercube packing 223

bound 6.25 for online cube packing. The upper bound for square packing was improvedto 395/162 ≈ 2.43828 by Seiden and Stee (2003). For online cube packing, Miyazawaand Wakabayashi (2003) showed an upper bound of 3.954. Epstein and van Stee(2005a,b, 2007) gave an upper bound of 2.24437 for square packing and an upperbound of 2.9421 for online cube packing, and they also gave lower bounds of 1.6406and 1.6680 for square packing and cube packing, respectively.

Our contributions: When the Harmonic algorithm Lee and Lee (1985) is extendedto the online hypercube packing problem, the items of sizes 1/2+ε, 1/3+ε, 1/7+ε, . . .

are still the crucial items related to the asymptotic competitive ratio, where ε > 0 issufficiently small. Using the techniques from one dimensional bin packing, Epsteinand van Stee (2005b) combined the items of size in (1/2, 1−�]with the items of sizein (1/3,�] and improved the Harmonic algorithm for hypercube packing, where � isa specified number in (1/3, 0.385). In this paper, we do not only consider the combina-torial packing for the items in (1/2, 1−�] and (1/3,�], but also other crucial items.Based on the techniques from one dimensional bin packing algorithm Super Harmonicby Seiden (2002), we classify all the items into several groups and extend a frameworkfor the classical online bin packing problem developed by Seiden (2002) to the hyper-cube packing problem. To the best of our knowledge, this is the first paper to apply aninstance of Super Harmonic (not an instance of Improved Harmonic) for online squarepacking. Note that the best previous result was obtained by an instance of ImprovedHarmonic for this problem. To analyze our algorithm, we give a weighting systemconsisting of four weighting functions. By the weighting functions, we show that forsquare packing, the asymptotic competitive ratio of our algorithm is at most 2.1187which improves upon 2.24437 Epstein and van Stee (2005b), for cube packing, theratio is at most 2.6161, which also improves upon 2.9421 Epstein and van Stee (2005b).

The remainder of this paper is organized as follows. Section 2 gives the generalizedframework for online hypercube packing. Specific analyses for square packing andcube packing are given in Sect. 3. Conclusions will be given in Sect. 4.

2 General framework for online hypercube packing

In this section we extend the framework for classical online bin packing problemdeveloped by Seiden (2002) to the hypercube packing problem. Before giving theframework, we first group hypercubes by the following definitions. If an hypercube pof size (side length) s(p) ≤ 1/M , where M is a fixed integer, then p is called small,otherwise large. The whole framework is given in Sect. 2.2. Before that, we introducean approach for packing items into bins first.

2.1 Online packing small items

Compared with packing large items, it is relatively easy to deal with small items by theonline packing techniques in Csirik and Vliet (1993), Epstein and van Stee (2005a).There are two main points, (i) in any “closed” bin, there is a lot of space packed, (ii)in the whole packing procedure, there are not too much open or active bins.

123

Page 4: A note on online hypercube packing

224 X. Han et al.

The key ideas are below:

1. Classify all small squares into M groups. In detail, for an item p of size s(p) if2ks(p) ∈ (1/(i + 1), 1/ i] then it belongs to group i , where i ∈ {M, . . . , 2M − 1}and k is non-negative integer.

2. Exclusively pack items of the same group into bins, i.e., each bin is used to packitems belonged to the same group.

For completeness, we introduce algorithm AssignSmall(i) for online packing hyper-cube by Epstein and van Stee (2005a). When an item p of type i is given, i.e.,2ks(p) ∈ (1/(i + 1), 1/ i] for some k ≥ 0, the algorithm works as follows.

1. If there is an empty sub-bin of size 1/(2ki), then the item is simply packed there.2. Else, in the current bin, if there is no empty sub-bin of size 1/(2 j i) for j < k, then

close the bin and open a new bin and partition it into sub-bins of size 1/ i . If k = 0then pack the item in one of sub-bins of size 1/ i . Else goes to next step.

3. Take an empty sub-bin of size 1/(2 j i) for a maximum j < k. Partition it into 2d

identical sub-bins. If the resulting sub-bins are still larger than 1/(2ki), then takeone of them and partition it in the same way. This is done until sub-bins of size1/(2ki) are reached. Then the item is packed into one such sub-bin.

A bin is called active if it can still receive items, otherwise closed.

Lemma 1 Epstein and van Stee (2005a) In the above algorithm, (i) at any time, thereare at most M active bins. (ii) In each closed bin of type i ≥ M, the occupied volumeis at least (id − 1)/(i + 1)d ≥ (Md − 1)/(M + 1)d .

So, roughly speaking, a small item with size x takes at most a fraction of (M+1)d

(Md−1)× xd

of a bin.

2.2 Algorithm A for online hypercube packing

The key points in our online algorithm are

1. Divide all items into small and large.2. Pack small items by algorithm AssignSmall, pack large items by an extended Super

Harmonic algorithm.

Next we modify and extend Super Harmonic algorithm Seiden (2002) to onlinehypercube packing. To take the same token, we borrow some notations in SuperHarmonic algorithm and also some new definitions (e.g., θi ) are introduced.

Classification of large items: Given an integer M ≥ 11, let t1 = 1 > t2 > · · · >tN+1 = 1/M > tN+2 = 0, where N is a fixed integer. We define the interval I j tobe (t j+1, t j ] for j = 1, . . . , N + 1 and say a large item p of size s(p) has type i ifs(p) ∈ Ii .

Definition An item of size s has type τ(s), where

τ(s) = j ⇔ s ∈ I j .

123

Page 5: A note on online hypercube packing

A note on online hypercube packing 225

Parameters in algorithm A: An instance of the algorithm is described by thefollowing parameters: integers N and K ; real numbers 1 = t1 > t2 > · · · > tN >

tN+1 = 1/M, α1, . . . , αN ∈ [0, 1] and 0 < �1 < · · · < �K < 1/2, and a functionφ : {1, . . . , N } → {1, . . . , K }.

Next, we give the operation of our algorithm, essentially, which is quite simi-lar with the Super Harmonic algorithm Seiden (2002). Each large item of type j isassigned a color, red or blue. The algorithm uses two sets of counters, e1, . . . , eN ands1, . . . , sN , all of which are initially zero. si keeps track of the total number of typei items. ei is the number of type i items which get colored red. For 1 ≤ i ≤ N , theinvariant ei = αi si� is maintained, i.e., the fraction of type i items colored red isapproximately αi .

In one dimensional packing, a bin can have at most βi = 1/ti� items with sizeti . After packing βi items of type i , there is δi = 1 − tiβi space left. The rest spacecan be used for red items. However, we sometimes use less than δi in a bin in order tosimplify the algorithm and its analysis, i.e., we use D = {�1, . . . ,�K } instead of theset of δi , for all i . �φ(i) is the amount of space used to hold red items in a bin whichholds blue items of type i . We therefore require that φ satisfy �φ(i) ≤ δi . φ(i) = 0indicates that no red items are accepted. To ensure that every red item potentially canbe packed, we require that αi = 0 for all i such that ti > �K , that is, there are no reditems of type i . Define γi = 0 if ti > �K and γi = max{1, �1/ti�}, otherwise. Thisis the number of red items of type i placed in a bin.

In d-dimensional packing, we replace βi with βdi and introduce new parameters θi

instead of γi . Let

θi = βdi − (βi − γi )

d .

This is the number of red items of type i that the algorithm places together in a bin.In details, if ti > �K , then θi = 0, i.e., we do not pack type i items as red items. So,in this case, we require αi = 0. Else if ti ≤ �1, then θi = βd

i − (βi − �1/ti�)d . If�1 < ti ≤ �K , we set θi = βd

i − (βi − 1)d .Here, we illustrate the structure of a bin for d = 2 in Fig. 1.

Fig. 1 If the bin is a (i, j) or(i, ?) bin, the amount of area forblue items is (ti βi )

2. Theamount of area left is1− (ti βi )

2. The amount of thisarea actually used for red itemsis 1− (1−�φ(i))

2, where�φ(i) ≤ δi = 1− ti βi

Red

Blue

t iβi δ i

Wasted space

Blue item space

Red item space

123

Page 6: A note on online hypercube packing

226 X. Han et al.

Naming bins: Bins are named as follows:

{(i)|φi = 0, 1 ≤ i ≤ N , }{(i, ?)|φi �= 0, 1 ≤ i ≤ N , }{(?, j)|α j �= 0, 1 ≤ j ≤ N , }{(i, j)|φi �= 0, α j �= 0, γ j t j ≤ �φ(i), 1 ≤ i, j ≤ N }.

We call these groups monochromatic, indeterminate blue, indeterminate red andbichromatic, respectively.

The framework of our algorithm is essentially as the same as Super Harmonicalgorithm Seiden (2002).

Algorithm AInitialize ei ← 0 and si ← 0 for 1 ≤ i ≤ M + 1.For a small item p, call algorithm AssignSmall.For a large item p:

i ← τ(p), si ← si + 1.If ei < αi si�:

ei ← ei + 1.Color p red.If there is an open bin in group (?, i) with fewer than θi type i items,then pack p in this bin.Else if there is an open bin in group ( j, i) with fewer than θi type iitems, then pack p in this bin.Else if there is some bin in group ( j, ?) such that �φ( j) ≥ γi ti thenplace p in it and change the group of this bin to ( j, i).Otherwise, open a new group (?, i) bin and place p in it.

Else:Color p blue.If φ(i) = 0:

If there is an open bin in group i with fewer than βdi items, then

place p in it.Otherwise, open a new group i bin and pack p there.

Else:If, for any j , there is an open bin (i, j) with fewer than βd

i items,then place p in this bin.Else, if there is some bin in group (i, ?) with fewer than βd

i items,then place p in this bin.Else, if there is some bin in group (?, j) such that �φ(i) ≥ γ j t j

then pack p in it and change the group of this bin to (i, j).Otherwise, open a new group (i, ?) bin and pack p there.

The following lemma is directly from Lemma 2.2 Seiden (2002).

Lemma 2 The total number of all the indeterminate bins is bounded O(1).

Let Bi and Ri be the number of bins containing blue items of type i and red itemsof type i , respectively. Let li be the number of items type-i in L .

123

Page 7: A note on online hypercube packing

A note on online hypercube packing 227

Lemma 3

Bi = 1− αi

βdi

li + O(1), and Ri = αi

θili + O(1).

Proof Every closed blue bin (i) or (i, ∗) contains βdi items of type-i , every closed

red bin ( j, i) or (?, i) contains θi items of type-i . During packing we maintain thatthe ratio between blue items of type i and all the items of type i is (1 − αi ). Andby Lemma 2, the number of all the open bins is bounded by O(1). So, we have thislemma. ��

3 The analysis for square and cube packing

In this section, we fix the parameters in the framework given in the last section forsquare packing and cube packing, respectively. Then we analyze the competitive ratiosby a corresponding weighting system consisting of four weighting functions.

3.1 An instance of algorithm A

Let M = 11, i.e., a small item has its side length as most 1/11. And the parameters inA are given in the following tables. First we classify all the items into 17 groups byfixing the values of ti , where 1 ≤ i ≤ 18. Then we calculate the number of blue typei in a bin, βd

i . Finally, we define the set D = {�1, . . . ,�K } and the function φ(i),which are related to how many red items θi can be accepted in a bin, where K = 4.Note that αi which is the fraction of type i items colored red will be given later.

i (ti+1, ti ] βi δi φ(i) γi

1 (0.705, 1] 1 0 0 02 (0.6475, 0.705] 1 0.295 2 03 (0.60, 0.6475] 1 0.3525 3 04 (0.5, 0.60] 1 0.4 4 05 (0.4, 0.5] 2 0 0 06 (0.3525, 0.4] 2 0.2 1 17 (1/3, 0.3525] 2 0.295 2 18 (0.295, 1/3] 3 0 0 09 (1/4, 0.295] 3 0 0 110 (1/5, 1/4 ] 4 0 0 111 (1/6, 1/5 ] 5 0 0 112 (1/7, 1/6] 6 0 0 113 (1/8, 1/7] 7 0 0 114 (1/9, 1/8] 8 0 0 115 (0.1, 1/9] 9 0 0 116 (1/11, 0.1] 10 0 0 217 (0, 1/11] ∗ ∗ ∗ ∗

123

Page 8: A note on online hypercube packing

228 X. Han et al.

j = φ(i) � j Red items accepted

1 0.20 11. . .162 0.295 9. . .163 0.3525 7, 9. . .164 0.40 6, 7, 9. . .16

Observation: By the above tables, in any dimension of a (4, ?) bin, the distancebetween the type 4 item and the opposite edge (face) of the bin is at least �4 = 0.4,since we pack a type 4 item in a corner of a bin. So, all red items with size at most 0.4can be packed in (4, ?) bins. In the same ways, all red items with size at most 0.3525can be packed in (4, ?) and (3, ?) bins, all red items with size at most 0.295 can bepacked in (4, ?), (3, ?), (7, ?) and (2, ?) bins, all red items with size at most 0.2 canbe packed in (4, ?), (3, ?), (7, ?), (2, ?), (6, ?) bins.

3.2 Weighting system

In this subsection, we first define weighting functions for items such that the number ofbins used by our algorithm is upper bounded by the total weight of the input sequence.Then we prove that the asymptotic competitive ratio of our algorithm is upper boundedby the total weight of all items which fit into a single bin.

Roughly speaking, a weight of an item is the maximal portion of a bin that it canoccupy. Given an item, we consider four cases to define its weight such that

A(L) ≤ max1≤i≤4

{min

1≤ j≤2{Wi, j (L)}

}+ O(1),

where L is the input sequence and A(L) is the cost by algorithm A, Wi, j (L) =∑p∈L Wi, j (p) and Wi, j (p) will be defined later.For a small item p with size x, 1 ≤ i ≤ 4 and 1 ≤ j ≤ 2, we define Wi, j (p) =

12d xd

11d−1.

Lemma 4 Let Ls be the sequence of all the small items in L, for 1 ≤ i ≤ 4 and1 ≤ j ≤ 2, we have A(Ls) ≤ Wi, j (Ls)+ O(1), where Wi, j (Ls) =∑

p∈LsWi, j (p).

Proof By Lemma 1, for small items, in each closed bin, the occupied volume is atleast (11d − 1)/(12)d . By the definition of Wi, j (), we have in each closed bin, thetotal weight is at least one. So, the total weight of all the small items in closed binsis lower bounded by the total number of all the closed bins. Again Lemma 1, all theopen bins are bounded by O(1). So we have Wi, j (Ls) ≥ A(Ls)− O(1). ��

Next, we define weighting functions for large items such that

A(Lb) ≤ max1≤i≤4

{min

1≤ j≤2{Wi, j (Lb)}

}+ O(1),

123

Page 9: A note on online hypercube packing

A note on online hypercube packing 229

where Lb is the sequence of all the large items in L and Wi, j (Lb) =∑p∈Lb

Wi, j (p).To define Wi, j (p), we have four cases. Let e = max{0, max{ j |such that the number ofbins (?, j) is larger than 0}}.Case 1: e = 0, i.e., there are no indeterminate red bins. Then the weight of an item pof size x is defined as below:

W1,1(p) = W1,2(p) = 1− αi

βdi

if x ∈ Ii , for i = 1 . . . 16.

Since the number of bins of type (?, j) is zero for any j , i.e., every red item is packedwith one or more blue items, we have

A(Lb) =∑

i

Bi . (1)

By Lemma 3 and the definition of W1,1(p), we have Bi = 1−αi

βdi

li + O(1) =∑x∈Ii

W1,1(p)+ O(1). Hence by (1), A(Lb) ≤ min1≤ j≤2{W1, j (Lb)} + O(1).

Case 2: e = 6, i.e, there are some bins of type (?, 6) but no bins of type (?, j) forj > 6. Then the weight of an item p of size x is defined as below:

W2,1(p) =

⎧⎪⎪⎨⎪⎪⎩

1−αi

βdi

if x ∈ Ii , for i = 1, 2, 3, 5, 8.

0 if x ∈ I4.1−αi

βdi+ αi

θiif x ∈ Ii , for i = 6, 7, 9 . . . 16.

And

W2,2(p) =⎧⎨⎩

1−αi

βdi

if x ∈ Ii , for i = 1 . . . 5, 7 . . . 16.

1−αi

βdi+ αi

θiif x ∈ Ii , for i = 6.

Since a type-6 item can be packed into a bin (4, ?), by our algorithm, it implies thatbins of type (4, ?) do not exist. So, all the items of type 4 must be packed into bins oftype (4, j). If we count all (4, j) bins as red bins then

A(Lb) ≤∑

i=1...3,5,8

Bi

∑i=6,7,9...16

(Ri + Bi ) ≤ W2,1(Lb)+ O(1),

the last inequality follows directly from Lemma 3 and the above definition of W2,1(p).Else we count all (4, j) bins as blue bins. By the definition of e, for j > 6, bins oftype (?, j) do not exist. So, we have

A(Lb) ≤∑

i=1...16

Bi + R6 ≤ W2,2(Lb)+ O(1),

the last inequality follows directly from Lemma 3 and the above definition of W2,2(p).Hence we have A(Lb) ≤ min1≤ j≤2{W2, j (Lb)} + O(1).

123

Page 10: A note on online hypercube packing

230 X. Han et al.

Case 3: e = 7, i.e., there are some bins (?, 7) but no bins of type (?, j) for j > 7. Inthis case, the weight of an item p of size x is defined as below:

W3,1(p) =

⎧⎪⎪⎪⎨⎪⎪⎪⎩

1−αi

βdi

if x ∈ Ii , for i = 1, 2, 5, 8.

0 if x ∈ I3, I4.

1−αi

βdi+ αi

θiif x ∈ Ii , for i = 6, 7, 9 . . . 16.

And

W3,2(p) =⎧⎨⎩

1−αi

βdi

if x ∈ Ii , for i = 1 . . . 5, 8 . . . 16.

1−αi

βdi+ αi

θiif x ∈ Ii , for i = 6, 7.

Since a type-7 item can be packed in a bin of type (4, ?) or (3, ?),it implies that binsof type (4, ?) and (3, ?) do not exist. If we count all (4, j) and (3, j) bins as red bins,then

A(Lb) ≤∑

i=1,2,5,8

Bi +∑

i=6,7,9...16

(Ri + Bi ) ≤ W3,1(Lb)+ O(1),

the last inequality follows directly from Lemma 3 and the above definition of W3,1(p).Else we count all (4, j) and (3, j) bins as blue bins then

A(Lb) ≤∑

i=1...16

Bi + R6 + R7 ≤ W3,2(Lb)+ O(1).

Hence we have A(Lb) ≤ min1≤ j≤2{W3, j (Lb)} + O(1).

Case 4: e ≥ 9, i.e., there are some bins (?, j) for j ≥ 9. In this case, the weight of anitem p of size x is defined as below:

W4,1(p) = W4,2(p) =

⎧⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎩

1−αi

βdi

if x ∈ Ii , for i = 1, 5, 8.

0 if x ∈ I2, I3, I4.

1−αi

βdi+ αi

θiif x ∈ Ii , for i = 6, 9 . . . 16.

αiθi

if x ∈ Ii , for i = 7.

Since an item of type e ≥ 9 can be packed in a bin of type (i, ?), where i = 2, 3, 4, 7, itimplies that bins of type (2, ?), (3, ?), (4, ?), (7, ?) do not exist. If we just count thesebins of type (2, j), (3, j), (4, j), (7, j) as red bins, then by Lemma 3

123

Page 11: A note on online hypercube packing

A note on online hypercube packing 231

A(Lb) ≤∑

i=1,5,8

Bi +∑

i=6,9...16

(Ri + Bi )+ R7 ≤ W4,1(Lb)+ O()1.

So, we have A(Lb) ≤ min1≤ j≤2{W4, j (Lb)} + O(1).By Lemma 4 and the above analysis for definitions of Wi, j (p), we have the follow-

ing lemma.

Lemma 5 A(L) ≤ max1≤i≤4

{min1≤ j≤2{Wi, j (L)}

}+ O(1).

Definition A set of items X is a feasible set if all items in it can be packed into a bin.Let Wi, j (X) =∑

p∈X Wi, j (p) and let Wi (X) = min{Wi, j (X)}, j = 1 or 2. Define

P(W ) = maxX

max1≤i≤4{Wi (X)}.

Lemma 6 The asymptotic performance ratio of A is upper bounded by P(W ).

Proof For any input sequence of L , we are going to prove that A(L) ≤P(W )O PT (L) + O(1). Given an optimal packing for L , let Lm be the set of itemspacked in the m-th bin of the optimal packing, where 1 ≤ m ≤ O PT (L). we sumup the weight of items over bins in the optimal packing. Then for any 1 ≤ i ≤ 4 and1 ≤ j ≤ 2, we have

Wi, j (L) =∑

1≤m≤O PT (L)

Wi, j (Lm) ≤ O PT (L) maxX

Wi, j (X),

where X is a feasible set. By Lemma 5, we have

A(L) ≤ max1≤i≤4

{min1≤ j≤2{Wi, j (L)}

}+ O(1)

≤ maxi min j O PT (L) maxX Wi, j (X)+ O(1)

= O PT (L) maxX maxi min j Wi, j (X)+ O(1) = P(W )O PT (L)+ O(1).

��

3.3 Upper bounds for square and cube packing

In this subsection, we fix the parameters αi for square packing and cube packing,respectively, and estimate P(W ), i.e., the upper bounds on the asymptotic competitiveratios.

Definition Given an item p with size x , define its efficiency function Ei, j (p) asWi, j (p)/xd .

Proposition 7 For any small item p, Ei, j (p) = 12d/(11d − 1).

Proposition 8 Given any ε > 0, for d-dimensional hypercube packing, if a bin ispacked with an item of size 1/2 + ε then (i) at most id − (i − 1)d items of size1/(i + 1)+ ε can be accepted, where i = 2, 3; (ii) at most id − (i − 2)d items of size1/(i + 1)+ ε can be accepted and, where i = 4, 5.

123

Page 12: A note on online hypercube packing

232 X. Han et al.

Proposition 9 Given any ε > 0, for d-dimensional hypercube packing, (i) if a binis packed with an item of size 0.705 + ε then at most id − (i − 1)d items of size1/(i + 1)+ ε can be accepted, where i = 3, 4, 5; (ii) if a bin is packed with an itemof size 0.6+ ε then at most id − (i − 1)d items of size 1/(i + 1)+ ε can be accepted,where i = 3, 4.

For each h, j , we use the following integer program to estimate the upper boundP(W ), where 1 ≤ h ≤ 4 and 1 ≤ j ≤ 2.

max. fh, j (X) =16∑

i=1

xiwi + 12d

11d − 1

(1−

16∑i=1

xi tdi+1

)(1)

s.t.16∑

i=1

xi tdi+1 ≤ 1

xi ≥ 0, integer.

X is a feasible set of items which fit into a single bin and xi is the number of type-i items in X . wi is the weight of a type-i item, defined by the weighting function

Wh, j (·) in the last subsection.(

1−∑16i=1 xi td

i+1

)is the upper bound of the total vol-

ume of all the small items in X . Hence, by the weight definition for a small item,12d

11d−1

(1−∑16

i=1 xi tdi+1

)is the upper bound of the total weight of all the small items

in X .In order to get a nice bound of P(W ), we need add more constraints to the above

integer programming (1) by Propositions 8 and 9. To do so, we consider five casesaccording to values of xi for 1 ≤ i ≤ 4.

Case 1:∑4

i=1 xi = 0. For 1 ≤ h ≤ 4 and 1 ≤ j ≤ 2, instead of (1), we solve thefollowing integer program to estimate P(W ).

max. fh, j (X) =16∑

i=5

xiwi + 12d

11d − 1

(1−

16∑i=5

xi tdi+1

)

s.t.16∑

i=5

xi tdi+1 ≤ 1;

7∑i=5

xi ≤ 2d;

j∑i=5

xi ≤ ( j − 6)d for 9 ≤ j ≤ 16;

xi ≥ 0, integer.

Case 2: x1 = 1. In this case, we have∑8

i=2 xi = 0. Instead of (1), we solve thefollowing integer program to estimate P(W ).

123

Page 13: A note on online hypercube packing

A note on online hypercube packing 233

max. fh, j (X) =16∑

i=1

xiwi + 12d

11d − 1

(1−

16∑i=1

xi tdi+1

)

s.t.16∑

i=1

xi tdi+1 ≤ 1;

x1 = 1;8∑

i=2

xi = 0;

j∑i=9

xi ≤ ( j − 6)d − ( j − 7)d for 9 ≤ j ≤ 11;

xi ≥ 0, integer.

Case 3: x2 = 1. In this case, we have∑6

i=3 xi = 0. Instead of (1), we solve thefollowing integer program to estimate P(W ).

max. fh, j (X) =16∑

i=1

xiwi + 12d

11d − 1

(1−

16∑i=1

xi tdi+1

)

s.t.16∑

i=1

xi tdi+1 ≤ 1;

x1 = 0; x2 = 1;6∑

i=3

xi = 0; x7 ≤ 2d − 1;

j∑i=7

xi ≤ ( j − 6)d − ( j − 7)d for 9 ≤ j ≤ 10;

xi ≥ 0, integer.

Case 4: x3 = 1. In this case, we have∑5

i=4 xi = 0.

max. fh, j (X) =16∑

i=1

xiwi + 12d

11d − 1

(1−

16∑i=1

xi tdi+1

)

s.t.16∑

i=1

xi tdi+1 ≤ 1;

123

Page 14: A note on online hypercube packing

234 X. Han et al.

2∑i=1

xi = 0; x3 = 1;

5∑i=4

xi = 0;7∑

i=6

xi ≤ 2d − 1;

j∑i=6

xi ≤ ( j − 6)d − ( j − 7)d for 9 ≤ j ≤ 10;

xi ≥ 0, integer.

Case 5: x4 = 1.

max. fh, j (X) =16∑

i=1

xiwi + 12d

11d − 1

(1−

16∑i=1

xi tdi+1

)

s.t.16∑

i=1

xi tdi+1 ≤ 1;

3∑i=1

xi = 0; x4 = 1;

7∑i=5

xi ≤ 2d − 1;9∑

i=5

xi ≤ 3d − 2d;

j∑i=5

xi ≤ ( j − 6)d − ( j − 8)d for 10 ≤ j ≤ 11;

xi ≥ 0, integer.

Theorem 10 The asymptotic performance ratio of A for square packing is at most2.1187.

Proof For square packing, we set parameters αi according to the following table.

i 1–4 5 6 7 8 9 10 11 12 13 14 15 16αi 0 0 0.1348 0.2 0 0.3096 0.2248 0.16 0.13 0.1 0.1 0.1 0.05

For each case, we call 4× 2 times of an integer programming solver (such as GLPK)and obtain the following results.

Wh(X)≤ Case 1 Case 2 Case 3 Case 4 Case 5

h = 1 1.502892 1.614192 1.910972 1.983840 2.117189h = 2 1.682624 1.614192 1.910972 2.118639 1.660205h = 3 1.768091 1.614192 2.110973 1.437015 1.660205h = 4 2.118540 2.070025 1.228476 1.346667 1.567036

Hence, P(W ) ≤ 2.1187. ��

123

Page 15: A note on online hypercube packing

A note on online hypercube packing 235

Theorem 11 The asymptotic performance ratio of A for cube packing is at most2.6161.

Proof For cube packing, we set parameters αi according to the following table.

i 1–4 5 6 7 8 9 10 11 12–16αi 0 0 0.1330 0.2368 0 0.3342 0.2454 0.1468 0.1

For each case, we call 4×2 times of an integer programming solver (such as GLPK)and obtain the following results.

Wh(X)≤ Case 1 Case 2 Case 3 Case 4 Case 5

h = 1 1.855562 1.983914 2.379091 2.481869 2.616006h = 2 2.007562 1.983914 2.379091 2.614869 2.356094h = 3 2.102110 1.983914 2.615894 2.127646 2.356094h = 4 2.616077 2.532079 1.707532 2.020473 2.249040

So, P(W ) < 2.6161. ��Remark 1 We have written a “C” programm to calculate the values of weights ofitems, then store data into files, finally call GLPK (actually API) to solve the integerprogramming for each case. To download the source file, go to: http://hanxin.mail01.googlepages.com/hypercube.c. The model files for using GLPK packages are givenin Appendix.

4 Concluding remarks

In this paper, we reduce the gaps between the upper and lower bounds of online squarepacking and cube packing. It seems possible to get a more precise upper bound byadding more constraints into the integer programming and classifying items more than17 groups. But the analysis will become more complicated and more difficult, sincewe are faced to solve a two dimensional knapsack problem, rather than one dimen-sional knapsack problem. Consequently, how to reduce the gaps is a challenging openproblem.

Acknowledgments The authors would like to thank the referees and the Associate Editor for their helpfulsuggestions.

123

Page 16: A note on online hypercube packing

236 X. Han et al.

Appendix A: Model files for GLPK and usage of our program

A Model Files for GLPK and Usage of Our Program

# this model for the case, no items with size larger than 1/2

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I}, integer, >=0;

maximize f: sum{i in 1..I} w[i]*x[i] + (1-sum{i in 1..I} c[i]*c[i]*x[i])* 1.2;

s.t. x0: sum{i in 1..I} c[i]*c[i]*x[i] <= 1;

extra{i in 1..4}: x[i] = 0;

x57: sum{i in 5..7} x[i]<= 4; # items with size larger than 1/3

x59: sum{i in 5..9} x[i] <=9;

x5{j in 10..16}: sum{i in 5..j} x[i] <= (j-6)*(j-6);

end;

# this model for the case, one item with size larger than 0.705

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I}, integer, >=0;

maximize f: sum{i in 1..I} w[i]*x[i] + (1-sum{i in 1..I} c[i]*c[i]*x[i])* 1.2;

s.t. x0: sum{i in 1..I} c[i]*c[i]*x[i] <= 1;

x1: sum{i in 1..1} x[i] = 1;

x28: sum{i in 2..8} x[i] =0;

# x57: sum{i in 5..7} x[i]<= 3; # items with size larger than 1/3

x9{j in 9..11}: sum{i in 9..j} x[i] <=(j-6)*(j-6)-(j-7)*(j-7);

end;

# this model for the case, one item with size larger than 0.6475

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I}, integer, >=0;

maximize f: sum{i in 1..I} w[i]*x[i] + (1-sum{i in 1..I} c[i]*c[i]*x[i])* 1.2;

s.t. x0: sum{i in 1..I} c[i]*c[i]*x[i] <= 1;

x1: sum{i in 1..1} x[i] = 0;

x2: x[2] = 1;

x36: sum{i in 3..6} x[i] =0;

x7: sum{i in 7..7} x[i]<= 3; # items with size larger than 1/3

x7j{j in 9..10}: sum{i in 7..j} x[i] <=(j-6)*(j-6)-(j-7)*(j-7);

end;

123

Page 17: A note on online hypercube packing

A note on online hypercube packing 237

# this model for the case, one item with size larger than 0.6

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I}, integer, >=0;

maximize f: sum{i in 1..I} w[i]*x[i] + (1-sum{i in 1..I} c[i]*c[i]*x[i])* 1.2;

s.t. x0: sum{i in 1..I} c[i]*c[i]*x[i] <= 1;

x12: sum{i in 1..2} x[i] = 0;

x3: x[3] = 1;

x45: sum{i in 4..5} x[i] =0;

x67: sum{i in 6..7} x[i]<= 3; # items with size larger than 1/3

x6j{j in 9..10}: sum{i in 6..j} x[i] <=(j-6)*(j-6)-(j-7)*(j-7);

end;

# this model for the case, no items with size larger than 1/2

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I}, integer, >=0;

maximize f: sum{i in 1..I} w[i]*x[i] + (1-sum{i in 1..I} c[i]*c[i]*c[i]*x[i])* 1.29925;

s.t. x0: sum{i in 1..I} c[i]*c[i]*c[i]*x[i] <= 1;

extra{i in 1..4}: x[i] = 0;

x57: sum{i in 5..7} x[i]<= 8; # items with size larger than 1/3

x59: sum{i in 5..9} x[i] <=27;

x5{j in 10..16}: sum{i in 5..j} x[i] <= (j-6)*(j-6)*(j-6);

end;

# this model for the case, no items with size larger than 1/2

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I}, integer, >=0;

maximize f: sum{i in 1..I} w[i]*x[i] + (1-sum{i in 1..I} c[i]*c[i]]*c[i]*x[i])* 1.29925;

s.t. x0: sum{i in 1..I} c[i]*c[i]*c[i]*x[i] <= 1;extra{i in 1..4}: x[i] = 0;

x57: sum{i in 5..7} x[i]<= 8; # items with size larger than 1/3

x59: sum{i in 5..9} x[i] <=27;

x5{j in 10..16}: sum{i in 5..j} x[i] <= (j-6)*(j-6)*(j-6);

end;

# this model for the case, one item with size larger than 0.705

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I}, integer, >=0;

maximize f: sum{i in 1..I} w[i]*x[i] + (1-sum{i in 1..I} c[i]*c[i]*c[i]*x[i])* 1.29925;

s.t. x0: sum{i in 1..I} c[i]*c[i]*c[i]*x[i] <= 1;

x1: sum{i in 1..1} x[i] = 1;

x28: sum{i in 2..8} x[i] =0;

x9{j in 9..11}: sum{i in 9..j} x[i] <=(j-6)*(j-6)*(j-6)-(j-7)*(j-7)*(j-7);

end;

123

Page 18: A note on online hypercube packing

238 X. Han et al.

# this model for the case, one item with size larger than 0.6475

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I}, integer, >=0;

maximize f: sum{i in 1..I} w[i]*x[i] + (1-sum{i in 1..I} c[i]*c[i]*c[i]*x[i])*1.29925;

s.t. x0: sum{i in 1..I} c[i]*c[i]*c[i]*x[i] <= 1;

x1: sum{i in 1..1} x[i] = 0;

x2: x[2] = 1;

x36: sum{i in 3..6} x[i] =0;

x7: sum{i in 7..7} x[i]<= 7; # items with size larger than 1/3

x7j{j in 9..10}: sum{i in 7..j} x[i] <=(j-6)*(j-6)*(j-6)-(j-7)*(j-7)*(j-7);

end;

# this model for the case, one item with size larger than 0.6

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I}, integer, >=0;maximize f: sum{i in 1..I} w[i]*x[i] + (1-sum{i in 1..I} c[i]*c[i]*c[i]*x[i])*1.29925;

s.t. x0: sum{i in 1..I} c[i]*c[i]*c[i]*x[i] <= 1;

x12: sum{i in 1..2} x[i] = 0;

x3: x[3] = 1;

x45: sum{i in 4..5} x[i] =0;

x67: sum{i in 6..7} x[i]<= 7; # items with size larger than 1/3

x6j{j in 9..10}: sum{i in 6..j} x[i] <=(j-6)*(j-6)*(j-6)-(j-7)*(j-7)*(j-7);

end;

# this model for the case, one item with size larger than 0.5

param I:=16;

param c{i in 1..I}>=0;

param w{i in 1..I};

var x{i in 1..I} >=0, integer;

maximize f: sum{i in 4..I} w[i]*x[i] + (1-sum{i in 4..I}c[i]*c[i]*c[i]*x[i])* 1.29925;

s.t. x0: sum{i in 4..I} c[i]*c[i]*c[i]*x[i] <= 1;

x13: sum{i in 1..3} x[i] = 0;

x4: x[4] = 1;

x57: sum{i in 5..7} x[i]<= 7;

x59: sum{i in 5..9} x[i] <=19;

x5j{j in 10..11}: sum{i in 5..j} x[i] <=(j-6)*(j-6)*(j-6)-(j-8)*(j-8)*(j-8);

end;

123

Page 19: A note on online hypercube packing

A note on online hypercube packing 239

To use our program under linux system:

• Install GLPK,

• Compile: “gcc -o hypercube.exe hypercube.c -lglpk”

• Run: “./hypercube.exe”

If there is an error message like “Could not load *.so” when you compile the source, then try toset “LD LIRARY PATH” as follows: “LD LIRARY PATH= $LD LIRARY PATH:/usr/local/lib”,then “export LD LIRARY PATH”.

References

Brown DJ (1979) A lower bound for on-line one-dimensional bin packing algorithms. Technical reportR864, Coordinated Science Laboratory, Urbana, Illinois

Coppersmith D, Paghavan P (1989) Multidimensional on-line bin packing: algorithms and worst case anal-ysis. Oper Res Lett 8:17–20

Csirik J, van Vliet A (1993) An on-line algorithm for multidimensional bin packing. Oper Res Lett 13:149–158

Epstein L, van Stee R (2005a) Optimal online algorithms for multidimensional packing problems. SIAMJ Comput 35(2):431–448

Epstein L, van Stee R (2005b) Online square and cube packing. Acta Inform 41(9):595–606Epstein L, van Stee R (2007) Bounds for online bounded space hypercube packing. Discrete Optimization

4(2):185–197Johnson DS, Demers AJ, Ullman JD, Garey MR, Graham RL (1974) Worst-case performance bounds for

simple one-dimensional packing algorithms. SIAM J Comput 3(4):299–325Liang FM (1980) A lower bound for online bin packing. Inform Process Lett 10:76–79Lee CC, Lee DT (1985) A simple on-line bin-packing algorithm. J ACM 32:562–572Miyazawa FK, Wakabayashi Y (2003) Cube packing. Theor Comput Sci 1-3(297):355–366Ramanan PV, Brown DJ, Lee CC, Lee DT (1989) On-line bin packing in linear time. J Algorithm 10:

305–326Seiden SS (2002) On the online bin packing problem. J ACM 49:640–671Seiden SS, van Stee R (2003) New bounds for multidimensional packing. Algorithmica 36(3):261–293van Vliet A (1992) An improved lower bound for on-line bin packing algorithms. Inform Process Lett

43:277–284Yao AC-C (1980) New algorithms for bin packing. J ACM 27:207–227

123