A note on the Kenyon–Remila strip-packing algorithm

A note on the Kenyon–Remila strip-packing algorithm

Information Processing Letters 112 (2012) 10–12 Contents lists available at SciVerse ScienceDirect Information Processing Letters www.elsevier.com/l...

119KB Sizes 1 Downloads 21 Views

Information Processing Letters 112 (2012) 10–12

Contents lists available at SciVerse ScienceDirect

Information Processing Letters www.elsevier.com/locate/ipl

A note on the Kenyon–Remila strip-packing algorithm Maxim Sviridenko IBM T.J. Watson Research Center, P.O. Box 218, Yorktown Heights, NY 10598, USA

a r t i c l e

i n f o

a b s t r a c t

Article history: Received 6 July 2011 Received in revised form 30 September 2011 Accepted 4 October 2011 Available online 8 October 2011 Communicated by B. Doerr

We show that a modification of the Kenyon–Remila algorithm for the strip-packing problem yields an improved bound on the value of the approximate solution. As a corollary we derive that  there exists a polynomial-time algorithm that always finds a solution of value OPT + O ( OPT log OPT ) where OPT is the optimal value. © 2011 Elsevier B.V. All rights reserved.

Keywords: Bin packing Approximation algorithms Strip packing



1. Introduction

H ( R )  (1 + ε )OPT ( R ) + O

In the minimum strip-packing problem (or two-dimensional cutting stock problem) we are given a set of twodimensional rectangles indexed by R = {1, . . . , n}. We identify a rectangle with its index. For each rectangle i ∈ R, we are given its height h i ∈ (0, 1] and width w i ∈ (0, 1]. A packing of a set S ⊆ R of rectangles into a larger rectangle B of size W × H is feasible if rectangles are packed with edges parallel to the edges of B without overlaps and rotations. The goal is to find a minimal H such that there exists a feasible packing of all rectangles from R into a rectangle of size 1 × H . Since the minimum strip-packing problem is a generalization of the classical bin packing problem we obtain that the problem is strongly NP-hard. Kenyon and Remila [4] proved Theorem 1. For any constant ε > 0, there exists an algorithm with running time O (n log n + ε −6 log3 n log3 ε1 ) that finds a feasible packing of n rectangles from the set R with heights and widths at most one into a strip of width one and height H ( R ) such that

© 2011



ε2

where OPT ( R ) is the optimal value of the minimum strippacking problem. By applying the Kenyon–Remila algorithm with ε = OPT ( R )−1/3 and noticing that OPT  n we obtain a polynomial-time algorithm that always finds a feasible packing into a strip of height at most OPT ( R ) + O (OPT ( R )2/3 ). In contrast, for the classical bin packing problem there is an algorithm [3] that always finds a solution of value at most OPT ( R ) + O (log2 OPT ( R )). A natural question arises if we can find an algorithm for the minimum strip-packing problem with better asymptotic behavior, ideally matching the poly-logarithmic bound of [3]. A possible approach is to find an algorithm with better additive factor than O ( ε12 ). The running time of such an algorithm must have a polynomial dependence on ε since we are going to balance the absolute error of (1 + ε ) with the additive error of O ( ε12 ).1 In this note we prove

1 This is why the algorithm of Jansen and Solis-Oba [2] with smallest possible additive error of 1 but exponential dependence of running time on ε would not give us an improvement.

E-mail address: [email protected]. 0020-0190/$ – see front matter doi:10.1016/j.ipl.2011.10.003

1

Elsevier B.V. All rights reserved.

M. Sviridenko / Information Processing Letters 112 (2012) 10–12

11

An immediate implication of Lemma 1 is the following corollary. Corollary 1. Given a set of rectangles R with w = maxi ∈ R w i and h = maxi ∈ R h i . Then NFDH heuristic applied to the set of rectangles R packs this  set of rectangles into the strip of width one and height h + i ∈ R h i w i /(1 − w ). 3. Sketch of Kenyon–Remila result

Fig. 1. NFDH packing.

