Online algorithms for 1space bounded multi dimensional bin packing and hypercube packing
 1.1k Downloads
 3 Citations
Abstract
In this paper, we study 1space bounded multidimensional bin packing and hypercube packing. A sequence of items arrive over time, each item is a ddimensional hyperbox (in bin packing) or hypercube (in hypercube packing), and the length of each side is no more than 1. These items must be packed without overlapping into ddimensional hypercubes with unit length on each side. In ddimensional space, any two dimensions i and j define a space P _{ ij }. When an item arrives, we must pack it into an active bin immediately without any knowledge of the future items, and 90^{∘}rotation on any plane P _{ ij } is allowed.
The objective is to minimize the total number of bins used for packing all these items in the sequence. In the 1space bounded variant, there is only one active bin for packing the current item. If the active bin does not have enough space to pack the item, it must be closed and a new active bin is opened. For ddimensional bin packing, an online algorithm with competitive ratio 4^{ d } is given. Moreover, we consider ddimensional hypercube packing, and give a 2^{ d+1}competitive algorithm. These two results are the first study on 1space bounded multi dimensional bin packing and hypercube packing.
Keywords
Online algorithms Bin packing 1space bounded Multi dimensional1 Introduction
Bin packing is a very fundamental problem in computer science, and has been well studied for more than thirty years. Given a sequence of items, we pack them into unitsize bins without overlapping. The objective is to minimize the number of bins for all items in the sequence.
In the online bin packing, there are two models: bounded space model and unbounded space model. If we do not impose a limit on the number of bins available for packing the items (called active bins), we call it unbounded space. Otherwise, if the number of active bins is bounded by a constant, and each item can only be packed into one of the active bins, we call it bounded space, which is more realistic in many applications. If none of the active bins has enough space to pack the arrival item, one of the active bins must be closed and a new active bin will be opened to pack that item.
In this paper, we consider 1space bounded multidimensional bin packing and hypercube packing. In the 1space bounded variant, the number of active bins is only one. If an item cannot be packed into the active bin, we have to close it and open a new bin to pack this item. In the 1space bounded ddimensional bin packing problem (d≥2), each item is a ddimensional hyperbox such that the length on each side is no more than 1, while in the ddimensional hypercube packing, each item is a ddimensional hypercube with side length no more than 1. The items must be packed into ddimensional hypercubes with side length 1. Any two dimensions i and j define a plane P _{ ij }. 90^{∘}rotation of the item in any plane P _{ ij } is allowed in 1space bounded bin packing, otherwise, the competitive ratio is unbounded (Fujita 2003).
1.1 Related works
Both the offline and online version of the bin packing problem have been well studied.
The offline bin packing is NPHard (Garey and Johnson 1979). For onedimensional bin packing, SimchiLevi gave a 1.5approximation algorithm (SimchiLevi 1994). Johnson and Garey (1985) gave an asymptotic 71/60approximation algorithm. An AFPTAS was given by Karmarkar and Karp (1982). For twodimensional bin packing. Chung et al. (1982) presented an approximation algorithm with an asymptotic performance ratio of 2.125. Caprara (2002) improved the upper bound to 1.69103. Bansal et al. (2006b) devised a randomized algorithm with an asymptotic performance ratio of at most 1.525. As for the offline lower bound of the approximation ratio, Bansal et al. (2006a) showed that the twodimensional bin packing problem does not admit any asymptotic polynomial time approximation scheme.
The online bin packing has been studied for more than thirty years. For onedimensional online bin packing, Johnson et al. (1974) showed that the First Fit algorithm (FF) has an asymptotic competitive ratio of 1.7. Yao (1980) improved the algorithm to obtain a better upper bound of 5/3. Lee and Lee (1985) introduced the class of Harmonic algorithms, and showed that an asymptotic competitive ratio of 1.63597 is achievable. Ramanan et al. (1989) further improved the upper bound to 1.61217. The best known upper bound is 1.58889, which was given by Seiden (2002). As for the lower bound of the competitive ratio of one dimensional bin packing, Yao (1980) showed that no online algorithm can have an asymptotic competitive ratio less than 1.5. The best known lower bound is 1.54014 (van Vliet 1992). For twodimensional online bin packing, Coppersmith and Raghavan (1989) gave the first online algorithm with asymptotic competitive ratio 3.25. Csirik et al. (1993) improved the upper bound to 3.0625. Based on the techniques of the Improved Harmonic, Han et al. (2001) improved the upper bound to 2.7834. Seiden and van Stee (2003) showed an upper bound of 2.66013 by implementing the Super Harmonic Algorithm. The best known upper bound of the competitive ratio for two dimensional bin packing is 2.5545, which was given by Han et al. (201). The best known lower bound is 1.907 (Blitz et al. 1996).
For bounded space online bin packing, Harmonic algorithm by Lee and Lee (1985) can be applied for one dimensional case, the competitive ratio is 1.69103 when the number of active bins goes to infinity. Csirik and Johnson (2001) presented an 1.7competitive algorithm (KBounded Best Fit algorithms (BBF _{ K })) for one dimensional bin packing using K active bins, where K≥2. For multidimensional case, Epstein and van Stee (2005b) gave a 1.69103^{ d }competitive algorithm using (2M−1)^{ d } active bins, where M≥10 is an integer such that M≥1/(1−(1−ε)^{1/(d+2)})−1, ε>0 and d is the dimension of the bin packing problem. For the 1space bounded variant, Fujita (2003) first gave an O((loglogm)^{2})competitive algorithm, where m is the width of the square bin and the size of each item is a×b (a, b are integers and a,b≤m). Chin et al. (2012) proposed an 8.84competitive packing strategy, then they further improved the upper bound to 5.155 (Zhang et al. 2010), they also gave the lower bound 3 for 1space bounded two dimensional bin packing.
For a special case where the items are squares (or hypercubes), there are also many results (Epstein and van Stee 2005a, 2007; Ferreira et al. 1999; Han et al. 2008; Januszewski and Lassak 1997; Leung et al. 1990; Kohayakawa et al. 2004; Meir and Moser 1968). For bounded space online square packing, Epstein and van Stee (2007) gave a 2.3692competitive algorithm, they also proved that the lower bound of the competitive ratio is at least 2.36343. For bounded space ddimensional hypercube packing, an O(d/logd)competitive algorithm was given (Epstein and van Stee 2007), however, to achieve this bound, the number of active bins is very large. Moreover, they proved that the asymptotic competitive ratio of bounded space hypercube packing is lower bounded by Ω(logd). Januszewski and Lassak (1997) proved that any sequence of square items with a total area of at most 5/16 can be packed into a unit bin. Han et al. (2008) studied a variant in which any packed item can be removed so as to guarantee a good competitive ratio and presented a packing algorithm that is 3competitive. Note that in the above two studies, there is only one bin to pack the square items.
The remaining part of this paper is organized as follows. In Sect. 2, we show the 4^{ d }competitive algorithm for 1space bounded ddimensional bin packing. In Sect. 3, a 2^{ d+1}competitive algorithm is given for 1space bounded ddimensional hypercube packing.
2 1space bounded ddimensional bin packing
Let d be the highest dimension of the item and hypercube, each item a is associated with a vector (a _{1},a _{2},…,a _{ d }), where a _{ i } (1≤i≤d) is the length in the ith dimension of item a.
In ddimensional space, any two dimensions i and j define a space P _{ ij }. For 1space bounded multidimensional bin packing problem, rotation 90^{∘} in any plane P _{ ij } is allowed. Otherwise, the performance ratio is unbounded. Consider an example of a sequence with 2n items: {A,B,A,B,…}, where A=(1/n,1,1,…,1) and B=(1,1/n,1,1,…,1). If rotation is not allowed, any two adjacent items cannot be packed into the same bin by any online algorithm, thus, the number of used bins is 2n. In the optimal packing, all A items can be packed into one bin, all B items can be packed into another bin, only two bins is enough to pack all these items. In this way, the performance ratio is n. If rotation is allowed, the first half part of items in the sequence can be packed into one bin by rotate B items 90^{∘} in the plane P _{12}. Similarly, the second half of items can be packed into another bin. Since rotation 90^{∘} in any plane P _{ ij } is allowed, we may assume that the lengths in dimensions of any item a is nonincreasing, i.e., a _{ i }≥a _{ j } (i<j) for each item.
Denote the size of an item a=(a _{1},a _{2},…,a _{ d }) to be \(\prod_{i=1}^{d}a_{i}\). We say a (k+1)dimensional hyperbox b=(b _{1},b _{2},…,b _{ k+1}) is a (k+1,h)hyperbox if b _{1}=⋯=b _{ k−1}=1, b _{ k }=1/2 and b _{ k+1}=h.
The performance ratio for k=2 to 6
k  2  3  4  5  6 

