Professional Documents
Culture Documents
Discrete Optimization
a r t i c l e i n f o a b s t r a c t
Article history: We propose exact algorithms for the two-dimensional strip packing problem (2SP) with and without 90°
Received 31 January 2007 rotations. We first focus on the perfect packing problem (PP), which is a special case of 2SP, wherein all
Accepted 28 August 2008 given rectangles are required to be packed without wasted space, and design branch-and-bound algo-
Available online 6 September 2008
rithms introducing several branching rules and bounding operations. A combination of these rules yields
an algorithm that is especially efficient for feasible instances of PP. We then propose several methods of
Keywords: applying the PP algorithms to 2SP. Our algorithms succeed in efficiently solving benchmark instances of
Branch-and-bound
PP with up to 500 rectangles and those of 2SP with up to 200 rectangles. They are often faster than exist-
Combinatorial optimization
Strip packing
ing exact algorithms specially tailored for problems without rotations.
Rectangles Crown Copyright Ó 2008 Published by Elsevier B.V. All rights reserved.
Two-dimension
1. Introduction algorithm for 2SP, and many related papers have appeared; e.g.,
an efficient implementation [5] and variants of BLF [15,19]. These
We consider the two-dimensional strip packing problem (2SP) algorithms first decide a sequence of rectangles and then place
that requires all given rectangles to be placed orthogonally without rectangles one by one in this order at an appropriate position. Dif-
overlap into one rectangular container, called the strip, with a fixed ferent types of construction heuristics have also been proposed re-
width and variable height so as to minimize the height of the strip. cently; e.g., the best-fit heuristic [4], a recursive heuristic [31] and
The problem is known under various names including the (orthog- others [9,28]. Dowsland [6] was one of the early papers that pre-
onal) rectangular strip packing problem. Among the many variants of sented metaheuristics for rectangle packing problems. Her simu-
rectangle packing problems, 2SP is one of the problems most inten- lated annealing explores placements directly, allowing infeasible
sively studied [8]. As a special case of 2SP, we also consider the per- solutions. The genetic algorithm in [3] also works on placements
fect packing problem (PP) that requires a determination of whether directly. Construction heuristics are often incorporated in meta-
all given rectangles can be placed, without overlap or wasted heuristics to improve the quality of solutions. One of the common
space, into a container with a fixed width and height. Regarding ways is to use metaheuristics for searching sequences from
rotations of rectangles, we consider the following two cases: (1) which BLF (or similar heuristics) generates good placements
rotations of 90° are allowed and (2) no rotations are allowed. Most [7,14,15,19,29]. In this scheme, a sequence is an encoded solution
of the variants of the rectangle packing problem, including 2SP and and the heuristic such as BLF is a decoding algorithm. Lesh et al.
PP, are known to be NP-hard. Rectangle packing problems have [18] presented a simple algorithm called BLD* for randomly gener-
many applications in the steel and textile industries, and they also ating good sequences for BLF. Metaheuristics incorporating differ-
have indirect applications in scheduling problems [26] and in other ent types of heuristics have also been proposed; e.g., GRASP [1],
areas [8,11]. Some theoretical aspects and heuristic/exact algo- local search [28] and genetic algorithm [30]. Murata et al. [25] pro-
rithms are summarized in [20]. posed a simulated annealing and Imahori et al. [11,12] presented
Heuristics and metaheuristics are important in designing prac- iterated local search algorithms based on a different coding scheme
tical algorithms for rectangle packing problems. Baker et al. [2] called the sequence-pair representation. For more about heuristic
proposed a construction method called the bottom-left-fill (BLF) algorithms, see e.g., [13].
With the exception of few papers published recently [17,21],
most results presented in the literature on 2SP and PP concern heu-
* Corresponding author. Tel.: +81 75 753 5504; fax: +81 75 753 4866.
ristic algorithms. This may be due to the fact that relative to heu-
E-mail addresses: kenmochi@amp.i.kyoto-u.ac.jp (M. Kenmochi), ima@amp.
i.kyoto-u.ac.jp (T. Imamichi), nonobe@hosei.ac.jp (K. Nonobe), yagiura@nagoya-u. ristic algorithms, the size of instances that exact algorithms can
jp (M. Yagiura), nag@amp.i.kyoto-u.ac.jp (H. Nagamochi). handle tends to be small. However, there are many important
0377-2217/$ - see front matter Crown Copyright Ó 2008 Published by Elsevier B.V. All rights reserved.
doi:10.1016/j.ejor.2008.08.020
74 M. Kenmochi et al. / European Journal of Operational Research 198 (2009) 73–83
the space below the boundary is filled with rectangles that have 4.3. Bounding operations
been placed without wasted space. The leftmost points of the hori-
zontal lines of the boundary (the four dots in Fig. 2b) are called cor- This subsection describes three rules for bounding operations:
ner points. For a staircase placement p, we define the number of the the dynamic programming cut (DP cut), the bounding rule based
corner points on the staircase as the number of stairs KðpÞ. The on the staircase placement and the remaining rectangles, and the
algorithm performs branching operations by placing rectangles at LP cut, which are explained in Sections 4.3.1, 4.3.2 and 4.3.3,
corner points, keeping the placement as a staircase placement. respectively.
Therefore, in a search tree based on this branching operation, a node
v is a child of a node u if and only if v corresponds to a staircase 4.3.1. Dynamic programming cut (DP cut)
placement pv that is obtainable by placing one of the remaining For a placement p of a subset I0 I of rectangles, there are ver-
rectangles at a corner point of the placement pu of u. It is not diffi- tical gaps between the top of the container and upper edges of
cult to see that the correctness of this branching operation is de- rectangles, and horizontal gaps between the side edges of rectan-
rived from the following lemma: gles or one of the sides of the container (Fig. 3). All such gaps
should be filled with the remaining rectangles in I n I0 so that a per-
Lemma 2. For any staircase placement with at least one rectangle, fect packing for I is obtained. To be more precise, a vertical (resp.,
there exists a rectangle such that the two conditions (4.3) and (4.4) horizontal) gap is the length of a vertical (resp., horizontal) line
hold even after its removal. segment that satisfies the following three conditions:
Since the number of stairs KðpÞ is less than or equal to dn=2e for (1) Any point on the line segment is in clðU p Þ.
any staircase placement obtained from a perfect packing of I by (2) Both end points of the line segment are on the boundary of
Lemma 2, we do not generate any placement such that the number clðU p Þ.
of stairs is more than dn=2e. The idea of using staircase placements (3) Other points on the line segment are not on the boundary of
was first proposed in [22] in a more general form for 2SP. clðU p Þ.
In the case of PP with rotations, we consider placements of each
rectangle both with and without rotation at each corner point. For convenience, we denote that a gap g is realized by lengths
l1 ; l2 ; . . . ; lk if g ¼ l1 þ l2 þ þ lk holds. If there is a gap that cannot
4.2.2.1. Limitation on the number of stairs. Perfect placements some- be realized by any combination of the lengths of the remaining
times consist of several compound rectangles, and such place- rectangles I n I0 , then we can terminate the node for p. We call this
ments do not require many stairs to place rectangles with the bounding rule DP cut and use this with both branching rules in Sec-
staircase placement strategy. To find such placements more tions 4.2.1 and 4.2.2.
quickly, we introduce the following heuristic rule. We set an upper We compute whether each of the gaps can be realized by a com-
limit j on the number of stairs during the search; i.e., if a generated bination of the lengths, wi ; hi ; i 2 I n I0 , in the following way. We
node corresponds to a staircase placement p whose number of first consider the case with rotations. For a given placement
stairs is KðpÞ > j, then we terminate the node immediately. If a gi- p ¼ fðxi ; yi Þji 2 I0 g, we denote the remaining rectangles in I n I0 by
ven instance is feasible, a feasible solution is often found more i ¼ 1; 2; . . . ; m for simplicity. The problem of judging whether a gi-
quickly using this heuristic rule [24]. When initiating this heuristic, ven gap can be filled is formulated as a problem similar to the sub-
we first set j ¼ 2. If the search terminates all active nodes without set sum problem, and it can be solved by using dynamic
finding a feasible placement with the current limit j, then we in- programming (DP) [23]. Let zri (resp., zui ) be a 0, 1-variable that
crease the limit by one. We repeat this process until j becomes takes value 1 if we use the rotated (resp., unrotated) rectangle i
4. If we are unable to find a feasible solution with j ¼ 4, we in- to fill the gap, and 0 otherwise. Then, for t ¼ 1; 2; . . . ; m and an inte-
crease the limit j to dn=2e, which is equivalent to the case with ger p P 0, the problem Q t ðpÞ of finding a combination of rectangles
no limitation on KðpÞ. If no feasible solution is found even with from f1; 2; . . . ; tg that realizes vertical gap p P 0 is formally de-
j ¼ dn=2e, then we conclude that the instance is infeasible. scribed as follows:
angle i2 at b and the node v generated by placing rectangle i2 at b zri þ zui 6 1; 8i ¼ 1; 2; . . . ; t; ð4:7Þ
after placing rectangle i1 at a are descendants of the node for p, zri ; zui 2 f0; 1g; 8i ¼ 1; 2; . . . ; t: ð4:8Þ
and have the same placement pu ¼ pv . Below are some techniques
we use to reduce such redundancy.
For each rectangle r 2 I, we introduce a list Lr that stores the
positions already searched, and check the list whenever we place
rectangle r. This technique is also used in [21], but we have mod-
ified it for use with our algorithms as follows: If there are rectan-
gles i and j whose shapes are same (i.e., wi ¼ wj and hi ¼ hj ), then
they share the same list.
Moreover, we maintain another list that stores all the searched
placements with a small number of stairs (to a maximum of two
stairs). We check the list whenever the number of stairs Kðpv Þ of
the placement pv of the current node v with rectangle set I0 is less
than or equal to two. If the list contains a placement p for the same
I0 and all the coordinates of corner points of p and pv are the same,
then we terminate the node v. Fig. 3. An example of vertical and horizontal gaps for a placement p.
M. Kenmochi et al. / European Journal of Operational Research 198 (2009) 73–83 77
(Note that, though our objective is to find a solution to Q m ðpÞ, for 4.3.3. LP cut
convenience we define the problem for all t 6 m.) Let v t ðpÞ be 1 if Formulating PP as an integer programming problem, we con-
there exists a solution to Q t ðpÞ and 0 otherwise. sider a bounding operation based on its linear programming (LP)
relaxation. This operation is applicable to both branching strategies
Lemma 3. All v t ðpÞ; t ¼ 1; 2; . . . ; m can be computed in OðmðW þ HÞÞ
in Sections 4.2.1 and 4.2.2.
time.
We first explain the case with rotations. We define variables
zui;x;y and zri;x;y for i 2 I and ðx; yÞ 2 B ¼ f0; 1; . . . ; Wg f0; 1; . . . ; Hg,
Proof. We can compute v t ðpÞ by
where their meanings are as follows:
1; p ¼ 0;
v 0 ðpÞ ¼ ð4:9Þ
zui;x;y ¼ 1 if rectangle i is placed at ðx; yÞ without rotation, and 0
0; otherwise;
v t ðpÞ ¼ maxfv t1 ðpÞ; v t1 ðp wt Þ; v t1 ðp ht Þg; t ¼ 1; 2; . . . ; m; otherwise.
zri;x;y ¼ 1 if rectangle i is placed at ðx; yÞ with rotation, and 0
ð4:10Þ
otherwise.
where (4.9) is the boundary condition that represents trivial cases
with the empty set of rectangles. Note that by definition v t ðpÞ ¼ 0 Moreover, we define Bui ¼ fðx; yÞ j x ¼ 0; 1; . . . ; W wi ; y ¼
holds for any p < 0. 0; 1; . . . ; H hi g and Bri ¼ fðx; yÞj x ¼ 0; 1; . . . ; W hi ; y ¼ 0; 1; . . . ;
Note that a single run of the above algorithm suffices to find the H wi g for each i 2 I. Then PP can be formulated as the following
feasibility of all vertical gaps. The same algorithm can also judge the integer program:
feasibility of horizontal gaps just by exchanging the roles of variables
X X X X
zri and zui . We can therefore compute the feasibility of all vertical and maximize zui;x;y þ zri;x;y ð4:11Þ
horizontal gaps by a single run of the above DP recursion. Though we i2I ðx;yÞ2Bui i2I ðx;yÞ2Bri
define v t ðpÞ for all nonnegative integers p, we only need to calculate it X X
for p ¼ 0; 1; . . . ; maxfW; Hg. Hence the above recurrence formula can subject to zui;x;y þ zri;x;y 6 1; 8i 2 I; ð4:12Þ
be calculated in OðmðW þ HÞÞ time. h ðx;yÞ2Bui ðx;yÞ2Bri
X X X X
In the case of the problem without rotations, the problem be- zui;x0 ;y0 þ zri;x0 ;y0 6 1;
comes equivalent to the subset sum problem, and we only need i2I xwi <x0 6x i2I xhi <x0 6x
yhi <y0 6y ywi <y0 6y
to independently execute similar DPs for the horizontal and verti-
cal gaps. When we calculate the DP for the vertical (resp., horizon- 8ðx; yÞ 2 B;
tal) gaps, we remove the second term v t1 ðp wt Þ (resp., the third ð4:13Þ
term v t1 ðp ht Þ) from the recurrence formula (4.10).
A similar idea is also used in [17], where only horizontal gaps zui;x;y ; zri;x;y 2 f0; 1g; 8i 2 I; ðx; yÞ 2 B;
are considered and upper bounds on the possible height of the ð4:14Þ
gap are computed based on a slightly more complicated DP recur-
sion. We simplify their DP, not considering the height but using zui;x;y ¼ 0; 8i 2 I; ðx; yÞ R Bui ; ð4:15Þ
0, 1-variables, in order to apply it to the case with rotations.
zri;x;y ¼ 0; 8i 2 I; ðx; yÞ R Bri : ð4:16Þ
4.3.1.1. Adaptive control of DP cut. Through preliminary experi- The constraint (4.12) means that each rectangle cannot be placed
ments we observed that when the depth of the node in a search more than once and (4.13) means that no rectangles can overlap.
tree is relatively small DP cut often fails in terminating nodes. The original instance for PP has a perfect packing if and only if
Since executing DP cut is computationally expensive, we incorpo- the optimal value of the corresponding instance of this problem is
rate a mechanism to control timing for invoking the DP cut proce- equal to n.
dure. For this, we use a variable b. We invoke DP cut only if the We now consider the LP relaxation of this problem by relaxing
depth d of the current node satisfies d P b. We control the variable constraints zui;x;y ; zri;x;y 2 f0; 1g to 0 6 zui;x;y ; zri;x;y 6 1 for all i 2 I and
b using two constant parameters d and q as follows. We set b :¼ 0 ðx; yÞ 2 B.
at the root node. Whenever we succeed in terminating a node by a
Lemma 4. For a given placement p ¼ fðxi ; yi Þji 2 I0 g of rectangles, fix
DP cut, we reduce b to maxfb d; 0g. When the DP cut procedure
the variables zui;x;y ; zri;x;y for the placed rectangles i 2 I0 accordingly. If
fails in terminating nodes q consecutive times, we increase b by 1.
the optimal value of the resulting LP instance is less than n, then no
We use d ¼ 1 and q ¼ 4 in the computational experiments in Sec-
perfect packing of I is obtained by extending p.
tion 6.
This formulation contains XðnWHÞ variables and WH þ n con-
4.3.2. The bounding rule based on the staircase placement and the straints. Hence this bounding rule is not practical for problem in-
remaining rectangles stances with relatively large WH.
We introduce three simple bounding rules, which are applicable We can also utilize an LP relaxation for the case without rota-
only in branching based on the staircase placement strategy. We tions. In this case, variables zri;x;y are fixed at 0, and therefore are
terminate the node corresponding to a placement p for I0 immedi- not necessarily introduced in this formulation.
ately if one of the following conditions is satisfied: (I) The number
of the remaining rectangles jI n I0 j is smaller than the number of 5. Application of PP algorithms to 2SP
corner points of p. (II) There is a rectangle r in I n I0 which cannot
be placed at any corner point of the staircase of p without protrud- This section gives some ideas on applying the algorithms from
ing from the container. (III) All the indices of the remaining rectan- the previous section to 2SP. We first explain the reduction from
gles I n I0 are smaller than the index of the rectangle placed at the 2SP to PP in Section 5.1 and then introduce generalizations of stair-
origin (0, 0). The third condition indicates that we have already case placement, DP cut, and the bounding rule based on the stair-
checked all possible staircase placements formed by I n I0 and failed case placement and the remaining rectangles in Sections 5.2, 5.3
in finding a perfect packing. Hence none of these placements can and 5.4, respectively. We then propose two algorithms for 2SP in
have the same shape as that of clðU p Þ rotated by 180°. Section 5.5.
78 M. Kenmochi et al. / European Journal of Operational Research 198 (2009) 73–83
5.3. Extension of DP cut gives a lower bound on the area in V p that cannot be filled with any
combination of the rectangles in J.
DP cut can be applied directly to 2SP if we adopt the strategy
Proof. Consider a staircase placement p and any feasible place-
introduced in Section 5.1; i.e., if we calculate DP after adding
ment consisting of a set J 0 # J of the rectangles placed in V p .
1 1 rectangles. However, as the number of 1 1 rectangles in-
Without loss of generality, we assume that all the positions of the
creases, gaps are more easily realized and the DP cut becomes less
rectangles of J 0 are rightmost and uppermost, i.e., none of the
effective. To alleviate this, we propose a new idea of executing the
rectangles in J 0 can be translated rightward or upward without
DP computation without 1 1 rectangles explicitly. For a given
overlapping with other rectangles in J 0 or without protruding from
placement p of I0 , let g vk (resp., g hk ) be the length of the kth shortest
the container. Then no rectangles can overlap with the area of
vertical gap (resp., the kth longest horizontal gap g hk ) in p
aðp; JÞ, the dark gray area of Fig. 5b, because if there exists such a
(k ¼ 1; 2; . . . ; KðpÞ), and shk (resp., svk ) be the width (resp., height)
rectangle, then the length from the top edge (resp., right edge) of
of the stair which forms the boundary of the gap in p (see
v h the container to the bottom edge (the left edge) of the rectangle,
Fig. 5a). Let J be a subset of I n I0 . We then compute lk (resp., lk ),
which is now realizable with the rectangles in J, would be longer
the maximum realizable length by some combination of the
than the maximum realizable length g vk (resp., g hk ). The area is
PKðpÞ h v v h v h
computed by fsk ðg k lk Þ þ svk ðg hk lk Þ ðg vk lk Þðg hk lk Þgþ
PKðpÞ1 v v k¼1 h h
k¼1
fðg k lk Þðg kþ1 lkþ1 Þg. h
Hence if
X X
aðp; JÞ wi hi > WH wi hi ðthe area of clðDp ÞÞ; ð5:2Þ
i2InðI0 [JÞ i2I
Lemma 6. For the subset J t with a fixed t 2 f1; 2; . . . ; mg, the and H as the optimal value and stop. Otherwise, we increase H by
v h
maximum realizable lengths lk (resp., lk ) for all k ¼ 1; 2; . . . ; KðpÞ one and repeat this procedure until a feasible solution is found.
are computed in OðW þ HÞ time if v t ðpÞ of (4.10) are available for all
p ¼ 0; 1; . . . ; maxfW; Hg. Algorithm G-STAIRCASE. We first compute the same lower bound
LB as STAIRCASE and let H :¼ LB. We then test whether or not the
v h
Proof. The maximum realizable length lk (resp., lk ) is computed as PP instance is feasible using algorithm BB-PP with branching oper-
v h ations based on the generalized staircase placement in Section 5.2.
lk ðresp:; lk Þ ¼ max fpjv t ðpÞ ¼ 1g; ð5:3Þ If we find a feasible solution for the PP instance, then we output the
p¼0;1;...;g vk ðresp:; g hk Þ
placement and then stop. Otherwise, we increase H by one and
in the process of computing the recurrence formula (4.10). The vari- repeat the procedure until a feasible solution is found.
v h
ables lk (resp., lk ) need to be updated only if v t ðpÞ such that p 6 g vk
h
(resp., g k ) becomes 1 from 0. h
6. Computational results
For all J 1 ; J 2 ; . . . ; J m , this bounding operation can be calculated in
OðmðW þ HÞÞ time. We report the computational results on algorithm BB-PP in Sec-
tion 4.1 for PP and algorithms STAIRCASE and G-STAIRCASE in Sec-
5.4. Extension of the bounding rule based on the staircase placement tion 5 for 2SP. In the tables in this section, column ‘H ’ shows
and the remaining rectangles optimal values, column ‘Time’ shows the computation time in sec-
onds needed to solve the problem instances exactly, and column
This section introduces an extension of the bounding rule based ‘Nodes’ shows the number of search tree nodes generated by the
on staircase placement and the remaining rectangles described in algorithm. The mark ‘T.O.’ means that the search did not stop with-
Section 4.3.2 in order to apply the branching operation based on in the time limit. We coded the algorithms in the C language and
the generalized staircase placement and the extended DP cut. (I) used a PC with a Pentium 4 (3.0GHz) and 1.0GB memory for com-
If the number of remaining rectangles jI n I0 j becomes smaller than putational experiments of this section.
the number KðpÞ of corner points of p in a node, then we can add
another area that cannot be filled with rectangles in J. Such area 6.1. Instances
bðp; JÞ is defined as the sum of KðpÞ jI n I0 j smallest area of
h h v v
ðg hkþ1 lkþ1 þ shk g hk þ lk Þðg vk1 lk1 þ svk g vk þ lk Þ, where g hk ; g vk ; The instances used for our computational experiments are: (i)
h v
lk ; lk ¼ 0 if k 6 0 or k > KðpÞ (see the light gray area in Fig. 5b). the instance sets N1, N2, N3 and N4 generated by Hopper, which
Hence if were used in [17] and are available at the ESICUP web site,1 (ii)
X X the instances n1, n2, . . . , n12 generated by Burke et al., which were
aðp; JÞ þ bðp; JÞ wi hi > WH wi hi
0
i2InðI [JÞ i2I
used in [4] and are available from [4], and (iii) the instances ht01–
09, beng01–10, cgcut01–03 and ngcut01–12, which were used in
ðthe area of clðDp ÞÞ; ð5:4Þ [21] and are available at OR-Library.2 Each of N1, N2, N3 and N4 con-
then we can terminate the node. (II) and (III) can be applied directly. sists of five instances, and those in N1 are named n1a, n1b, . . . , n1e,
We call these bounding operations the extended bounding rule based and those in N2, N3 and N4 are named similarly. Every instance in
on the staircase placement and the remaining rectangles. (i) and (ii) has a perfect packing (i.e., feasible as PP). We supple-
mented relatively small PP instances in Table 1 generated by us.
They are named with the following rules: ‘perfect’ (resp., ‘nperfect’)
5.5. Algorithms
means that the instance is feasible (resp., infeasible) and the number
on the left represents the number of rectangles n.
We propose two algorithms for 2SP; one uses branching opera-
tions based on the staircase placement in Section 4.2.2 and adds
6.2. Computational results for PP
1 1 rectangles, and the other uses branching operations based
on the generalized staircase placement in Section 5.2 without add-
We first conducted preliminary experiments on relatively small
ing 1 1 rectangles explicitly. We call the resulting algorithms
PP instances to compare various combinations of branching rules
STAIRCASE and G-STAIRCASE, respectively. These two algorithms
and bounding rules in algorithm BB-PP. We then chose effective
adopt the extended DP cut in Section 5.3 and the extended bound-
combinations of such rules and tested the resulting algorithms
ing rule based on the staircase placement and the remaining rect-
on larger instances.
angles in Section 5.4 as their bounding operations, but they do not
use the LP cut in Section 4.3.3.
6.2.1. Comparisons of various rules
Algorithm STAIRCASE. We first compute a lower bound LB on the We examine which branching and bounding rules are effective
optimal height by for BB-PP. The case with rotations is used for this purpose, and the
P following three combinations are tested:
i2I wi hi
LB ¼ min ; max hi ; ð5:5Þ
W i2I
Branching based on the BL point and DP cut,
when rotations are not allowed, and by Branching based on the BL point, DP cut and LP cut,
P Branching based on the staircase placement and DP cut.
i2I wi hi
LB ¼ min ; max minfhi ; wi g ; ð5:6Þ
W i2I LP is solved by GLPK (glpk-4.73). Adaptive control of DP cut is not
when rotations are allowed. We then let H :¼ LB and add incorporated in this experiment to clearly observe the effectiveness
P of the DP cut.
WH i2I wi hi 1 1 rectangles to the set I to obtain a PP instance.
We then test whether or not the PP instance is feasible by using
algorithm BB-PP with branching operations based on the staircase 1
http://www.paginas.fe.up.pt/~esicup/.
placement in Section 4.2.2. If we find a feasible solution for the PP 2
http://www.people.brunel.ac.uk/~mastjjb/jeb/info.html.
instance, then we output the placement as an optimal solution 3
http://www.gnu.org/software/glpk/glpk.html.
80 M. Kenmochi et al. / European Journal of Operational Research 198 (2009) 73–83
Table 1
Data of the instances generated for our experiment
W H i 1 2 3 4 5 6 7 8 9 10 11 12 13
9perfect 13 20 wi 4 15 6 3 4 2 8 3 10 – – – –
hi 15 3 6 12 6 8 2 5 3 – – – –
9nperfect 13 20 wi 4 15 6 3 3 2 8 3 10 – – – –
hi 15 3 6 12 8 8 2 5 3 – – – –
10nperfect 20 20 wi 5 9 2 3 4 6 4 9 3 2 – – –
hi 11 8 8 6 9 8 7 8 11 11 – – –
11nperfect 20 20 wi 4 7 10 2 6 3 1 4 4 6 4 – –
hi 13 8 5 8 7 8 12 7 4 12 8 – –
12nperfect 20 20 wi 3 5 4 10 7 6 8 4 18 2 3 9 –
hi 6 8 5 8 4 3 8 6 3 3 10 2 –
13nperfect 20 20 wi 7 1 5 9 2 9 5 5 4 3 2 9 2
hi 5 8 9 3 16 7 9 3 9 7 7 3 16
Table 2
Preliminary computational results on PP (with rotations of 90°)
The results are shown in Table 2. The mark ‘M.O.’ means that ory and is not applicable to instances with larger W and H, such as
the memory space was not sufficient to solve the LP. As observed those in set N1. (If available computer memory increases and faster
in the table, the combination of branching based on the staircase LP solvers become available in the future, then LP cut may become
placement and DP cut is very effective for feasible instances, while effective.) We therefore restrict our attention to the combinations
the combination of branching based on the BL point and DP cut is without LP cut in the subsequent computational experiments.
better for infeasible instances. One conceivable reason for this is
that staircase placement limits the number of stairs so that we 6.2.2. Computational results for larger instances
can find feasible solutions quickly, while this limitation is redun- The results on instance sets N1, N2, N3 and N4 for problems
dant for infeasible instances. LP cut is not effective since it takes with and without rotations are reported in Tables 3 and 4, respec-
significant time to solve the LP, although it makes the number of tively. Throughout this subsection, we denote by ‘BL-PP’ the algo-
nodes very small. Moreover, it consumes a large amount of mem- rithm with branching based on the BL point, and by ‘StairCasePP’
Table 3 Table 4
Computational results on PP (with rotations of 90°) Computational results on PP (without rotations)
Table 5 Table 7
Comparison of three algorithms on PP (without rotations) Computational results on 2SP (with rotations of 90°)
cept n2e and n3c, and the computation time spent for these two in- a
On a Pentium 4 (3GHz) with the time limit of 3600 seconds.
stances were less than a minute. These results indicate that
StairCasePP is very efficient. Algorithm BL-PP was able to solve is much smaller (e.g., n4 (resp., n3) for the case with (resp., with-
the instances with n ¼ 17 in reasonable time, but it is less effective out) rotations). The characteristics of such hard small instances
than StairCasePP. would be worth investigating.
From Table 4, we can observe that StairCasePP is also very effi-
cient for the case without rotations; it was able to solve four out of 6.3. Computational results for 2SP
the five instances with 49 rectangles within the time limit. Algo-
rithm BL-PP was able to solve all instances with n ¼ 25 and three This section reports the computational results of algorithms
out of the five instances with n ¼ 29. This is within the time limit, STAIRCASE and G-STAIRCASE, which were explained in Section
but it is less efficient than StairCasePP as in the case with rotations. 5.5. The results for the case with and without rotations are shown
Lesh et al. [17] proposed an exact algorithm for PP without rota- in Tables 7 and 8, respectively. In the tables, column ‘LB’ shows the
tions and tested it on these instances with n 6 29. Table 5 summa- lower bounds by (5.5) or (5.6), and column ‘1 1’ shows the max-
rizes their results and those of StairCasePP and BL-PP, where imum number of 1 1 rectangles added to obtain optimal solu-
column ‘‘#solved” shows the number of solved instances out of tions in STAIRCASE. For comparison purposes, we include in
the five, and column ‘‘avg. time” shows the average computation Table 8 as column MMV the results reported in [21]. They con-
time needed to solve an instance.4 Lesh et al. used a PC with ducted their experiments on a PC with a Pentium III (800MHz).
Pentium 2.0GHz. Even considering the difference of the CPUs, The time limit is one hour for STAIRCASE, G-STAIRCASE and
StairCasePP seems much faster than their algorithm. MMV. For each row, the shortest computation time is shown in
We also tested StairCasePP on the feasible PP instances in [4] for bold face.5
the cases with and without rotations. The results are shown in Ta- For the problem with rotations, as shown in Table 7, both
ble 6. For the case with (resp., without) rotations, our algorithm STAIRCASE and G-STAIRCASE were able to solve most of the in-
succeeded in solving nine (resp., eight) out of the twelve instances stances with up to 200 rectangles. The optimal values of the solved
with up to 500 rectangles within short computation time. Here we instances are equal to or very close to the lower bounds of (5.6). For
note that, while some instances with hundreds of rectangles are the problem without rotations, as shown in Table 8, G-STAIRCASE
efficiently solved, there are some instances for which StairCasePP
took long computation time even though the number of rectangles
5
We estimated the speed of our CPU (Pentium 4 (3GHz)) to be 3–4 times faster
than a Pentium III (800MHz). The shortest computation time between those of
4
The average is taken for those instances solved within the time limit. Lesh et al. STAIRCASE and G-STAIRCASE is shown in bold only if it is shorter than that of MMV
reported only approximate computation time (they wrote, e.g., ‘‘on average under 10 divided by four except for beng07, for which the results of G-STAIRCASE and MMV are
minutes”) and hence we put ‘‘6”in the table. close because 0:56=4 6 0:18 6 0:56=3 holds.
82 M. Kenmochi et al. / European Journal of Operational Research 198 (2009) 73–83
Table 8
Computational results on 2SP (without rotations)
was able to solve most of these instances, while STAIRCASE failed heights, while the algorithms proposed in Sections 4 and 5 and
in solving several instances within the time limit. The number of those in [17,21] require that all input values are integers.
instances solved in the time limit is smaller than the case with Our algorithm based on sequence pairs could solve instances
rotations. One conceivable reason for this is that the number of in- with up to 10 (resp., 11) rectangles for the case with (resp., with-
stances whose optimal values are equal to the lower bounds of out) rotations within the time limit of two hours on a PC with a
(5.5) is less than that of the case with rotations. The optimal values Pentium 4 (3GHz). However, these results are not competitive with
are the same as the lower bounds for ht and beng instances, while those reported in Section 6. We therefore omit the details of this
the gap between them is large for about a half of ngcut instances. algorithm in this paper. The description of this algorithm and its
Because our algorithms are based on PP, they will be more efficient computational results are reported in [16].
for instances whose optimal values are close to the trivial lower
bounds. Indeed, for the ht and beng instance sets, our algorithms 8. Conclusions
solved more instances than MMV. On the other hand, for the ngcut
instance set, MMV seems to be more efficient. We proposed several ideas for exactly solving the perfect pack-
ing (PP) and strip packing (2SP) problems using the branch-and-
7. Branch-and-bound algorithm based on sequence pairs bound method. We confirmed through computational experiments
that branching based on the staircase placement is effective for PP.
We examined another branch-and-bound algorithm based on a Our algorithm based on this idea was able to solve all the bench-
different scheme for representing solutions. It is based on the se- mark instances with up to 29 rectangles for the case with rotations
quence pair representation proposed in [25], which defines relative of 90° and was able to solve all but one instance with up to 49 rect-
positions of rectangles by using a pair of permutations of the set I. angles for the case without rotations. Moreover, it succeeded in
An interesting feature of this scheme is that polynomial-time algo- solving several benchmark instances with up to 500 rectangles in
rithms for encoding and decoding are known [11,25], where less than 15 seconds. We also observed that our algorithms for
encoding is to find the sequence pair representation that does 2SP were efficient for instances whose optimal values are close
not contradict a given placement, while decoding is to find the best to the trivial lower bounds; they solved most of the benchmark in-
placement among those that satisfy the constraints on the relative stances with up to 200 rectangles within one hour. For the case
positions of rectangles defined by a given sequence pair. without rotations, one of our algorithms for PP outperformed the
One of the merits of this branch-and-bound algorithm is that it algorithm in [17], and our algorithms for 2SP were competitive
can handle instances having non-integer values for widths and with the method in [21]. Considering the fact that the existing
M. Kenmochi et al. / European Journal of Operational Research 198 (2009) 73–83 83
algorithms are tailored for the case without rotations, these results [14] M. Iori, S. Martello, M. Monaci, Metaheuristic algorithms for the strip packing
problem, in: P.M. Pardalos, V. Korotkikh (Eds.), Optimization and Industry:
are quite satisfactory.
New Frontiers, Kluwer Academic Publishers, Dordrecht, The Netherlands,
2003, pp. 159–179.
Acknowledgements [15] S. Jakobs, On genetic algorithms for the packing of polygons, European Journal
of Operational Research 88 (1996) 165–181.
[16] M. Kenmochi, T. Imamichi, K. Nonobe, M. Yagiura, H. Nagamochi, Exact
The authors would like to thank Shinji Imahori and anonymous algorithms for the two-dimensional strip packing problem with and without
referees for valuable comments. This research was supported by a rotations. Technical Report 2007-005, Department of Applied Mathematics
Scientific Grant-in-Aid by the Ministry of Education, Culture, and Physics, Graduate School of Informatics, Kyoto University, January, 2007
(available at <http://www.amp.i.kyoto-u.ac.jp/tecrep/>).
Sports, Science and Technology of Japan. [17] N. Lesh, J. Marks, A. McMahon, M. Mitzenmacher, Exhaustive approaches to 2D
rectangular perfect packings, Information Processing Letters 90 (2004) 7–14.
[18] N. Lesh, J. Marks, A. McMahon, M. Mitzenmacher, New heuristic and
References interactive approaches to 2D rectangular strip packing, ACM Journal of
Experimental Algorithmics 10 (2005) 1–18.
[19] D. Liu, H. Teng, An improved BL-algorithm for genetic algorithm of the
[1] R. Alvarez-Valdes, F. Parreño, J.M. Tamarit, Reactive GRASP for the strip-
orthogonal packing of rectangles, European Journal of Operational Research
packing problem, Computers and Operations Research 35 (2008) 1065–1083.
112 (1999) 413–420.
[2] B.S. Baker, E.G. Coffman Jr., R.L. Rivest, Orthogonal packings in two dimensions,
[20] A. Lodi, S. Martello, M. Monaci, Two-dimensional packing problems: A survey,
SIAM Journal on Computing 9 (1980) 846–855.
European Journal of Operational Research 141 (2002) 241–252.
[3] A. Bortfeldt, A genetic algorithm for the two-dimensional strip packing
[21] S. Martello, M. Monaci, D. Vigo, An exact approach to the strip-packing
problem with rectangular pieces, European Journal of Operational Research
problem, INFORMS Journal on Computing 15 (2003) 310–319.
172 (2006) 814–837.
[22] S. Martello, D. Pisinger, D. Vigo, The three-dimensional bin packing problem,
[4] E.K. Burke, G. Kendall, G. Whitwell, A new placement heuristic for the
Operations Research 48 (2000) 256–267.
orthogonal stock-cutting problem, Operations Research 52 (2004) 655–671.
[23] S. Martello, P. Toth, Knapsack Problems – Algorithms and Computer
[5] B. Chazelle, The bottom-left bin-packing heuristic: An efficient
Implementations, John Wiley & Sons, Chichester, 1990.
implementation, IEEE Transactions on Computers C-32 (1983) 697–707.
[24] Y. Matsuda, The fourth supercomputer programming contest for high school
[6] K.A. Dowsland, Some experiments with simulated annealing techniques for
students at Tokyo Institute of Technology, Sugaku Seminar (Mathematics
packing problems, European Journal of Operational Research 68 (1993) 389–
Seminar) 37 (12) (1998) 40–43 (in Japanese).
399.
[25] H. Murata, K. Fujiyoshi, S. Nakatate, Y. Kajitani, VLSI module placement based
[7] E. Hopper, B.C.H. Turton, An empirical investigation of meta-heuristic and
on rectangle-packing by the sequence-pair, IEEE Transactions on Computer-
heuristic algorithms for a 2D packing problem, European Journal of
Aided Design of Integrated Circuits and Systems 15 (1996) 1518–1524.
Operational Research 128 (2001) 34–57.
[26] J. Turek, J.L. Wolf, P.S. Yu, Approximate algorithms for scheduling parallelizable
[8] E. Hopper, B.C.H. Turton, A review of the application of meta-heuristic
tasks, in: Proceedings of the Fourth Annual ACM Symposium on Parallel
algorithms to 2D strip packing problems, Artificial Intelligence Review 16
Algorithms and Architectures, 1992, pp. 323–332.
(2001) 257–300.
[27] G. Wäscher, H. Haußner, H. Schumann, An improved typology of cutting and
[9] W. Huang, D. Chen, An efficient heuristic algorithm for rectangle-packing
packing problems, European Journal of Operational Research 183 (2007)
problem, Simulation Modelling Practice and Theory 15 (2007) 1356–1365.
1109–1130.
[10] T. Ibaraki, Enumerative Approaches to Combinatorial Optimization, Annals of
[28] L. Wei, D. Zhang, Q. Chen, A least wasted first heuristic algorithm for the
Operations Research, vols. 10 and 11, JC Baltzer AG, Basel, 1987.
rectangular packing problem, Computers and Operations Research, in press..
[11] S. Imahori, M. Yagiura, T. Ibaraki, Local search algorithms for the rectangle
[29] L.H.W. Yeung, W.K.S. Tang, Strip-packing using hybrid genetic approach,
packing problem with general spatial costs, Mathematical Programming Series
Engineering Applications of Artificial Intelligence 17 (2004) 169–177.
B 97 (2003) 543–569.
[30] D.F. Zhang, S.D. Chen, Y.J. Liu, An improved heuristic recursive strategy based
[12] S. Imahori, M. Yagiura, T. Ibaraki, Improved local search algorithms for the
on genetic algorithm for the strip rectangular packing problem, Acta
rectangle packing problem with general spatial costs, European Journal of
Automatica Sinica 33 (2007) 911–916.
Operational Research 167 (2005) 48–67.
[31] D. Zhang, Y. Kang, A. Deng, A new heuristic recursive algorithm for the strip
[13] S. Imahori, M. Yagiura, H. Nagamochi, Practical algorithms for two-
rectangular packing problem, Computers and Operations Research 33 (2006)
dimensional packing, in: T.F. Gonzalez (Ed.), Handbook of Approximation
2209–2217.
Algorithms and Metaheuristics. Chapman & Hall/CRC in the Computer &
Information Science Series, 2007. (Chapter 36).