Theorem 2. For any constant ε > 0, there exists an algorithm with running time O (n log n + ε −6 log3 n log3 ε1 ) that finds a feasible packing of n rectangles from the set R with heights and widths at most one into a strip of width one and height H ( R ) such that



H ( R )  (1 + ε )OPT ( R ) + O

log 1/ε



ε

where OPT ( R ) is the optimal value of the minimum strippacking problem. By choosing

ε=



log OPT ( R ) , OPT ( R )

we obtain a polynomial-

Let S = {i ∈ R | w i  ε } and B = R \ S be the sets of small and large rectangles, respectively. Let OPT f r ( R ) be the optimal solution of the relaxation of the minimum strip-packing problem where we allow to cut rectangles horizontally into an arbitrary number of pieces. Note that there always exists a solution to the relaxed problem with at most n cuts per rectangle (by reformulating the problem using linear programming and using properties of the basic feasible solutions, see [4] for details). Kenyon–Remila’s proof of Theorem 1 is basically a combination of the following two lemmas.

¯ of t = O (1/ε 2 ) widths Lemma 2. It is possible to define a set W ε < w¯ 1  · · ·  w¯ t  1 such that if we round the width of each

time algorithm that always find a feasible packing into the  strip of height at most OPT ( R ) + O ( OPT ( R ) log OPT ( R )).

¯ obtaining a new set rectangle in B up to the nearest width in W of rectangles B¯ we have

2. Next Fit Decreasing Height (NFDH) algorithm

OPT f r ( S ∪ B¯ )  (1 + ε )OPT f r ( R ) + O (t ).

This idea was first introduced by Coffman et al. [1]. Suppose we are given a collection of rectangles that need to be packed in a 2D bin. The NFDH algorithm orders the rectangles in the non-increasing order of their heights and packs them into sublevels, as shown in Fig. 1. The bottom of the first level coincides with the bottom of the strip. Items are taken from the list and packed in the current level with their bottoms coinciding with the bottom of the level, and pushed as far to the left as possible, given the items already packed in the level. This continues until no items remain (in which case the packing is complete) or the current item is wider than the space remaining at the right side of the strip/bin. In this latter case, the level is closed and a new level is created whose bottom coincides with the top of the leftmost (and hence tallest) item in the old level. This is a complete description of the algorithm in the strip-packing case. If we are packing into a bin or fixed rectangle (which is needed to design a APTAS for the strip packing problem), then we stop if the current item does not fit in the new level because it is taller than the gap between the bottom of the new level and the top of the bin (or rectangle). Let w and h be the maximum width and height of a set of rectangles. If w and h are relatively small compared to the dimensions of the bin, then the packing produced by NFDH is very efficient. Lemma 1. (See Coffman et al. [1].) Given a set of rectangles with width at most w and height at most h, if NFDH is used to pack these items in a bin of width a and height b, then the total used area in that bin is at least (a − w )(b − h) (provided there are enough rectangles that NFDH never runs out of them).

Lemma 3. Given the set of small rectangles S and large rectangles B¯ such that there are at most t distinct widths of rectangles ¯ There exists an algorithm with running time O (n log n + in B. ε−6 log3 n log3 ε1 ) that finds a feasible packing of height H ( S ∪ B¯ ) such that

H ( S ∪ B¯ )  (1 + ε )OPT f r ( S ∪ B¯ ) + O (t ). Since all original large rectangles from the set B fit into ¯ the spots occupied by the corresponding rectangles in B, combining Lemmas 2 and 3 we derive Theorem 1. 4. Our result We prove a strengthened version of Lemma 2 that in combination with Lemma 3 implies Theorem 2.

¯ of t = O ( Lemma 4. It is possible to define a set W ε ) ¯ 1  ···  w ¯ t  1 such that if we round the width widths ε < w ¯ obtaining a of each rectangle in B up to the nearest width in W new set of rectangles B¯ we have log 1/ε

OPT f r ( S ∪ B¯ )  (1 + 4ε )OPT f r ( R ) + O

  1 .

ε