r _{ k }  5.15  30.86  127.969  518.156  2086.38 
\(r_{k}^{1/k}\)  2.269  3.13  3.36  3.49  3.57 
2.1 Packing strategy
Roughly speaking, items are recursively packed by the strategy from higher dimension to lower dimension. For an incoming item a, if it is large w.r.t. the dth dimension, we pack it in a topdown order along the dth dimension. Otherwise, it is small w.r.t. the dth dimension, we first pack it into a (d,h)hyperbox, then pack this (d,h)hyperbox into the bin in a bottomup manner. Since the length of (d−1)th dimension of the (d,h)hyperbox is 1/2, the lower part along dimension d is partitioned into the “left” side and the “right” side: the “left” side is the area such that the (d−1)th dimension is in the range [0,1/2], while the “right” side is in the range [1/2,1]. When packing the (d,h)hyperbox into the bin, we try to balance the heights of the left and right sides. When packing small item into (d,h)hyperbox, we have no need to consider the length of the dth dimension. In another word, packing small item into (d,h)hyperbox can be regarded as packing (d−1)dimensional item into a bin, therefore, the dimension of the packing problem is decreased by one. By implementing this idea, we can recursively pack items from higher dimension into lower dimension.
Note that in our algorithm, small items can be only packed into a (k+1,h)hyperbox with h<2a _{ k+1}. Let \(o_{k+1}'\) be the average occupancy ratio for packing small items into (k+1,h)hyperbox, we have the following fact.
Fact 1
\(o_{k+1}'=o_{k}/2\).
Proof
Since the length of the kth dimension is no more than 1/2, any small item a can be packed into the corresponding (k+1,h)hyperbox such that, h/2<a _{ k+1}≤h. Packing small items can be regarded as packing general items into kdimensional bin by doubling the length in the kth dimension of the small item. Thus, the average occupancy ratio is preserved in the first k dimensions. In the (k+1)th dimension, the length is at least h/2. Thus, \(o_{k+1}'=o_{k}/2\). □
The above algorithm recursively packing items from higher dimension to lower dimension, until dimension 3. We implement the algorithm in Zhang et al. (2010) for packing 2dimensional items because that the performance ratio r _{2}=5.15 is better than implementing the above algorithm in dimension 2.
2.2 Analysis of the strategy
When packing items which are small w.r.t. the kdimension into (k,h)hyperbox, we say the (k,h)hyperboxes with the same height h are of the same type. From Fact 1, the average occupancy ratio \(o_{k}'=o_{k1}/2\). Thus, for each kind of (k,h)hyperbox, except the last one, the average occupancy ratio is at least o _{ k−1}/2.
Fact 2
The total lengths in dimension k of the last hyperboxes of each type is at most \(2\cdot o_{k1}^{1/(k1)}\).
Proof
From previous definition \(h_{j}=2^{j}\cdot o_{k1}^{1/(k1)}\) (j=0,1,2,…), the length in dimension k of each type of (k,h _{ j })hyperbox is fixed. Thus, the total length is at most \(\sum_{j}h_{j}\le 2\cdot o_{k1}^{1/(k1)}\). □
If we only count the occupancy in one bin, the performance ratio is unbounded. For example, a bin contains a very small item, the next item is very large and cannot be packed together with the small one. We have to open a new bin for the later item. In this case, the occupancy in the previous bin is very small. This example gives us an heuristic to amortize the occupancies of adjacent two bins: if we have to open a new bin due to an item, this items has contribution to two bins, one is the bin it packed and the other is the previous bin it cannot be packed.
To amortize the occupancy of adjacent two bins, item from the upper part compensate half occupancy to the previous bin; item from the lower part compensate the part which is larger than the ratio o _{ k−1}/4 to the previous bin.

a large item with length y′ in dimension k cannot be packed into this bin.
By amortized analysis, the occupancy in this bin is at least  a small item with length y′ in dimension k cannot be packed into this bin.
 if \((y')^{k}\le \frac{y'\cdot o_{k1}}{4}\), this small item has no contribution to the previous bin. In this case, y′≤(o _{ k−1}/4)^{1/(k−1)}. The amortized occupancy is at least
 if \((y')^{k}> \frac{y'\cdot o_{k1}}{4}\), this small item has contribution \((y')^{k}\frac{y'\cdot o_{k1}}{4}\) to the previous bin. In this case, y′>(o _{ k−1}/4)^{1/(k−1)}. The amortized occupancy is at least the last inequality holds since k≥3 and \((o_{k1}/4)^{1/(k1)}< y'\le o_{k1}^{1/(k1)}<1/2\).

In Table 1, we give the performance ratio r _{ k } for some lower dimensions (k=2 to 6). We also compute \(r_{k}^{1/k}\), which will help us to give the upper bound for the performance ratio.
We can see that the performance ratio is increased very fast, but \(r_{k}^{1/k}\) is increased slowly.
Lemma 1
\(3.5<r_{k}^{1/k}<4\) if k>6 and \(3.5<r_{k1}^{1/(k1)}<4\).
Proof
Combine the above two statements and x _{6}=3.57, this lemma can be proved by induction. □
From Lemma 1, we conclude that x _{ k } is in the range (3.5,4) when k≥6. Therefore,
Theorem 2
The competitive ratio of the algorithm for 1space bounded ddimensional bin packing is 4^{ d }.
3 1Space bounded ddimensional hypercube packing
In this section, we consider a special case of the multidimensional bin packing, where each item is a hypercube with side length no more than 1. Since the lengths of each side of a hypercube are same, this kind of items can be packed regularly inside a bin. We will first describe the packing strategy for hypercubes, then give the performance analysis to show the competitive ratio of this strategy is 2^{ d+1}.
3.1 Packing strategy
 1.
In ddimensional hypercube packing, an item with side length 2^{−i−1}<x≤2^{−i } can be packed into a hypercube with side length 2^{−i }, and the occupation ratio in this hypercube is at least 2^{−d }.
 2.
ddimensional hypercube can be regularly partitioned: a hypercube with side length 2^{−i } can be partitioned into 2^{ d } smaller hypercubes with side length 2^{−i−1}.
In our packing strategy, we will find a hypercube with proper size for each incoming item. If a hypercube inside the bin is assigned to pack an item, this hypercube cannot be used for other item. According to the first observation, the occupation ratio in this hypercube is guaranteed. To pack an item into a hypercube with proper size, we may partition the bin regularly according to the method from the second observation.
By implementing the partition mentioned above, we can define the packing configuration of the active bin as follows. Define 2^{−i } hypercube to be the hypercube with side length 2^{−i }. Let B=(b _{0},b _{1},b _{2},…) denote the current packing configuration of an active bin, where b _{ i } denotes the number of empty 2^{−i }hypercubes. If b _{ j }=0 for all j≥i, we will ignore b _{ j } (j≥i) in B.
Initially, the whole bin is empty, in such configuration, B=(1). Suppose an item with side length 1/3 comes, to pack this item, the bin will be partitioned into 2^{ d } 1/2hypercubes and use one 1/2hypercube to pack this item. After that, the configuration will be changed to B=(0,2^{ d }−1).
3.2 Performance analysis
Lemma 3
In a configuration B, 0≤b _{ i }≤2^{ d }−1 and all empty 2^{−i }hypercubes are within a 2^{−i+1}hypercube.
Proof
From the packing strategy, only when a 2^{−i }hypercube will be used and b _{ i }=0, we partition a larger hypercube to create 2^{ d } 2^{−i }hypercubes. After the partition, one 2^{−i }hypercube will be used, either for packing an item, or for partitioning to smaller hypercubes. Thus, b _{ i } is at most 2^{ d }−1.
When these 2^{ d } 2^{−i }hypercubes are created, they are within a 2^{−i+1}hypercube. Only when these 2^{ d } hypercubes are all used up, we will open another 2^{ d } 2^{−i }hypercubes. Therefore, at any time, all empty 2^{−i }hypercubes are within a 2^{−i+1}hypercube. □
Lemma 4
In a configuration B, for any i≥0, the total size of empty 2^{−j }hypercubes (j>i) is no more than the size of a 2^{−i }hypercube.
Proof
Suppose in the configuration B, i<j _{1}<j _{2}<⋯<j _{ ℓ } such that \(b_{j_{x}}>0\) (1≤x≤ℓ). From Lemma 3, we have \(b_{j_{x}}\le 2^{d}1\). In ddimensional space, the ratio between the sizes of a 2^{−j }hypercube and a 2^{−j−1}hypercube is 2^{ d }. Thus, the total size of these \(2^{j_{x}}\)hypercubes is no more than the size of a 2^{−i }hypercube. □
Theorem 5
The competitive ratio of the packing strategy for hypercubes is 2^{ d+1}.
Proof
Suppose at this time, an item comes and we have to open a new bin according to the packing strategy. This happens when the item with side length 2^{−i−1}<x≤2^{−i } and b _{ j }=0 for all j≤i in the configuration B. The size of this item is x ^{ d }>2^{−id−d }.
In the bin packing problem, we are interested in the asymptotic competitive ratio, according to the above analysis, this ratio is 2^{ d+1}. □
Notes
Open Access
This article is distributed under the terms of the Creative Commons Attribution License which permits any use, distribution, and reproduction in any medium, provided the original author(s) and the source are credited.
References
 Bansal N, Correa JR, Kenyon C, Sviridenko M (2006a) Bin packing in multiple dimensions: inapproximability results and approximation schemes. Math Oper Res 31(1):31–49 MathSciNetMATHCrossRefGoogle Scholar
 Bansal N, Caprara A, Sviridenko M (2006b) Improved approximation algorithm for multidimensional bin packing problems. In: FOCS 2006, pp 697–708 Google Scholar
 Blitz D, van Vliet A, Woeginger GJ (1996) Lower bounds on the asymptotic worstcase ratio of online bin packing algorithms. Unpublished manuscript Google Scholar
 Caprara A (2002) Packing 2dimensional bins in harmony. In FOCS 2002, pp 490–499 Google Scholar
 Chin FYL, Ting HF, Zhang Y (2012) 1space bounded algorithms for 2dimensional bin packing. Int J Found Comput Sci (to appear) Google Scholar
 Chung FRK, Garey MR, Johnson DS (1982) On packing twodimensional bins. SIAM J Algebr Discrete Methods 3(1):66–76 MathSciNetMATHCrossRefGoogle Scholar
 Coppersmith D, Raghavan P (1989) Multidimensional online bin packing: algorithms and worst case analysis. Oper Res Lett 8:17–20 MathSciNetMATHCrossRefGoogle Scholar
 Csirik J, Johnson DS (2001) Bounded space online bin packing: best is better than first. Algorithmica 31:115–138 MathSciNetMATHCrossRefGoogle Scholar
 Csirik J, Frenk J, Labbe M (1993) Twodimensional rectangle packing: online methods and results. Discrete Appl Math 45(3):197–204 MathSciNetMATHCrossRefGoogle Scholar
 Epstein L, van Stee R (2005a) Online square and cube packing. Acta Inform 41(9):595–606 MathSciNetMATHCrossRefGoogle Scholar
 Epstein L, van Stee R (2005b) Optimal online algorithms for multidimensional packing problems. SIAM J Comput 35(2):431–448 MathSciNetMATHCrossRefGoogle Scholar
 Epstein L, van Stee R (2007) Bounds for online bounded space hypercube packing. Discrete Optim 4:185–197 MathSciNetMATHCrossRefGoogle Scholar
 Ferreira CE, Miyazawa EK, Wakabayashi Y (1999) Packing squares into squares. Pesqui Oper 19:223–237 Google Scholar
 Fujita S (2003) Online gridpacking with a single active grid. Inf Process Lett 85:199–204 MATHCrossRefGoogle Scholar
 Garey MR, Johnson DS (1979) Computers and intractability: a guide for the theory of NPcompleteness. Freeman, San Francisco Google Scholar
 Han X, Fujita S, Guo H (2001) A twodimensional harmonic algorithm with performance ratio 2.7834. IPSJ SIG Not 93:43–50 Google Scholar
 Han X, Iwama K, Zhang G (2008) Online removable square packing. Theory Comput Syst 43(1):38–55 MathSciNetMATHCrossRefGoogle Scholar
 Han X, Chin F, Ting HF, Zhang G, Zhang Y (2011) A new upper bound 2.5545 on 2D online bin packing. ACM Trans Algorithms 7(4):50 MathSciNetCrossRefGoogle Scholar
 Januszewski J, Lassak M (1997) Online packing sequences of cubes in the unit cube. Geom Dedic 67:285–293 MathSciNetMATHCrossRefGoogle Scholar
 Johnson DS, Garey MR (1985) A 71/60 theorem for binpacking. J Complex 1:65–106 MathSciNetMATHCrossRefGoogle Scholar
 Johnson DS, Demers AJ, Ullman JD, Garey MR, Graham RL (1974) Worstcase performance bounds for simple onedimensional packing algorithms. SIAM J Comput 3(4):299–325 MathSciNetCrossRefGoogle Scholar
 Karmarkar N, Karp RM (1982) An efficient approximation scheme for the onedimensional bin packing problem. In: Proc 23rd ann IEEE symp on foundations of comput sci. IEEE Computer Society, Los Alamitos, pp 312–320 Google Scholar
 Kohayakawa Y, Miyazawa FK, Raghavan P, Wakabayashi Y (2004) Multidimensionalcube packing. Algorithmica 40(3):173–187 MathSciNetMATHCrossRefGoogle Scholar
 Lee CC, Lee DT (1985) A simple online bin packing algorithm. J Assoc Comput Mach 32:562–572 MathSciNetMATHCrossRefGoogle Scholar
 Leung JYT, Tam TW, Wong CS, Young GH, Chin FYL (1990) Packing squares into a square. J Parallel Distrib Comput 10:271–275 MathSciNetCrossRefGoogle Scholar
 Meir A, Moser L (1968) On packing of squares and cubes. J Comb Theory 5:126–134 MathSciNetMATHCrossRefGoogle Scholar
 Ramanan PV, Brown DJ, Lee CC, Lee DT (1989) Online bin packing in linear time. J Algorithms 10:305–326 MathSciNetMATHCrossRefGoogle Scholar
 Seiden SS (2002) On the online bin packing problem. J ACM 49:640–671 MathSciNetCrossRefGoogle Scholar
 Seiden S, van Stee R (2003) New bounds for multidimensional packing. Algorithmica 36:261–293 MathSciNetMATHCrossRefGoogle Scholar
 SimchiLevi D (1994) New worstcase results for the binpacking problem. Nav Res Logist 41:579–585 MathSciNetMATHCrossRefGoogle Scholar
 van Vliet A (1992) An improved lower bound for online bin packing algorithms. Inf Process Lett 43:277–284 MATHCrossRefGoogle Scholar
 Yao ACC (1980) New algorithms for bin packing. J ACM 27:207–227 MATHCrossRefGoogle Scholar
 Zhang Y, Chen J, Chin FYL, Han X, Ting HF, Tsin YH (2010) Improved online algorithms for 1space bounded 2dimensional bin packing. In: Proc of the 21th annual international symposium on algorithms and computation (ISAAC 2010). LNCS, vol 6507. Springer, Berlin, pp 242–253 Google Scholar