-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.pi
More file actions
59 lines (54 loc) · 2.51 KB
/
data.pi
File metadata and controls
59 lines (54 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
51
52
53
54
55
56
57
58
59
module data.
% Small instance (6 cities): symmetric, non-negative, zeros on diagonal
% Used by tsp_1.txt and tsp_2.txt via M = data1().
data1() =
[
[0, 10, 15, 20, 10, 12],
[10, 0, 35, 25, 17, 28],
[15, 35, 0, 30, 28, 40],
[20, 25, 30, 0, 22, 16],
[10, 17, 28, 22, 0, 18],
[12, 28, 40, 16, 18, 0]
].
% Medium instance (10 cities): symmetric, non-negative, zeros on diagonal
% For Phase 4, temporarily change M = data1() to M = data10() in tsp_1/tsp_2 to use this matrix.
data10() =
[
[0, 12, 18, 30, 26, 17, 22, 35, 28, 14],
[12, 0, 16, 24, 19, 21, 27, 33, 26, 18],
[18, 16, 0, 20, 23, 29, 25, 31, 22, 27],
[30, 24, 20, 0, 14, 15, 19, 28, 24, 26],
[26, 19, 23, 14, 0, 13, 18, 27, 21, 24],
[17, 21, 29, 15, 13, 0, 16, 22, 20, 23],
[22, 27, 25, 19, 18, 16, 0, 24, 17, 21],
[35, 33, 31, 28, 27, 22, 24, 0, 14, 19],
[28, 26, 22, 24, 21, 20, 17, 14, 0, 16],
[14, 18, 27, 26, 24, 23, 21, 19, 16, 0]
].
end_module.
% 21-city TSP (distance matrix taken from tsptw problem2), no time windows here
data21() =
[
%1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
[ 0,19,17,34, 7,20,10,17,28,15,23,29,23,29,21,20, 9,16,21,13,12], % 1
[19, 0,10,41,26, 3,27,25,15,17,17,14,18,48,17, 6,21,14,17,13,31], % 2
[17,10, 0,47,23,13,26,15,25,22,26,24,27,44, 7, 5,23,21,25,18,29], % 3
[34,41,47, 0,36,39,25,51,36,24,27,38,25,44,54,45,25,28,26,28,27], % 4
[ 7,26,23,36, 0,27,11,17,35,22,30,36,30,22,25,26,14,23,28,20,10], % 5
[20, 3,13,39,27, 0,26,27,12,15,14,11,15,49,20, 9,20,11,14,11,30], % 6
[10,27,26,25,11,26, 0,26,31,14,23,32,22,25,31,28, 6,17,21,15, 4], % 7
[17,25,15,51,17,27,26, 0,39,31,38,38,38,34,13,20,26,31,36,28,27], % 8
[28,15,25,36,35,12,31,39, 0,17, 9, 2,11,56,32,21,24,13,11,15,35], % 9
[15,17,22,24,22,15,14,31,17, 0, 9,18, 8,39,29,21, 8, 4, 7, 4,18], % 10
[23,17,26,27,30,14,23,38, 9, 9, 0,11, 2,48,33,23,17, 7, 2,10,27], % 11
[29,14,24,38,36,11,32,38, 2,18,11, 0,13,57,31,20,25,14,13,17,36], % 12
[23,18,27,25,30,15,22,38,11, 8, 2,13, 0,47,34,24,16, 7, 2,10,26], % 13
[29,48,44,44,22,49,25,34,56,39,48,57,47, 0,46,48,31,42,46,40,21], % 14
[21,17, 7,54,25,20,31,13,32,29,33,31,34,46, 0,11,29,28,32,25,33], % 15
[20, 6, 5,45,26, 9,28,20,21,21,23,20,24,48,11, 0,23,19,22,17,32], % 16
[ 9,21,23,25,14,20, 6,26,24, 8,17,25,16,31,29,23, 0,11,15, 9,10], % 17
[16,14,21,28,23,11,17,31,13, 4, 7,14, 7,42,28,19,11, 0, 5, 3,21], % 18
[21,17,25,26,28,14,21,36,11, 7, 2,13, 2,46,32,22,15, 5, 0, 8,25], % 19
[13,13,18,28,20,11,15,28,15, 4,10,17,10,40,25,17, 9, 3, 8, 0,19], % 20
[12,31,29,27,10,30, 4,27,35,18,27,36,26,21,33,32,10,21,25,19, 0] % 21
].