Proof. First we partition the set B of large rectangles into the sets B j for j = 1, . . . , q = log2 1/ε  where B j =  {i ∈ B | w i ∈ (2− j , 2− j+1 ]}. Let H j = i ∈ B j h i be the total height of all rectangles in the set B j . Since the total area of all the rectangles in the instance is a lower bound on the optimal value of the relaxed problem we have

12

q 

M. Sviridenko / Information Processing Letters 112 (2012) 10–12

2− j H j 

j =1



w i h i  OPT f r ( R ).

(1)

i∈ R

For each set B j we define 1/ε groups G τ j where τ = 1, . . . , 1/ε of height ε H j . More precisely, assume that we already defined groups G τ  j for τ  < τ and B j is the set of

remaining pieces of rectangles (initially B j

= B j ) that were not assigned to any group yet. We assign largest width pieces of rectangles from B j into the group G τ j one by one until the total height of such rectangles reaches ε H j . The last piece (or a full rectangle) that we place into the group G τ j might be cut into two pieces to guarantee that this group has total height exactly ε H j . The rectangles that are cut in few pieces and placed into different groups are not rounded. For each j = 1, . . . , q and τ = 1, . . . , 1/ε round widths of remaining rectangles in group G τ j up to the largest width of a piece in that group. After the rounding we obtain a new set of large rectangles B¯ containing

 

t=O

q

ε



=O

log 1/ε



ε

different widths. Given a solution of the relaxed strip-packing problem for the original set of rectangles of value OPT f r ( S ∪ B ) we now define a solution for the rounded instance. First we delete all pieces of rectangles from groups G 1 j from the solution for each j = 1, . . . , q. We also delete all rectangles that were cut in pieces and placed into different groups. Let C j ⊆ B j be the set of these rectangles for j = 1, . . . , q. Obviously, |C j |  1/ε . After that for each j = 1, . . . , q and τ = 2, . . . , 1/ε we move the remaining rectangles from G τ j with rounded widths to the spots occupied by the pieces of (not rounded) rectangles from G τ −1 j in the solution for the original instance, possibly by introducing new horizontal cuts. All the pieces from the group G 11 can be packed into a rectangle of size ε H1 × 1. The total area of the rectangles in the group G 1 j for j  2 is at most 2− j +1 ε H j and the

width of these rectangles is upper bounded by 2− j +1 . By utilizing Corollary 1 we can pack all rectangles from the set G 1 j for j  2 into the strip of width one and height



1 + 1 − 2− j +1

− 1 

w i h i  1 + 2− j +2 ε H j .

i ∈G 1 j

Analogously, all rectangles from C 1 can be packed into a rectangle of size ε1 × 1. By Corollary 1 we can pack all rectangles from the set C j for j  2 into the strip of width one and height



1 + 1 − 2− j +1

− 1 

1 w i h i  1 + 2− j +2 .

ε

i ∈C j

Therefore, applying inequality (1) we derive

OPT f r ( S ∪ B¯ ) fr

 OPT ( R ) +

q  

2+2

j =1

= OPT f r ( R ) + 2q + O

− j +2 1

ε

+2

  1

ε

+ 4ε 1

ε

q 



εH j

2− j H j

j =1

   (1 + 4ε )OPT f r ( R ) + O

− j +2

.

2

References [1] E.G. Coffman, M.R. Garey, D.S. Johnson, R.E. Tarjan, Performance bounds for level-oriented two dimensional packing algorithms, SIAM J. Computing 9 (1980) 808–826. [2] K. Jansen, R. Solis-Oba, New approximability results for 2-dimensional packing problems, in: Proceedings of MFCS 2007, in: Lecture Notes in Computer Science, vol. 4708, 2007, pp. 103–114. [3] N. Karmarkar, R.M. Karp, An efficient approximation scheme for the one-dimensional bin-packing problem, in: Proceedings of Foundations of Computer Science, 1982, pp. 312–320. [4] C. Kenyon, E. Rémila, A near-optimal solution to a two-dimensional cutting stock problem, Mathematics of Operations Research 25 (2000) 645–656.