An Iterated Local Search Algorithm Based on Nonlinear

An Iterated Local Search Algorithm
Based on Nonlinear Programming for
the Irregular Strip Packing Problem
Takashi Imamichi1
Mutsunori Yagiura2
Hiroshi Nagamochi3
1) IBM Research - Tokyo, 2) Nagoya University, 3) Kyoto University
Reggio Emilia, 2010
Email: [email protected]
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
1 / 39
Outline
1
The irregular strip packing problem
2
Algorithm
Overview of our algorithm
Overlap minimization by nonlinear programming
Swapping two polygons
3
Computational results
4
Conclusions
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
2 / 39
The Irregular Strip Packing Problem
A rectangular container C with a fixed width
Place irregular polygons {P1 , . . . , Pn } without any overlap
Minimize the length of the container
y
Translations and rotations by
fixed degrees.
W
Applications of apparel
industry, steel industry, etc.
NP-hard
O
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
L
x
Reggio Emilia (2010)
3 / 39
Existing Heuristics
Burke et al. (2005)
SHAPES0/67.09%
Bottom-left-fill algorithm
Hill climbing and tabu search
Gomes and Oliveira (2006)
Compaction and separation algorithms
based on linear programming
Simulated annealing
ALBANO/87.44%
Egeblad et al. (2006)
Move a polygon into the position
with the least overlap area on a line
Guided local search
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
(Egeblad et al. 2006)
Reggio Emilia (2010)
4 / 39
Compaction and Separation
Compaction
Input: feasible layout of polygons
Objective: translate polygons to shrink the container keeping the
feasibility
Separation
Input: infeasible layout of polygons
Objective: translate polygons to obtain a feasible layout
Algorithms to solve these problems: compaction/separation
operators
Heuristic algorithms are usually used
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
5 / 39
Linear Programming Based Compaction
minimize the length of the container
separation constraints of polygons
v ij · pi ≤ dij ,
∀pi ∈ Pi ,
v ij · pj ≥ dij ,
∀pj ∈ Pj .
generate the constraints of adjacent polygons
limit the size of the translations and repeat solving LPs
v ij
Pj
Pi
dij
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
6 / 39
Bottom-left-fill
Specify an order of polygons and place them one by one
Find a feasible position on a line
Try several lines
Search for the best order of polygons
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
7 / 39
Basic Strategy
Repeat
Shrink the length of the container
Relocate polygons to minimize the total overlap
(iterated local search)
shrink
Initial solution
relocate
shrink
relocate
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
8 / 39
Overlap Minimization
Iterated local search
Incumbent solution: the best solution so far
Repeat perturbations of the incumbent solution and local searches
Local search
Perturbation
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
9 / 39
Overlap Minimization
Iterated local search
Incumbent solution: the best solution so far
Repeat perturbations of the incumbent solution and local searches
Local search
Perturbation
Local search — quasi-Newton method
Perturbation — swap two polygons and find their good positions
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
9 / 39
Pseudo Code
1
Generate an initial solution
2
While (within a time limit)
3
M INIMIZE OVERLAP
4
No overlap ⇒ Shrink the length of the container (rdec )
5
Otherwise ⇒ Expand the length of the container (rinc )
M INIMIZE OVERLAP(x best )
1
Until failing to update x best N consecutive times (N = 200)
2
x init := S WAP T WO P OLYGONS(x best )
3
x lopt := S EPARATE(x init )
4
x lopt has less amount of overlap than x best ⇒ x best := x lopt
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
10 / 39
Overlap Minimization Problem
Fix the container; No rotation
Minimize the total overlap of polygons
Formulated as an unconstrained nonlinear program
Define the amount of overlap by using the penetration depth
Propose a differentiable objective function
Apply the quasi-Newton method to obtain a locally optimal solution
(translate all polygons simultaneously)
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
11 / 39
Notation
Polygon
Polygons: Pi ,
1≤i≤n
Translation vectors: xi ,
1≤i≤n
Pi translated by xi :
Pi ⊕ xi = {p + xi | p ∈ Pi }
Container
The width of the container: W
The length of the container: L
Container:
C = {(x, y) | 0 ≤ x ≤ L, 0 ≤ y ≤ W }
y
Pi ⊕ xi
Pi
xi
x
O
The exterior region of C:
C = {(x, y) | (x, y) ∈ C}
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
12 / 39
No-fit Polygon (NFP) (Bennell et al. 2001)
No-fit polygon: NFP(Pi , Pj )
Fix Pi ’s reference point at the origin
The set of xj such that Pi and Pj ⊕ xj overlap
Pi
Pi
xi
Mutsunori Yagiura (Nagoya Univ)
Pj
O
xj
NFP(Pi , Pj )
ILS for the irregular strip packing problem
Reggio Emilia (2010)
13 / 39
No-fit Polygon (NFP)
Lemma 1
xj − xi ∈ NFP(Pi , Pj )
⇔ Pi and Pj overlap
xj − xi ∈ ∂ NFP(Pi , Pj )
⇔ Pi touches Pj
xj − xi ∈ cl(NFP(Pi , Pj )) ⇔ Pi and Pj are separated
Pi
Pi
xi
Mutsunori Yagiura (Nagoya Univ)
Pj
O
xj
NFP(Pi , Pj )
ILS for the irregular strip packing problem
Reggio Emilia (2010)
14 / 39
No-fit Polygon (NFP)
NFP(C, Pi )
The set of xj such that Pi ⊕ xi protrudes from C
NFP(C, Pi )
Pi
xi
C
C
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
15 / 39
No-fit Polygon (NFP)
Lemma 2
xi ∈ NFP(C, Pi )
⇔
Pi protrudes from C
xi ∈ ∂ NFP(C, Pi )
⇔
Pi is inside C and touches C
xi ∈ cl(NFP(C, Pi ))
⇔
C includes Pi
NFP(C, Pi )
Pi
xi
C
C
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
16 / 39
Relation between No-fit polygon and Minkowski sum
Lemma 3
NFP(Pi , Pj ) = int(Pi ) ⊕ (− int(Pj ))
= { pi − pj | pi ∈ int(Pi ), pj ∈ int(Pj )}
(Proof)
xj − xi ∈ int(Pi ) ⊕ (− int(Pj ))
⇔ ∃pi ∈ int(Pi ), ∃pj ∈ int(Pj ),
xj − xi = p i − p j
⇔ ∃pi ∈ int(Pi ), ∃pj ∈ int(Pj ),
p i + xi = p j + xj
⇔ ∃qi ∈ int(Pi ⊕ xi ), ∃qj ∈ int(Pj ⊕ xj ),
qi = qj
⇔ Pi ⊕ xi and Pj ⊕ xj overlap
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
17 / 39
Penetration Depth (Dobkin et al. 1993)
Penetration depth: δ(Pi , Pj )
The minimum translational distance to separate Pi and Pj
Lemma
δ(Pi ⊕ xi , Pj ⊕ xj ) is equal to the minimum distance
from xj − xi to the boundary of NFP(Pi , Pj ).
Pi
Pj
xj
xi
NFP(Pi , Pj ) ⊕ xi
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
18 / 39
Overlap Minimization Problem
Input: polygons P1 , . . . , Pn ; a fixed container C
minimize
subject to
1≤i<j≤n
2n
fij (x) +
gi (x)
1≤i≤n
x∈R
m(> 0): a parameter
x = (x1 , x2 , . . . , xn ): xi is the position of Pi ’s reference point.
fij (x) = δ(Pi ⊕ xi , Pj ⊕ xj )m : the amount of overlap of Pi and Pj .
m
gi (x) = δ(C, Pi ⊕ xi ) : the amount of protrusion of Pi from C.
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
19 / 39
Overlap Minimization Problem
Input: polygons P1 , . . . , Pn ; a fixed container C
minimize
subject to
1≤i<j≤n
2n
fij (x) +
gi (x)
1≤i≤n
x∈R
m(> 0): a parameter
x = (x1 , x2 , . . . , xn ): xi is the position of Pi ’s reference point.
fij (x) = δ(Pi ⊕ xi , Pj ⊕ xj )m : the amount of overlap of Pi and Pj .
m
gi (x) = δ(C, Pi ⊕ xi ) : the amount of protrusion of Pi from C.
Invoke the quasi-Newton method to compute a locally optimal solution
by using the current layout as the initial solution.
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
19 / 39
Penetration Penalty fij and ∇fij (Case 1)
Case 1: Pi and Pj are tangent or separated
fij (x) = δ(Pi ⊕ xi , Pj ⊕ xj )m = 0
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
20 / 39
Penetration Penalty fij and ∇fij (Case 1)
Case 1: Pi and Pj are tangent or separated
fij (x) = δ(Pi ⊕ xi , Pj ⊕ xj )m = 0
∇k fij (x) = 0,
k ∈ {1, . . . , n}
x = (x1 , . . . , xn ) ; xk = (xk1 , xk2 ),
∇k = (∂/∂xk1 , ∂/∂xk2 ), 1 ≤ k ≤ n
∇fij (x) = (∇1 fij (x), . . . , ∇n fij (x)),
1≤k≤n
Pi
Pj
xj
1≤k≤n
xi
Mutsunori Yagiura (Nagoya Univ)
xj − xi
ILS for the irregular strip packing problem
NFP(Pi , Pj )
Reggio Emilia (2010)
20 / 39
Penetration Penalty fij and ∇fij (Case 2)
Case 2: xj − xi has a unique nearest point on ∂ NFP(Pi , Pj )
fij (x) = δ(Pi ⊕ xi , Pj ⊕ xj )m = zm
v = xj − xi ; w = the nearest point from v on ∂ NFP(Pi , Pj )
z = w − v and the contour line of fij (x) are orthogonal
xj
NFP(Pi , Pj )
Pi
Pj
w
xi
Mutsunori Yagiura (Nagoya Univ)
v = xj − xi
ILS for the irregular strip packing problem
Reggio Emilia (2010)
21 / 39
Penetration Penalty fij and ∇fij (Case 2)
Case 2: xj − xi has a unique nearest point on ∂ NFP(Pi , Pj )
fij (x) = δ(Pi ⊕ xi , Pj ⊕ xj )m = zm
∇i fij (x) = − ∇j fij (x) = mzm−2 z
∇k fij (x) = 0,
k ∈ {1, . . . , n} \ {i, j}
v = xj − xi ; w = the nearest point from v on ∂ NFP(Pi , Pj )
z = w − v and the contour line of fij (x) are orthogonal
xj
NFP(Pi , Pj )
Pi
Pj
w
xi
Mutsunori Yagiura (Nagoya Univ)
v = xj − xi
ILS for the irregular strip packing problem
Reggio Emilia (2010)
21 / 39
Penetration Penalty fij and ∇fij (Case 3)
Case 3: xj − xi has two or more nearest points on ∂ NFP(Pi , Pj )
Choose one of the nearest points and compute ∇fij as in the
Case 2
v = xj − xi
This case happens only if v is on the medial axis of the NFP
Pj
Pi
xj
xi
Mutsunori Yagiura (Nagoya Univ)
w
v = xj − xi
NFP(Pi , Pj )
ILS for the irregular strip packing problem
Reggio Emilia (2010)
22 / 39
Protrusion Penalty gi and ∇gi
xi has a unique nearest point on NFP(C, Pi )
Compute ∇gi as in the Case 2 of ∇fij
w = the nearest point from xi on NFP(C, Pi )
Pi
C
Mutsunori Yagiura (Nagoya Univ)
NFP(C, Pi )
xi
ILS for the irregular strip packing problem
xi
w
Reggio Emilia (2010)
23 / 39
On Parameter m
Let m = 2 in our experiments
∇fij is continuous on ∂ NFP(Pi , Pj )
The equation ∇fij of Case 2 is simple
(mzm−2 z → 2z)
fij (x)
NFP
0<m<1
Mutsunori Yagiura (Nagoya Univ)
m=1
ILS for the irregular strip packing problem
m>1
Reggio Emilia (2010)
24 / 39
Separation Algorithm: S EPARATE
Given an initial layout, S EPARATE applies the quasi-Newton
method to the overlap minimization problem
Return a locally optimal layout
We adopt L-BFGS for the quasi-Newton method solver
Demonstration of S EPARATE
Fix the container
Place polygons randomly and apply S EPARATE
Move a blue polygon after S EPARATE ends
Apply S EPARATE again
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
25 / 39
Swapping Two Polygons
S WAP T WO P OLYGONS
Choose two polygons Pi and Pj randomly.
Fix the other polygons.
Move Pi and Pj to positions where overlap is small.
(try all orientations)
Pi
Pj
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
26 / 39
Swapping Two Polygons
S WAP T WO P OLYGONS
Choose two polygons Pi and Pj randomly.
Fix the other polygons.
Move Pi and Pj to positions where overlap is small.
(try all orientations)
Pj
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
26 / 39
Swapping Two Polygons
S WAP T WO P OLYGONS
Choose two polygons Pi and Pj randomly.
Fix the other polygons.
Move Pi and Pj to positions where overlap is small.
(try all orientations)
111111
000000
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
Mutsunori Yagiura (Nagoya Univ)
Pj
ILS for the irregular strip packing problem
Reggio Emilia (2010)
26 / 39
Swapping Two Polygons
S WAP T WO P OLYGONS
Choose two polygons Pi and Pj randomly.
Fix the other polygons.
Move Pi and Pj to positions where overlap is small.
(try all orientations)
Pi
Mutsunori Yagiura (Nagoya Univ)
Pj
111111
000000
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
ILS for the irregular strip packing problem
Reggio Emilia (2010)
26 / 39
Move a polygon at a position with small overlap
FindBestPosition(Pi )
Place NFP(Pk , Pi ) (k ∈ {1, . . . , n} \ {i}) and NFP(C, Pi ).
Let Q be a set of K vertices chosen randomly from the NFPs.
Find the minimum overlap position t from Q.
Try all orientations of Pi and find the best rotation ri .
(K = 800 in our experiments)
Pi
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
27 / 39
Initial Solution
Generate a sequence of polygons in descending order of area.
Place polygons in the sequence one by one
by F IND B EST P OSITION.
i
111111
000000
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
000000
111111
i+1
i+2
F IND B EST P OSITION
111111
000000
000000
111111
000000
111111
000000
111111
000000
111111
i
000000
111111
000000
111111
000000
111111
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
28 / 39
Pseudo Code
1
Generate an initial solution
2
While (within a time limit)
3
M INIMIZE OVERLAP
4
No overlap ⇒ Shrink the length of the container (rdec )
5
Otherwise ⇒ Expand the length of the container (rinc )
M INIMIZE OVERLAP(x best )
1
Until failing to update x best N consecutive times (N = 200)
2
x init := S WAP T WO P OLYGONS(x best )
3
x lopt := S EPARATE(x init )
4
x lopt has less amount of overlap than x best ⇒ x best := x lopt
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
29 / 39
Environment
PC
CPU: Xeon 2.8GHz (NetBurst)
Memory: 1GB
OS: FreeBSD 5.3-Release
Compiler: GCC 4.02 (C++)
Parameters
rdec = 0.04, rinc = 0.01, N = 200
Shrink the right side of the container
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
30 / 39
Information of Benchmark Instances
Instance
ALBANO
DAGLI
DIGHE1
DIGHE2
FU
JAKOBS1
JAKOBS2
MAO
MARQUES
SHAPES0
SHAPES1
SHAPES2
SHIRTS
SWIM
TROUSERS
NDP
8
10
16
10
12
25
25
9
8
4
4
7
8
10
17
TNP
24
30
16
10
12
25
25
20
24
43
43
28
99
48
64
ANV
7.25
6.30
3.87
4.70
3.58
5.60
5.36
9.22
7.37
8.75
8.75
6.29
6.63
21.90
5.06
Orientations ( ◦ )
180
180
0
0
90
90
90
90
90
0
180
180
180
180
180
Width
4900
60
100
100
38
40
70
2550
104
40
40
15
40
5752
79
NDP: the number of different polygons
TNP: the total number of polygons
ANV: the average number of vertices
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
31 / 39
Comparison of Computational Times (sec)
Instance
ALBANO
DAGLI
DIGHE1
DIGHE2
FU
JAKOBS1
JAKOBS2
MAO
MARQUES
SHAPES0
SHAPES1
SHAPES2
SHIRTS
SWIM
TROUSERS
Ours
2.8 GHz
10 runs
1200
1200
600
600
600
600
600
1200
1200
1200
1200
1200
1200
1200
1200
Mutsunori Yagiura (Nagoya Univ)
Gomes et al.
2.4 GHz
20 runs
2257
5110
83
22
296
332
454
8245
7507
3914
10314
2136
10391
6937
8588
Burke et al.
2.0 GHz
40 runs
–
188.80
–
–
20.78
43.49
81.41
29.74
4.87
21.33
2.19
21.00
58.36
607.37
756.15
ILS for the irregular strip packing problem
Egeblad et al.
3.0 GHz
20 runs
600
600
600
600
600
600
600
600
600
600
600
600
600
600
600
Reggio Emilia (2010)
32 / 39
Comparison of Densities (%)
Instance
ALBANO
DAGLI
DIGHE1
DIGHE2
FU
JAKOBS1
JAKOBS2
MAO
MARQUES
SHAPES0
SHAPES1
SHAPES2
SHIRTS
SWIM
TROUSERS
Ours
Average Best
87.14 88.16
85.80 87.40
90.49 99.89
84.21 99.99
87.57 90.67
84.78 86.89
80.50 82.51
81.31 83.44
86.81 89.03
66.49 68.44
72.83 73.84
81.72 84.25
88.12 88.78
74.62 75.29
88.69 89.79
Mutsunori Yagiura (Nagoya Univ)
Gomes et al. Burke et al. Egeblad et al.
Best
Best
Best
87.43
–
87.44
87.15
83.7
85.98
100.00
–
99.86
100.00
–
99.95
90.96
86.9
91.84
78.89
82.6
89.07
77.28
74.8
80.41
82.54
79.5
85.15
88.14
86.5
89.17
66.50
60.5
67.09
71.25
66.5
73.84
83.60
77.7
81.21
86.79
84.6
86.33
74.37
68.4
71.53
89.96
88.5
89.84
ILS for the irregular strip packing problem
Reggio Emilia (2010)
33 / 39
Layouts
DAGLI / 87.40%
JAKOBS2 / 82.51%
ALBANO / 88.16%
SWIM / 75.29%
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
34 / 39
Layouts
SHAPES0 / 68.44%
SHAPES2 / 84.25%
Mutsunori Yagiura (Nagoya Univ)
SHAPES1 / 73.84%
SHIRTS / 88.78%
ILS for the irregular strip packing problem
Reggio Emilia (2010)
35 / 39
Original Instance
Japan×10
180 ◦ rotations; avg. # vertices: 135
Time limit: 1 hour; #runs: 5
Density: 62.83%
x10
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
36 / 39
Original Instance
Scandinavia×10
180 ◦ rotations; avg. # vertices: 124.6
Time limit: 3000 seconds; #runs: 2
Density: 59.6%
x10
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
37 / 39
Original Instance
Italy×20
90 ◦ rotations; # vertices: 148
Time limit: 3000 seconds; #runs: 5
Density: 53.95%
x 20
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
38 / 39
Conclusions
Overlap minimization based on nonlinear programming
Iterated local search algorithm incorporating nonlinear
programming and the swapping operation
We updated several best known results
Future work
Circles or other shapes in 2D
3D objects
Mutsunori Yagiura (Nagoya Univ)
ILS for the irregular strip packing problem
Reggio Emilia (2010)
39 / 39