NP-困難な組合せ最適化問題に対する近似解法
-巡回セールスマン問題を例として-
Salesman Problem
Traveling
Approximate Algorithm
Implementation
Experimental Analysis
Metaheuristics for
Combinatorial Optimization Problems
Traveling Salesman Problem (TSP)
Definition
Given n points (cities) and a distance function
between two points, find a minimum length Hamiltonian circuit
a b
|ab|=|ba| Symmetric TSP
|ab|=|ba|
otherwise Asymmetric TSP
b
a c |ac|≦|ab|+|bc| ΔTSP
points are in d-dim. Euclidean space
Euclidean TSP
Icosian Game (Origin of Hamiltonian Circuit)
Invented by W. R. Hamilton
Icosian Game (1)
20
4
3
2
1
Icosian Game (2)
20
5
6
4
3
2 7
1
Icosian Game (3)
20 9
5
6
4
3
2 7
1 8
Icosian Game (4)
11
20 9
13 12 10
14 5
6
4
3
2 7
1 8
Icosian Game (5) 19
18
17 11
20 9
16 13 12 10
14 5
15 6
4
3
2 7
1 8
Knight Tour
Knight Tour (by Leonhard Euler)
Applications of TSP
基盤配線
配送計画
タンパク質構造解析
Applications
10 P
clustering a data array p= 2
circuit board assembly computer wiring 3
circuit board drilling vehicle routing 4
protein conformations
x-ray crystallography
5
VLSI Scan Chain Optimization
6
VLSI fabrication
7
World Record of Exact Algorithm
for Euclidean Benchmarks (TSPLIB95)
• Dantzig, Fulkerson & Johnson 49 cities (1954)
• Held & Karp 65 cities (1971)
• Crowder & Padberg 318 cities (1980)
• Padberg & Rinaldi 532 cities (1987)
• Grotschel & Holland 666 cities (1991)
• Padberg & Rinaldi 2392 cities (1991)
• Applegate, Bixby, Chvatal, & Cook 7392 cities (1996)
Theoretical Results
Assuming P ≠NP
no polynomial-time algorithm
can guarantee
2
A(I)/OPT(I) ≦ p(n)
Symmetric TSP for any fixed polynomial p
A(I)/OPT(I) ≦1.5 A(I)/OPT(I) ≦ 1+ε
(Christofides’ O(n3)
△TSP for an ε>0
algorithm)
A(I)/OPT(I) ≦ 1+ε
A(I)/OPT(I) ≦ 1+ε
for any ε>0 if d is O(1) d-dimensional for an ε>0
(Arora’s
O(n 12 2 13 log n/ε)
Euclidean TSP if d is Θ(n)
algorithm)
Approximate Algorithms
Construction Algorithms
– Nearest Neighbor
– Greedy
– Christiofides’
– Insertion
– Karp’s
– Bucket
Improvement Algorithm
– 2,3,..k-opt
– Lin-Kernighan opt
Nearest Neighbor
適当な点から出発し、まだ訪問していない最も近い点へ移動する
全ての点を訪問したら出発点へもどる
Nearest Neighbor (Worst Case Results)
Running Time : n2
NN(I)
log 2 n 1
1
∀I
OPT(I) 2
NN(I)
log n ∃I
OPT(I)
Greedy (Multiple Fragment)
閉路ができたり、次数が2を超えないように、枝を短い順に加えていく
Greedy (Worst Case Results)
2
Running Time : n log n
Greedy(I) 1
log 2 n 1
∀I
OPT(I) 2
log n Greedy(I)
∃I
3 log log n OPT(I)
Christofides’ (1)
奇数次数を持つ頂点を赤く塗りつぶす
最小木を作る
奇数次数を持つ頂点に対して最小マッチングを求める
Christofides’ (2)
一度通過した点をスキップすることにより、順回路をえる
まだ通過していない枝をグラフ非連結にならないようにたどる
Christofides’ (Worst Case Results)
Running Time : n
3
Christofides(I) 3 ∀I
OPT(I) 2
3 Christofides(I) ∃I
2 OPT(I)
Convex Hull +Insertion Running Time : n
2
凸包で点を囲むように巡回路をつくる
巡回路に入っていない,最も遠い点へ移動する
Karp’s Partitioning Method (1)
長方形で、p個の点が入るように分割する
各小領域に対する最適巡回路を求める
Karp’s Partitioning Method (2)
長方体と交わる点の枝を非連結にならないようにたどる
Karp’s Partitioning Method
Probabilisitcs Analysis
BHH Theorem (Beardwood, Halton and Hammersley, 1959)
面積Aの正方領域にランダムにばらまかれた
n個の点に対する
lim OPT(I) = An (β≒0.7124)
β=0.749 BHH (1959)
too optimistic!
β=0.765 Stein (1977)
Bucket Running Time : n
全ての点を含む単位正方形で小領域に分割し、適当な順序をつける
決められた順序(小領域内では任意)で点を訪問する
組合せ最適化問題(概念図)
目的関数 f(x) 大域的最適解
実行可能解の集合 F
山頂を目指す闇夜の登山者
x 近傍 N(x)
2-opt,3-opt neighborhood
Local Search
闇夜の登山者(ここが山頂?)
局所最適解
2-opt,3-opt,k-opt (Worst Case Results)
n ∃I
Running Time : 2 2
k 6 opt
PLS-complete
Lin Kernighan opt
1 A 2-opt(I)
4
n
OPT(I)
A 3-opt(I) A 2,3,k-opt(I)
4 n ∀I
1
1 ∃I
n
6 OPT(I)
4 OPT(I)
A k-opt(I)
1 21k
n
4 OPT(I)
Implementation
Geometric data structure
– Bucket
– Delaunay Triangulation
– K-d tree
Tour data structure
for solving
– Array
– Two-level Tree
108 TSP
– Segment Tree within 1%
– Splay Tree of optimum
Semidynamic K-d tree kdtree
Build K-d tree (1)
cutdim=X
A K cutval=x(N)
F GH J
D E
I
B
C M
P L
O N ABC DE PO NF G H I JK M L
Build K-d tree (2)
cutdim=X
A K cutval= X(N)
F GH J
D E
I cutdim=Y
cutval=Y(B)
B
C M
P L
O N ABD E C PO N F G H I JK M L
Build K-d tree (3) : O(Kn + n log n) time
cutdim=X
A K cutval= X(N)
F GH J
D E
I cutdim=Y cutdim=Y
cutval=Y(B) cutval=Y(F)
B
C M
P L
O N ABD E C PO N FG JK H I ML
Delete point Delete(D) (1)
D
φ=0
cutdim=X
A K cutval= X(N)
D F GH J
E φ=0 φ=0
I cutdim=Y cutdim=Y
cutval=Y(B) cutval=Y(F)
B
C M
P L φ=0
O N ABD E C PO N F G JK H I ML
φ=0 φ=0 φ=0
LOPT HIPT
Delete point Delete(D) (2)
D
φ=0
cutdim=X
A K cutval= X(N)
F GH J
E φ=0 φ=0
I cutdim=Y cutdim=Y
cutval=Y(B) cutval=Y(F)
B
C M
P L φ=0
O N ABE D C PO N F G JK H I ML
φ=0 φ=0 φ=0
LOPT HIPT
Delete (Undelete) point:
O(1) amortized time
φ=0
cutdim=X
cutval= X(N)
φ=1 φ=0
cutdim=Y cutdim=Y
cutval=Y(B) cutval=Y(F)
φ=1 φ=1
ABD E C PO N F G JK H I ML
φ=0 φ=0
HIPT Delete( tour[0] );
for ( i=1; i nn(tour[i-1]); // O(1) (average)
tree-> Delete(tour[i]); // O(1) (amortized)
}
}
Average runing time: O(n log n)
Fixed-Radius Near Neighbor frnn (E, r, f)
Find the point(s) f within radius r of point E (1)
cutdim=X
cutval= X(N)
A
D r
E
cutdim=Y
cutval=Y(B)
B
Check the point
in the same bucket!
ABD E
Fixed-Radius Near Neighbor frnn (E, r, f)
Find the point(s) f within radius r of point E (2)
cutdim=X
cutval= X(N)
A
D
E
cutdim=Y
cutval=Y(B)
B
Check the points
C in the bucket, too!
P
O N ABD E C PO N
2-opt (1)
frnn(a,|ab|)
b=next(a)
a
c
|ab|+|cd| > |ac| + |bd| d=next(c)
2-opt (2)
b=next(a)
a
c
flip(a,b,c,d)
d=next(c)
2-opt procedure two_opt
for TSP using K-d tree
void two_opt (point_set *N, int *tour) Tour Database Type
{ restart: Array Splay Tree
for all a ∈unserched_list) { (amortized)
b = next(a); O(1) O(log n)
for all c ∈ frnn(a,|ab|){
d =next (c); O(1) O(log n)
if (|ab|+|cd|>|ac|+bd|){
flip(a,b,c,d); O(n) O(log n)
add b,c,d to unserched_list;
goto restart;
}
Average runing time: O(n log n)
}
remove point a from unserched_list; } }
Ball Search ballsearch(E, f)
Each point has an associated radius.
Query asks which balls contain a given point.
cutdim=X
A K cutval= X(N)
F GH J
D E
I cutdim=Y cutdim=Y
cutval=Y(B) cutval=Y(F)
B
C M
P L
O N ABD E C PO N F G JK H I ML
Balls that
A,B,D,E,F,P intersect the bucket
Insertion Method
using K-d tree(1)
ballsearch(a)
a
b=nn(a)
Insertion Method
using K-d tree(2)
a
Average running time: O(n log n)
Tabu Search 1
に戻らないように
一番高い地点へ移動しよう!
Tabu Search 2
|TL|=2
Tabu Search 3
|TL|=2
FIFO
Tabu Search 4
Tabu Search 5
Tabu Search 6
Tabu Search 7
Tabu Search 8
Tabu Search 9
Tabu Search 10
Lin-Kernighan opt
(=3-opt + Depth-first Tabu Search using
2-opt neighborhood)
c
f
d
e
b
a
LK Search
(Depth-first Tabu Search using 2-opt neighborhood)
f c
d
e
b a
a d e b c f
Tabu
LK Search
(Depth-first Tabu Search using 2-opt neighborhood)
a d e b c f
a f c b e d
a f d e b c
Experimental Analysis
Using random Euclidean instances with
n=100 to 1000000 cities.
Using TSPLIB (real) instances
n=48 to 85900 cities.
Using random distance instances.
Quality for tour generation
heuristics
30
Percent Excess over
the Held-Karp Lower
Bound 25
20
Christofides
Clarke-Wright
15 Greedy
Nearest Neighbor
10
5
0
2 2.5 3 3.5 4 4.5 5 5.5 6
P P
(# of Cities =10 )
Running times for tour
generation heuristics
100000
CPU Time in
Seconds on 150Mhz
SGI Challenge 10000
1000
100
Christofides
Clarke-Wright
10
Greedy
Nearest Neighbor
1
2 2.5 3 3.5 4 4.5 5 5.5 6
0.1 P
0.01
0.001
P
(# of Cities =10 )
Quality for improvement
heuristics
5
Percent Excess over
the Held-Karp 4.5
Lower Bound
4
3.5
3 2-opt
3-opt
2.5 Lin-Kernighan
Iterated LK
2 SA2
1.5
1
0.5
0
2 2.5 3 3.5 4 4.5 5 5.5 6
P P
(# of Cities =10 )
Running times for improvement
heuristics
100000
CPU Time in
Seconds on 150Mhz
SGI Challenge 10000
1000
2-opt
100
3-opt
Lin-Kernighan
Iterated LK
10
SA2
1
2 2.5 3 3.5 4 4.5 5 5.5 6
0.1
P
0.01
P
(# of Cities =10 )
Undominated Algorithms
Percent Excess
over OPT(I) Karp’s
30% Bucket
25% Nearest Neighbor
15% Greedy Insertion
Christofides’
5% 2-opt
3% 3-opt SA
2% Lin-Kernighan
1% Iterated-LK
0% n nlogn Running Time