Anda di halaman 1dari 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 50 (< 1000) River alignment Precision control


x(min) = 0 x(max) = 100 x y k1 100
y(min) = -20 y(max) = 20 10 -10 k2 10
20 0 N iter 1
50 12
70 16
115 2
12

Circuit path length : 447.759 10


Number of river crossings : 1
Penalty for river crossing : 125
Path length including penalty: 572.759 Solved in 26.58 seconds
8

Original Order Shortest path order


Order x y Order x y
1 90.8931 -14.176 1 90.8931 -14.1759 6
2 81.6019 -10.961 21 93.508 -15.3021
3 4.49978 0.15034 29 84.5872 -4.16749
4 19.2479 -0.2476 28 88.0536 -1.83794
5 79.9836 -7.4321 17 89.3845 -1.5063 4
6 28.6311 -4.5251 47 85.0681 3.33159
7 34.6967 9.7539 48 96.4139 5.92274
8 53.4223 11.3017 13 98.6141 15.6409
2
9 49.1751 -17.435 43 39.115 18.8855
10 5.94451 -0.055 39 50.6311 14.8514
11 21.8257 -19.586 20 37.1134 14.7981
12 59.3605 1.10952 7 34.6967 9.7539 0
13 98.6141 15.6409 40 33.5504 13.1167 0 2 4
14 14.8604 -19.133 44 26.6834 13.2908
15 77.7519 -2.1077 36 22.728 18.545
16 43.8493 -18.968 18 5.13455 18.5341
17 89.3845 -1.5063 50 11.3064 16.5967
18 5.13455 18.5341 35 20.251 10.4676
19 50.2782 -15.174 33 20.2735 2.28635
20 37.1134 14.7981 4 19.2479 -0.24755
21 93.508 -15.302 45 9.9891 -1.29036
22 24.9604 -4.8859 38 8.96065 -0.45173
23 73.1448 0.7255 10 5.94451 -0.05502
24 42.815 -1.9852 3 4.49978 0.15034
25 43.9434 -5.2972 41 0.79668 2.33819
26 70.9689 14.6501 14 14.8604 -19.1329
27 16.0294 -18.021 27 16.0294 -18.0212
28 88.0536 -1.8379 11 21.8257 -19.586
29 84.5872 -4.1675 22 24.9604 -4.88585
30 38.2282 -16.94 6 28.6311 -4.52506
31 34.5472 1.84729 31 34.5472 1.84729
32 73.3664 -5.4047 42 44.7579 8.83765
33 20.2735 2.28635 49 42.9349 5.95205
34 70.2444 -11.863 24 42.815 -1.98517
35 20.251 10.4676 25 43.9434 -5.29723
36 22.728 18.545 30 38.2282 -16.94
37 66.7736 15.1385 16 43.8493 -18.9685
38 8.96065 -0.4517 9 49.1751 -17.4346
39 50.6311 14.8514 19 50.2782 -15.1744
40 33.5504 13.1167 12 59.3605 1.10952
41 0.79668 2.33819 8 53.4223 11.3017
42 44.7579 8.83765 37 66.7736 15.1385
43 39.115 18.8855 26 70.9689 14.6501
44 26.6834 13.2908 46 66.4545 9.42281
45 9.9891 -1.2904 23 73.1448 0.7255
46 66.4545 9.42281 15 77.7519 -2.10771
47 85.0681 3.33159 32 73.3664 -5.4047
48 96.4139 5.92274 34 70.2444 -11.8633
49 42.9349 5.95205 5 79.9836 -7.43214
50 11.3064 16.5967 2 81.6019 -10.961
maximum number of paths tried at any
temperature = k1*ncity

maximum number of successful path changes


before continuing = k2*ncity

Number of complete path's to be calculated


and compared. For 50 cities program may
find a dozen of alternatives.

2 4 6 8 10 12

Anda mungkin juga menyukai