Reducing the time of heuristic algorithms for the Symmetric TSP
-
Upload
guilherme-polo -
Category
Documents
-
view
220 -
download
0
Transcript of Reducing the time of heuristic algorithms for the Symmetric TSP
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 1/79
Available at http://goo.gl/rjSw
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 2/79
Available at http://goo.gl/rjSw
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 3/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 4/79
!N
N !
2 N
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 5/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 6/79
1 2 3 4 6 5
12
3
4
5
6
12
3
4
5
6
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 7/79
G r e e
d y
A l g o r i t h m
1naive-greedy-nn (start , n, C )
be T [1 . . n ] a new array
visited = ∅; curr = start ; cost = 0for i = 1 to n − 1T [i] = curr ; visited = visited ∪ {curr }min = ∞ ; next = nil
forj = 1
tonif j ∈visited and C (curr , j ) < min
min = C (curr , j )next = j
cost = cost + min
curr = next
T [n ] = curr
cost = cost + C (curr , start )return (T, cost )
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 8/79
80000 * 80000 * 8 = 51200000000 Bytes51200000000 / 1024 / 1024 / 1024 ≈ 47.6837158 GB
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 9/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 10/79
Average of 5 executions, user time + system time
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 11/79
* Along with operations that make good use of the structure
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 12/79
vm1084d2103
d15112
d18512
pla33810
pla85900
0,01 0,1 1 10 100
0,17
0,07
0,04
0,04
0,01
0,01
56,04
8,58
2,94
2,15
0,04
0,02
Excution time (seconds)
1
127
254
380
vm1084 pla85900
329,64
122,57
73,5053,75
4,002,00
Improvement (times)
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 13/79
0%
25%
50%
75%
100%
d15112 d18512 pla33810 pla85900
12%11%11%9%
22%20%18%15%
15%20%25%37%
17%16%16%14%
34%32%30%25%
Activity/Time in the improved Greedy
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 14/79
0
2,5
5,0
7,5
10,0
pla85900 rl2-1116700 rl2-2147500 rl2-3178300 rl2-4209100
y = 0,0966x - 0,1196
R ² = 0,9988
Time for running Greedy NN
Time (s) Tendency
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 15/79
0
2,5
5,0
7,5
10,0
pla85900 rl2-1116700 rl2-2147500 rl2-3178300 rl2-4209100
y = 0,0408x 1,4135
R ² = 0,9941
Time for structure initialization
Time (s) Tendency
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 16/79
0
2,5
5,0
7,5
10,0
pla85900 rl2-1116700 rl2-2147500 rl2-3178300 rl2-4209100
Initialization and Greedy tour
Init time (s) Greedy time (s)
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 17/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 18/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 19/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 20/79
Example construction
algorithmbuild (P,l ,u,d )node = kdnode-new ()if u − l = = 0
node . val = P [l]else
m = ( l + u)/ 2if (d mod 2) = = 0
sort (P,l,u, X )
node . cut = P [m]. x else
sort (P,l,u, Y )node . cut = P [m]. y
node . left = build (P,l ,m,d + 1)
node . right =build
(P, m + 1 ,u ,d + 1)return node
Maximum amount of pointsin a bucket; 1 here
Beware of the cost
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 21/79
Construction example
XY
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 22/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25) >Sort by x
<(5;5), (25;10), (20, 15), (10;20), (30;25), (10;30) >
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Sorted by x
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 23/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25) >
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Sorted by x
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 24/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25)>Sorted by y
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 25/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25)>Sorted by x
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 26/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25)>
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 27/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25)>
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 28/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25)>
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 29/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (25;10), (20;15), (30;25) >Sorted by y
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 30/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25) >Sorted by x
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 31/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25) >
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 32/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25) >
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 33/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
<(5;5), (10;20), (10;30), (20;15), (25;10), (30;25) >
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30
Construction example
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 34/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 35/79
XY
tree = BUILD(<(5;5), (25;10), (20;15), (10;20), (30;25), (10;30)>, 1, 6, 0)
350 5 10 15 20 25 30
35
0
5
10
15
20
25
30
5,5
25,10
20,15
10,20
30,25
10,30 10
20
X
Y
5X
5;
5
10;
20
10;
30
15
20
20;
15
25;
10
30;
25
C u t d i m e n s i o n
Another representation
Construction example
rnn (root , d )
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 36/79
Example algoritm
for Top-Down NNsearch
kdtree-nn (root , nntarget )target = nntarget dist = ∞
nn = NIL
rnn (root , 0)return nn
( , )if root . val = NIL
if root . val = = target return
thisdist =
euc-2d
(root . val , target
)if thisdist < dist dist = thisdist nn = root . val
else
cutval = root . cut if (d mod 2) = = 0
thisval = target . x else thisval = target . y if thisval ≤ cutval
rnn (root . left , d + 1)if (thisval + dist ) > cutval
rnn (root . right , d + 1)else
rnn (root . right , d + 1)if (thisval − dist ) < cutval
rnn (root . left , d + 1)
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 37/79
Example NN search
10
20
X
Y
5X
5;
5
10;
20
10;
30
15
20
20;
15
25;
10
30;
25
Find the closest point to 10;30
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 38/79
10
20
X
Y
5X
5;
5
10;
20
15
20
20;
15
25;
10
30;
25
10 <= 10
10;
30
Example NN search
Find the closest point to 10;30
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 39/79
10 <= 1030 > 20
10
20
X
Y
5X
5;
5
10;
20
15
20
20;
15
25;
10
30;
25
10;
30
Example NN search
Find the closest point to 10;30
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 40/79
10 <= 1030 > 20
return30 - ∞ < 20
10
20
X
Y
5X
5;
5
10;
20
15
20
20;
15
25;
10
30;
25
10;
30
Example NN search
Find the closest point to 10;30
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 41/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 42/79
10 <= 1030 > 20
return30 - ∞ < 20
10 > 5 dist = 10nn = 10;20
10
20
X
Y
5X
5;
5
10;
20
15
20
20;
15
25;
10
30;
25
Euclidean distance
dist = 10nn = 10;20
10;
30
Example NN search
Find the closest point to 10;30
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 43/79
10 <= 1030 > 20
return30 - ∞ < 20
10 > 5dist = 10nn = 10;2010 - 10 < 5
não altera dist
10
20
X
Y
5X
5;
5
10;
20
10;
30
15
20
20;
15
25;
10
30;
25
Euclidean distancedist unaffected
Example NN search
Find the closest point to 10;30
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 44/79
10 <= 1030 > 20
return30 - ∞ < 20
10 > 5dist = 10nn = 10;2010 - 10 < 5
dist unaffected10 + 10 > 10
10
20
X
Y
5X
5;
5
10;
20
15
20
20;
15
25;
10
30;
25
10;
30
Example NN search
Find the closest point to 10;30
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 45/79
10 <= 1030 > 20
return30 - ∞ < 20
10 > 5dist = 10nn = 10;2010 - 10 < 5
dist unaffected10 + 10 > 10
30 > 15não altera dist30 - 10 ≮ 15
10
20
X
Y
5X
5;
5
10;
20
15
20
20;
15
25;
10
30;
25
10;
30
Euclidean distance
dist unaffected30 - 10 ≮ 15
Example NN search
Find the closest point to 10;30
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 46/79
10
20
X
Y
5X
5;
5
10;
20
15
20
20;
15
25;
10
30;
25
10;
30
Example NN search
Find the closest point to 10;30
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 47/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 48/79
* Implementation found in Robert Sedgewick’s book
for |sub-array| ≤ 16
BNDS_LEVEL: 3 XXX não uso no greedy
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 49/79
G r e e
d y
A l g o r i t h m
2 kdtree-greedy-nn (tree , start , n, C )be T [1 . . n ] a new arrayT [1] = start curr = start
cost = 0for i = 2 to n
kdtree-delete ( tree , curr )next = kdtree-nearest ( tree , curr , C )T [i] = next
cost = cost + C (curr, next )curr
=next
cost = cost + C (curr , start )kdtree-undelete-all (tree , n )return (T, cost )
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 50/79
Naïve Improved* Diff ~
vm1084 290.806 286.437 1,52%
d2103 86.504 86.765 -0,29%
d15112 1.960.503 1.921.015 2,05%
d18512 799.220 779.783 2,49%
pla33810 77.332.499 81.131.055 -4,68%
pla85900 163.516.994 174.486.522 -6,29%
* Best result found starting from every point
3 304
806
0
0
0
0
6523
761
10818
11394
38007
(Naïve / Improved - 1) * 100
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 51/79
Achieved Optimal Prox ~
vm1084 286.437 239.297 19,70%
d2103 86.504 80.450 7,52%
d15112 1.921.015 1.573.084 22,11%
d18512 779.783 645.238 20,85%
pla33810 77.332.499 66.048.945 17,08%
pla85900 163.516.994 142.382.641 14,84%
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 52/79
1 5 4 3 2 6 7 8 9a b c d
1 2 3 4 5 6 7 8 9a c b d
1
2
3
4
56
7
8
9
1
2
3
4
56
7
8
9
2-exchange
naive-2opt (T,n, cost , C )
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 53/79
2 - O
p t A l g o r i t h m
( , , , )repeat
gain = 0for i = 1 to n
for j = i + 2 to nif (( j + 1) mod n ) = = i
continuea = T [i]; b = T [(i + 1) mod n ]
c = T [ j ]; d = T [( j + 1) mod n ]new -gain = C (a, c ) + C (b, d )−
(C (a, b ) + C (c, d ))if new -gain < gain
gain = new -gain best = [b, c]
if gain < 0cost = cost + gain invert (T, best [1], best [2])
until gain = =
0
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 54/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 55/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 56/79
dist(a,b)
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 57/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 58/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 59/79
1
2
3
4
56
7
8
9a
b
c
d
1
2
3
4
56
7
8
9a
b
c
d
x
1
2
3
4
56
7
8
9
2 -
O p t
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 60/79
1
2
3
4
56
7
8
9a
b
c
d
1
2
3
4
56
7
8
9
1 2 6 7 8 9 5 4 3
1 2 9 6 7 8 5 4 3a d
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 61/79
2-Opt 2. 1/4-Opt Prox.
T (s) Exchgs. Cost T (s) Exchgs. Cost ~*
vm1084 0,00 153 260.184 0,00 190 254.355 6,29%
d2103 0,00 147 82.751 0,00 174 82.402 2,42%
d15112 0,07 3.564 1.686.957 0,07 4.228 1.666.102 5,91%
d18512 0,08 4.023 692.396 0,09 4.949 680.798 5,51%
pla33810 0,17 6.002 72.031.744 0,24 7.830 70.744.397 7,11%pla85900 0,64 16.845 153.558.764 0,70 20.844 150.777.638 5,90%
* Considering best obtained
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 62/79
0
38
75
113
150
pla85900 rl2-515400 rl2-944900
y = 1,3369x 2 - 7,1294x + 10,326R ² = 0,9936
Approximated 2-Opt time
2-Opt (s) Tendency
0
75000
150000
225000
300000
pla85900 rl2-515400 rl2-944900
y = 20546x + 252,05R ² = 0,999
Exchanges in the approximated 2-Opt
2-Opt swaps Tendency
0E+00
1,3E-04
2,5E-04
3,8E-04
5,0E-04
pla85900 rl2-515400 rl2-944900
y = 4,722E-6x 2 - 1,905E-5x + 7,019E-5R ² = 0,9957
“2-exchange” time
Time/Exchange (s) Tendency
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 63/79
0
38
75
113
150
pla85900 rl2-515400 rl2-944900
y = 1,7278x 2 - 9,8544x + 14,61R ² = 0,9848
Approximated 2.1/4-Opt time
2.1/4-Opt (s) Tendency
0
75000
150000
225000
300000
pla85900 rl2-515400 rl2-944900
y = 25368x - 2354,1R ² = 0,9976
Exchanges in the approximated 2.1/4-Opt
2.1/4-Opt swaps Tendency
0E+00
1,3E-04
2,5E-04
3,8E-04
5,0E-04
pla85900 rl2-515400 rl2-944900
y = 4,631E-6x 2 - 1,768E-5x + 6,255E-5R ² = 0,9852
“2.1/4-exchange” time
Time/Exchange (s) Tendency
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 64/79
0
38
75
113
150
pla85900 rl2-515400 rl2-944900
Approximated local search time
2-Opt (s) 2.1/4-Opt (s)
0
75000
150000
225000
300000
pla85900 rl2-515400 rl2-944900
Exchanges in the local search
2-Opt trocas 2.1/4-Opt trocas
0E+00
1,3E-04
2,5E-04
3,8E-04
5,0E-04
pla85900 rl2-515400 rl2-944900
Time/Exchange
2-exchange (s) 2.1/4-exchange (s)
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 65/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 66/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 67/79
kdtree-grasp (n )be B [1 . . n ] a new arraybest
-cost
=∞
while stopping conditions not metGT = kdtree-semigreedy-tour (random (n ))T, cost = kdtree-2opt (GT )if cost < best -cost
best -cost = cost
B = T return (B, best -cost )
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 68/79
“ KNN”
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 69/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 70/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 71/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 72/79
KG+2. 1/4 GRASP* Prox.T (s) Cost T (s) Execs. Cost ~
vm1084 0,00 254.355 >> 16.207 249.164 4,12%
d2103 0,00 82.402 >> 7.260 87.860 =
d15112 0,07 1.666.102 >> 6.451 1.668.978 =
d18512 0,09 680.798 >> 10.014 685.330 =
pla33810 0,24 70.744.397 >> 11.903 71.776.398 =pla85900 0,70 150.777.638 >>> 7.445 152.935.500 =
* Results found by using the rand48 family of functions; seed fixed at 0
Worse than Greedy-NN
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 73/79
* Considering all the choices implemented in this K-d treeand in this GRASP
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 74/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 75/79
Instance Cost Distance
a280 2.599 0,77%
berlin52 7.542 0,00%
ch130 6.117 0,11%
d15112 1.666.102 5,91%
d18512 680.798 5,51%
d2103 82.402 2,42%
dantzig42 699 0,00%
eil101 629 0,00%
eil51 426 0,00%
fri26 937 0,00%
GRASP
KG+2. 1/4
Instance Cost Distance
kroA100 21.282 0,00%
kroC100 20.749 0,00%
pla33810 70.774.397 7,11%
pla85900 150.777.638 5,90%
rat575 7.035 3,86%
rat99 1.211 0,00%
st70 675 0,00%
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 76/79
K-d tree
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 77/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 78/79
8/8/2019 Reducing the time of heuristic algorithms for the Symmetric TSP
http://slidepdf.com/reader/full/reducing-the-time-of-heuristic-algorithms-for-the-symmetric-tsp 79/79