You are on page 1of 4

This spreadsheet solves the famous travelling salesman problem of

finding the shortest cyclical itinerary for a travelling salesman who must
visit each of N cities in turn. In addition a penalty may me assigned for
each river crossing. An algorithm is based on the method of simulated
annealing published in the Numerical Recipes in C, 2nd edition (1992) .
For more information on this method visit NRC website at:
http://www.nrbook.com/a/bookcpdf.php
cities =
x(min) =
y(min) =

50 (< 1000)
0 x(max) = 100
-20 y(max) = 20

River alignment
x
y
10
-10
20
0
50
12
70
16
115
2

Precision
k1
k2
N iter

control
100
10
1

25

20
36

18

Circuit path length : 447.759


Number of river crossings :
1
Penalty for river crossing :
125
Path length including penalty: 572.759

Order
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

Original Order
x
y
90.8931 -14.176
81.6019 -10.961
4.49978 0.15034
19.2479 -0.2476
79.9836 -7.4321
28.6311 -4.5251
34.6967 9.7539
53.4223 11.3017
49.1751 -17.435
5.94451 -0.055
21.8257 -19.586
59.3605 1.10952
98.6141 15.6409
14.8604 -19.133
77.7519 -2.1077
43.8493 -18.968
89.3845 -1.5063
5.13455 18.5341
50.2782 -15.174
37.1134 14.7981
93.508 -15.302
24.9604 -4.8859

50

15
44

Solved in 26.58 seconds

Shortest path order


Order
x
y
1 90.8931 -14.176
21
93.508 -15.302
29 84.5872 -4.1675
28 88.0536 -1.8379
17 89.3845 -1.5063
47 85.0681 3.33159
48 96.4139 5.92274
13 98.6141 15.6409
43
39.115 18.8855
39 50.6311 14.8514
20 37.1134 14.7981
7 34.6967 9.7539
40 33.5504 13.1167
44 26.6834 13.2908
36
22.728 18.545
18 5.13455 18.5341
50 11.3064 16.5967
35
20.251 10.4676
33 20.2735 2.28635
4 19.2479 -0.2476
45
9.9891 -1.2904
38 8.96065 -0.4517

35

10

5
41

33
3 10

0
0

38
45

20
22 6

-5
-10

-15
-20

-25

27
14

11

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

73.1448
42.815
43.9434
70.9689
16.0294
88.0536
84.5872
38.2282
34.5472
73.3664
20.2735
70.2444
20.251
22.728
66.7736
8.96065
50.6311
33.5504
0.79668
44.7579
39.115
26.6834
9.9891
66.4545
85.0681
96.4139
42.9349
11.3064

0.7255
-1.9852
-5.2972
14.6501
-18.021
-1.8379
-4.1675
-16.94
1.84729
-5.4047
2.28635
-11.863
10.4676
18.545
15.1385
-0.4517
14.8514
13.1167
2.33819
8.83765
18.8855
13.2908
-1.2904
9.42281
3.33159
5.92274
5.95205
16.5967

10
3
41
14
27
11
22
6
31
42
49
24
25
30
16
9
19
12
8
37
26
46
23
15
32
34
5
2

5.94451
4.49978
0.79668
14.8604
16.0294
21.8257
24.9604
28.6311
34.5472
44.7579
42.9349
42.815
43.9434
38.2282
43.8493
49.1751
50.2782
59.3605
53.4223
66.7736
70.9689
66.4545
73.1448
77.7519
73.3664
70.2444
79.9836
81.6019

-0.055
0.15034
2.33819
-19.133
-18.021
-19.586
-4.8859
-4.5251
1.84729
8.83765
5.95205
-1.9852
-5.2972
-16.94
-18.968
-17.435
-15.174
1.10952
11.3017
15.1385
14.6501
9.42281
0.7255
-2.1077
-5.4047
-11.863
-7.4321
-10.961

43
13

37 26

39

20
44

40
8
7

46

42
49

48
47

31

12

40
6

23

60

24

2817

8015

25

100

29

32
5

34
19
30

9
16

2
1

21

120

140

You might also like