Priority Heuristic for Guillotine Packing
Priority Heuristic for Guillotine Packing
a r t i c l e i n f o a b s t r a c t
Article history: A new priority heuristic is presented for the guillotine rectangular packing problem. This
Received 5 April 2014 heuristic first selects one available item for a given position by a priority strategy. Then it
Received in revised form 21 June 2015 divides the remaining space into two rectangular bins and packs them recursively, and its
Accepted 6 August 2015
worst-case time complexity is T (n) = O(n2 ). The proposed algorithm is a general, simple
Available online 21 August 2015
and efficient method, and can solve different packing problems. Computational results on a
Communicated by S.M. Yiu
wide range of benchmark problems have shown that the proposed algorithm outperforms
Keywords: existing heuristics in the literature, on average.
Packing problem © 2015 Elsevier B.V. All rights reserved.
Heuristic algorithm
Recursive
Design of algorithms
*
Corresponding author at: Department of Computer Science, Xia-
GRPP is NP-hard and is difficult to solve (Belov [1], Mes-
men University, 361005, China. Tel.: +86 0592 5918207; fax: +86 0592
2580258. saoud et al. [12]). Some researches for GRPP have shown
E-mail address: dfzhang@[Link] (D. Zhang). exact algorithms only solve small-scale problems (Hifi and
[Link]
0020-0190/© 2015 Elsevier B.V. All rights reserved.
16 D. Zhang et al. / Information Processing Letters 116 (2016) 15–21
RecursivePacking(x, y , w , h)
if no item can be placed into S or all the items are placed into S, then return;
else
for each unplaced item i do
for j = 0 to D do determine the priority of item i;
select an item r with highest priority from unplaced items, record its orientation j;
if the highest priority is less than 5 then
place item r into S by the orientation j;
switch (priority)
case 1: break;
case 2: RecursivePacking(x + ω, y , w − ω, h); break;
case 3: RecursivePacking(x, y + d, w , h − d); break;
case 4: if w − ω < min w then
divide S (as Fig. 2(a)) into S 1 and S 2 that S 2 is wasted;
RecursivePacking(x, y + d, w , h − d);
else if h − d < min h then
divide S (as Fig. 2(c)) into S 1 and S 2 that S 1 is wasted;
RecursivePacking(x + ω, y , w − ω, h);
else if ω < min w then divide S into S 1 and S 2 (as in Fig. 2(a));
else divide S into S 1 and S 2 (as in Fig. 2(c));
Recursively pack the larger space among S 1 and S 2 ;
Recursively pack the smaller space among S 1 and S 2 ;
break;
problem. Above is the pseudocode for the recursive pack- (1) Let D = 1, for each item, swap its width and height
ing process for S, where D denotes whether the problem if its width is larger than its height, sort all items by
considers orientation constraints or not, D = 0 denotes the non-increasing width, H = 0, x = 0, y = 0.
items are placed only with the fixed orientation and D = 1 (2) If h i > W then x = w i , y = H , w = W − w i , h = h i ,
denotes that rotation is permitted. For item r, ω and d are H = H + h; otherwise, x = h i , y = H , w = W − h i ,
width and height, respectively, if orientation value D = 0. h = w i , H = H + h.
Otherwise, ω and d are height and width of item r, re- (3) RecursivePacking(x, y , w , h).
spectively. The highest priority is an integer from 1 to 4 (4) If unpacked items remain, let B = B 1 , go to (2); other-
which corresponds to four cases from (a) to (d) in Fig. 1 re- wise stop.
spectively, so priority in the switch operator is between 1
and 4. Where the larger space (the larger area) should Where H is the height of the level. H is the objective value
be filled first that is from the experience of packing by of the problem when the algorithm stops. For single bin
humans. More space is wasted because small items may packing problem with OG, PH is as follows:
occupy the space that can be used for large items, such
(1) Let D = 0, for each item, sort all items by non-
that large items cannot be placed (without increasing the
increasing width.
height).
(2) RecursivePacking(0, 0, W , H ).
From the above analysis, RecursivePacking(x, y , w , h) is
different from HR (Zhang et al. [20]) because HR only con-
For single bin packing problem with RG, PH is as follows:
siders the first item that can be placed into S, then divides
S into two rectangular bins according to h and w. If w < h, (1) Let D = 1, for each item, swap its width and height
then S is divided as in Fig. 2(a), otherwise it is divided as if its width is larger than its height, sort all items by
in Fig. 2(c). Since assigning priorities is the central idea non-increasing width.
behind the proposed algorithm, it is named the priority (2) RecursivePacking(0, 0, W , H ).
heuristic (PH) algorithm. PH is based on a recursive struc-
ture and is a general approach. Now, we use PH to solve From the above descriptions of PH for different problems,
different problems. For a strip packing problem with OG, observe that PH first sorts the items by non-increasing
PH is as follows: height for the strip packing problem with fixed orienta-
tion constraints (OG) because the problem is to minimize
(1) Let D = 0, sort all items by non-increasing height, the height of the bin. Therefore, items with large heights
H = 0, x = 0, y = 0. should be placed first. PH first swaps an item’s width and
(2) Place an item i by using a level structure into the open height if its width is larger than its height, and sorts all
bin B, x = w i , y = H , w = W − w i , h = h i , H = H + h, items by non-increasing width for strip packing problem
and divide the open bin into B 1 and S. (RG). For this problem, if w i > w j , then the probability of
(3) RecursivePacking(x, y , w , h). h i > h j will be higher after Step (1) is finished, so large
(4) If unpacked items remain, let B = B 1 , go to (2); other- items have a greater chance to be placed first. For sin-
wise stop. gle bin (RG and OG) packing problems, the objective is to
maximize the filling rate. For RG problem, sorting by non-
For the strip packing problem with RG, PH is as follows: increasing width makes large items have greater chance to
18 D. Zhang et al. / Information Processing Letters 116 (2016) 15–21
Table 1
Results of different heuristic algorithms for strip packing problem (OG).
T1 33.3 41.9 41.2 36.8 31.1 N1 21.1 27.1 27.1 23.9 26.6
T2 26.1 33.4 31.2 26.2 28.8 N2 18.6 21.1 30.6 18.7 19.3
T3 22.1 32.2 34.6 21.0 21.9 N3 19.8 30.4 28.6 20.3 18.7
T4 12.2 18.6 23.5 11.8 11.5 N4 12.8 22.2 22.5 13.5 11.4
T5 11.6 22.3 17.4 11.4 11.6 N5 11.5 24.0 18.9 10.1 11.3
T6 13.1 21.9 16.7 8.6 9.5 N6 12.3 21.1 17.7 7.8 9.9
T7 10.7 16.6 10.8 5.9 5.0 N7 9.0 16.5 14.4 5.3 4.0
AGap 18.4 26.7 25.1 17.4 17.06 AGap 15.0 23.2 22.8 14.2 14.46
Nice1 21.1 23.5 27.7 21.0 24.5 Path1 28.5 38.4 46.4 29.1 20.1
Nice2 16.1 18.5 23.5 16.3 12.1 Path2 25.4 39.5 35.8 25.1 19.2
Nice3 11.7 13.7 18.9 11.1 10.8 Path3 23.9 38.1 29.9 17.7 6.2
Nice4 8.9 10.1 15.6 8.6 9.5 Path4 23.3 34.5 18.7 10.9 7.7
Nice5 5.9 6.5 12.7 5.8 6.0 Path5 22.5 30.1 12.1 6.3 7.9
Nice1t 4.5 4.8 11.4 4.3 4.4 Path1t 23.6 30.9 10.8 5.1 4.0
Nice2t 3.1 3.3 10.6 3.0 3.3 Path2t 20.3 25.3 9 .4 3.7 3.1
Nice5t 2.1 2.2 10.1 2.0 2.0 Path5t 20.3 24.3 7 .3 2.8 2.1
AGap 9.2 10.3 16.3 9.0 9.1 AGap 23.5 32.6 21.3 12.6 8.8
Table 2
Results of PH, BFDH, BFDH* and GA for the strip packing problem (RG).
out on a Pentium PC with a core frequency of 2 GHz. From To verify the performance of PH in large problem
Table 2, we can observe that among the three heuristics, instances, we compared PH with GBL and FFDH. Data
PH achieves better results for most instances except for set ZDF is from Leung and Zhang [9] and Zhang et
Nice2 and Path1 and is faster than SPGAL. al. [22] and CX is from Pinto and Oliveira [15]. These
two data sets include extra large-scale instances (n >
10 000). Large-scale data sets Nice1t, Nice2t, Nice5t, Path1t,
4.3. Single bin packing problem (OG and RG)
Path2t and Path5t, having 10 instances each, are in-
cluded. These 60 instances are non-zero-waste instances
To verify the performance of PH for the single bin pack- because of the transformation from float to integer data
ing problem, 21 instances from Hopper and Turton [8] by multiplying the original data by 10 and rounding
were used. Polyakovsky and M’Hallah [16] reported com- to the nearest integer. They can be downloaded from
putational results of GBL and A-B for OG and RG prob- [Link] Table 4
lems. Table 3 reports the filling rates of three algorithms. reports the filling rates of FFDH, GBL and PH. The results
All these results are taken from Polyakovsky and M’Hal- show that PH outperforms GBL and PH completely, except
lah [16]. For OG problem, we can observe that PH performs for 500 cx.
better for 13 of 21 instances and performs poorer for 8
of 21 instances, where the best results are in bold font. 5. Conclusions
For RG problem, we can observe that PH performs better
for 14 of 21 instances, and performs poorer for 6 of 21 A new priority heuristic (PH) algorithm for GRPP is
instances. Compared with the complicated and advanced proposed, and four variations of the algorithm are exam-
A-B algorithm, where the best results are in underlined, ined. PH is a simple and very fast deterministic single-pass
we can observe that PH performs poorer for OG problem, heuristic. Computational results have shown that PH out-
but performs better for RG problem on average. In partic- performs existing heuristics from the literature for most
ular, instance c2_2 is solved optimally by PH with 100% benchmark instances. In some instances, PH improves on
usage. the best results of existing heuristics. One advantage of
20 D. Zhang et al. / Information Processing Letters 116 (2016) 15–21
Table 3
Results of PH, GBL and A-B for the single bin packing problem (OG and RG).
Instance OG RG Instance OG RG
PH GBL A-B PH GBL A-B PH GBL A-B PH GBL A-B
C1_1 95.50 88.00 92.30 95.50 91.50 92.30 C4_3 93.33 89.50 97.64 95.92 97.22 96.78
C1_2 86.75 79.50 86.50 89.00 86.75 89.76 C5_1 97.17 92.80 96.28 98.67 95.67 96.90
C1_3 91.25 78.50 86.00 92.50 92.75 89.73 C5_2 88.72 88.56 91.13 97.50 93.93 95.96
C2_1 89.00 86.67 95.50 87.33 87.67 96.13 C5_3 97.46 94.98 90.98 97.41 94.85 95.62
C2_2 90.50 92.67 98.33 100.00 92.67 93.48 C6_1 96.04 95.47 96.97 97.88 97.57 98.07
C2_3 91.00 94.83 98.00 95.00 95.00 97.14 C6_2 92.19 94.93 94.25 97.45 96.98 96.93
C3_1 91.06 92.33 81.11 95.28 94.67 84.20 C6_3 93.10 94.98 96.68 96.56 94.86 98.47
C3_2 86.94 86.11 94.22 88.17 90.00 91.86 C7_1 96.02 95.29 97.03 97.06 96.07 97.03
C3_3 87.22 87.67 86.00 94.22 91.67 93.11 C7_2 95.39 97.68 96.39 97.84 97.38 97.73
C4_1 95.25 94.83 95.61 96.81 97.00 95.56 C7_3 93.58 95.32 97.56 96.70 97.50 98.83
C4_2 92.83 92.58 95.61 95.00 91.19 96.60 Average 92.40 91.10 93.53 95.32 93.95 94.87
Table 4
Results of different algorithms for large problem instances (OG).
PH is that it is based on a priority strategy. As shown in [4] E.G. Coffman, P.W. Shor, Average-case analysis of cutting and packing
Table 4, the larger the problem size is, the better it may in two dimensions, Eur. J. Oper. Res. 44 (2) (1990) 134–144.
perform because it can select one item with highest prior- [5] Y. Cui, Y. Yang, X. Cheng, P. Song, A recursive branch-and-bound algo-
rithm for the rectangular guillotine strip packing problem, Comput.
ity among many items. Therefore, PH is particularly good
Oper. Res. 35 (4) (2008) 1281–1291.
for large-scaled problems and can be used in conjunction
[6] M. Hifi, R. M’Hallah, An exact algorithm for constrained two-
with meta-heuristics or exact methods. Future work may dimensional two-staged cutting problems, Oper. Res. 53 (1) (2005)
consider metaheuristic algorithms based on PH and ex- 140–150.
tending PH for other packing problems. [7] S. Hong, D. Zhang, C.H. Lau, X.X. Zeng, Y. Si, A hybrid heuristic al-
gorithm for the 2D variable-sized bin packing problem, Eur. J. Oper.
Acknowledgements Res. 238 (1) (2014) 95–103.
[8] E. Hopper, B.C.H. Turton, An empirical investigation of metaheuristic
and heuristic algorithms for a 2D packing problem, Eur. J. Oper. Res.
The authors would like to thank the anonymous re-
128 (1) (2001) 34–57.
viewers for their valuable suggestions that help improve [9] S. Leung, D. Zhang, A fast layer-based heuristic for non-guillotine
this paper. This work was partially supported by a grant strip packing, Expert Syst. Appl. 38 (2011) 13032–13042.
from City University of Hong Kong (Project No. 7002907) [10] A. Lodi, S. Martello, D. Vigo, Heuristic and metaheuristic approaches
and the National Natural Science Foundation of China for a class of two-dimensional bin packing problems, INFORMS J.
(Grant No. 61272003). Comput. 11 (4) (1999) 345–357.
[11] S. Martello, M. Monaci, D. Vigo, An exact approach to the strip-
packing problem, INFORMS J. Comput. 15 (3) (2003) 310–319.
References
[12] S.B. Messaoud, C. Chu, M.L. Espinouse, Characterization and mod-
elling of guillotine constraints, Eur. J. Oper. Res. 191 (2008) 112–126.
[1] G. Belov, Problems, models and algorithms in one- and two-
dimensional cutting, Ph.D. Thesis, Technischen Universität, Dresden, [13] C.L. Mumford-Valenzuela, J. Vick, P.Y. Wang, Heuristics for large strip
2003. packing problems with guillotine patterns: an empirical study, in:
[2] A. Bortfeldt, A genetic algorithm for the two-dimensional strip pack- Metaheuristics: Computer Decision-Making, Kluwer Academic Pub-
ing problem with rectangular pieces, Eur. J. Oper. Res. 172 (3) (2006) lishers B.V., 2003, pp. 501–522.
814–837. [14] F.G. Ortmann, N. Ntene, J.H. Van Vuuren, New and improved
[3] E.G. Coffman, D.S. Garey, R.E. Tarjan, Performance bounds for level level heuristics for the rectangular strip packing and variable-
oriented two-dimensional packing algorithms, SIAM J. Comput. 9 (4) sized bin packing problems, Eur. J. Oper. Res. 203 (2) (2010)
(1980) 808–826. 306–315.
D. Zhang et al. / Information Processing Letters 116 (2016) 15–21 21
[15] E. Pinto, J.F. Oliveira, Algorithm based on graphs for the non- [19] L. Wei, T. Tian, W. Zhu, A. Lim, A block-based layer building approach
guillotinable two-dimensional packing problem, in: Second ESICUP for the 2D guillotine strip packing problem, Eur. J. Oper. Res. 239 (1)
Meeting, Southampton, 2005. (2014) 58–69.
[20] D. Zhang, Y. Kang, A. Deng, A new heuristic recursive algorithm for
[16] S. Polyakovsky, R. M’Hallah, An agent-based approach to the two-
the strip rectangular packing problem, Comput. Oper. Res. 33 (8)
dimensional guillotine bin packing problem, Eur. J. Oper. Res. 192
(2006) 2209–2217.
(2009) 767–781.
[21] F.G. Ortmann, Heuristics for offline rectangular packing problems,
[17] G. Wäscher, H. Haußner, H. Schumann, An improved typology of
Ph.D. Thesis, Stellenbosch University, 2010.
cutting and packing problems, Eur. J. Oper. Res. 183 (3) (2007)
[22] D. Zhang, L. Wei, S. Leung, Q. Chen, A binary search heuris-
1109–1130.
tic algorithm based on randomized local search for the rectan-
[18] P.Y. Wang, C.L. Valenzuela, Data set generation for rectangular place- gular strip packing problem, INFORMS J. Comput. 25 (2) (2013)
ment problems, Eur. J. Oper. Res. 134 (2) (2001) 378–391. 332–345.