-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
57,564 additions
and
3 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import math | ||
|
||
outFilename = "./xqf131.wdat" | ||
outFile = open(outFilename, "w") | ||
|
||
filename = "./xqf131.tsp" | ||
edgeFile = open(filename) | ||
|
||
string = "" | ||
|
||
numPoints = 0 | ||
xVals = [] | ||
yVals = [] | ||
beganPoints = False | ||
|
||
# Read in file | ||
for line in edgeFile: | ||
if not beganPoints and line.startswith("DIMENSION"): | ||
words = line.split() | ||
numPoints = int(words[2]) | ||
print("there are " + str(numPoints) + "words") | ||
elif line.startswith("NODE_COORD_SECTION"): | ||
beganPoints = True | ||
elif beganPoints and not line.startswith("EOF"): | ||
words = line.split() | ||
# First number on line is the node number, | ||
# and frankly the nodes seem to be | ||
# 1-indexed so I don't care | ||
xVals.append(int(words[1])) | ||
yVals.append(int(words[2])) | ||
|
||
# Print order of graph | ||
outFile.write(str(numPoints) + "\n") | ||
|
||
# print weighted data | ||
for x1, y1, i in zip(xVals, yVals, range(0, numPoints)): | ||
for x2, y2, j in zip(xVals, yVals, range(0, numPoints)): | ||
distance = math.hypot(x2 - x1, y2 - y1) | ||
outFile.write(str(i) + " " + str(j) + " " + str(int(distance)) + "\n") | ||
|
||
#print footer | ||
outFile.write("-1 -1 -1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
NAME : xqf131 | ||
COMMENT : Bonn VLSI data set with 131 points | ||
COMMENT : Uni Bonn, Research Institute for Discrete Math | ||
COMMENT : Contributed by Andre Rohe | ||
TYPE : TSP | ||
DIMENSION : 131 | ||
EDGE_WEIGHT_TYPE : EUC_2D | ||
NODE_COORD_SECTION | ||
1 0 13 | ||
2 0 26 | ||
3 0 27 | ||
4 0 39 | ||
5 2 0 | ||
6 5 13 | ||
7 5 19 | ||
8 5 25 | ||
9 5 31 | ||
10 5 37 | ||
11 5 43 | ||
12 5 8 | ||
13 8 0 | ||
14 9 10 | ||
15 10 10 | ||
16 11 10 | ||
17 12 10 | ||
18 12 5 | ||
19 15 13 | ||
20 15 19 | ||
21 15 25 | ||
22 15 31 | ||
23 15 37 | ||
24 15 43 | ||
25 15 8 | ||
26 18 11 | ||
27 18 13 | ||
28 18 15 | ||
29 18 17 | ||
30 18 19 | ||
31 18 21 | ||
32 18 23 | ||
33 18 25 | ||
34 18 27 | ||
35 18 29 | ||
36 18 31 | ||
37 18 33 | ||
38 18 35 | ||
39 18 37 | ||
40 18 39 | ||
41 18 41 | ||
42 18 42 | ||
43 18 44 | ||
44 18 45 | ||
45 25 11 | ||
46 25 15 | ||
47 25 22 | ||
48 25 23 | ||
49 25 24 | ||
50 25 26 | ||
51 25 28 | ||
52 25 29 | ||
53 25 9 | ||
54 28 16 | ||
55 28 20 | ||
56 28 28 | ||
57 28 30 | ||
58 28 34 | ||
59 28 40 | ||
60 28 43 | ||
61 28 47 | ||
62 32 26 | ||
63 32 31 | ||
64 33 15 | ||
65 33 26 | ||
66 33 29 | ||
67 33 31 | ||
68 34 15 | ||
69 34 26 | ||
70 34 29 | ||
71 34 31 | ||
72 34 38 | ||
73 34 41 | ||
74 34 5 | ||
75 35 17 | ||
76 35 31 | ||
77 38 16 | ||
78 38 20 | ||
79 38 30 | ||
80 38 34 | ||
81 40 22 | ||
82 41 23 | ||
83 41 32 | ||
84 41 34 | ||
85 41 35 | ||
86 41 36 | ||
87 48 22 | ||
88 48 27 | ||
89 48 6 | ||
90 51 45 | ||
91 51 47 | ||
92 56 25 | ||
93 57 12 | ||
94 57 25 | ||
95 57 44 | ||
96 61 45 | ||
97 61 47 | ||
98 63 6 | ||
99 64 22 | ||
100 71 11 | ||
101 71 13 | ||
102 71 16 | ||
103 71 45 | ||
104 71 47 | ||
105 74 12 | ||
106 74 16 | ||
107 74 20 | ||
108 74 24 | ||
109 74 29 | ||
110 74 35 | ||
111 74 39 | ||
112 74 6 | ||
113 77 21 | ||
114 78 10 | ||
115 78 32 | ||
116 78 35 | ||
117 78 39 | ||
118 79 10 | ||
119 79 33 | ||
120 79 37 | ||
121 80 10 | ||
122 80 41 | ||
123 80 5 | ||
124 81 17 | ||
125 84 20 | ||
126 84 24 | ||
127 84 29 | ||
128 84 34 | ||
129 84 38 | ||
130 84 6 | ||
131 107 27 | ||
EOF |
Oops, something went wrong.