ubuntu
commited on
Commit
•
8b9edb9
1
Parent(s):
4b100ed
Initial Commit
Browse files- app.py +147 -0
- example/a280.tsp +287 -0
- example/att48.tsp +55 -0
- example/berlin52.tsp +60 -0
- example/ch130.tsp +137 -0
- example/ch150.tsp +157 -0
- media/tsp_default.png +0 -0
- media/tsp_problem.png +0 -0
- media/tsp_solution.png +0 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import time
|
2 |
+
import shutil
|
3 |
+
import gradio as gr
|
4 |
+
from data4co import TSPConcordeSolver, draw_tsp_problem, draw_tsp_solution
|
5 |
+
|
6 |
+
|
7 |
+
TSP_DEFAULT_PATH = "media/tsp_default.png"
|
8 |
+
TSP_PROBLEM_PATH = "media/tsp_problem.png"
|
9 |
+
TSP_SOLUTION_PATH = "media/tsp_solution.png"
|
10 |
+
|
11 |
+
|
12 |
+
def _handle_tsp_solve(
|
13 |
+
file_path: str,
|
14 |
+
norm: str,
|
15 |
+
):
|
16 |
+
# Check file upload status
|
17 |
+
if file_path is None:
|
18 |
+
raise gr.Error("Please upload a '.tsp' file!")
|
19 |
+
if norm == '':
|
20 |
+
norm = "EUC_2D"
|
21 |
+
if norm != "EUC_2D" and norm != "GEO":
|
22 |
+
raise gr.Error("Invaild edge_weight_type! Only support 'GEO' and 'EUC_2D'.")
|
23 |
+
|
24 |
+
# Begin solve and record the solving time
|
25 |
+
start_time = time.time()
|
26 |
+
solver = TSPConcordeSolver(scale=1)
|
27 |
+
solver.from_tsp(file_path, norm=norm)
|
28 |
+
solver.solve()
|
29 |
+
tours = solver.tours
|
30 |
+
points = solver.points
|
31 |
+
solved_time = time.time() - start_time
|
32 |
+
|
33 |
+
# Draw pictures
|
34 |
+
draw_tsp_problem(
|
35 |
+
save_path=TSP_PROBLEM_PATH,
|
36 |
+
points=points,
|
37 |
+
)
|
38 |
+
draw_tsp_solution(
|
39 |
+
save_path=TSP_SOLUTION_PATH,
|
40 |
+
points=points,
|
41 |
+
tours=tours
|
42 |
+
)
|
43 |
+
|
44 |
+
# Message
|
45 |
+
message = "Successfully solve the TSP problem, using time ({:.3f}s).".format(solved_time)
|
46 |
+
|
47 |
+
return message, TSP_PROBLEM_PATH, TSP_SOLUTION_PATH
|
48 |
+
|
49 |
+
|
50 |
+
def handle_tsp_solve(
|
51 |
+
file_path: str,
|
52 |
+
norm: str,
|
53 |
+
):
|
54 |
+
try:
|
55 |
+
message = _handle_tsp_solve(file_path, norm)
|
56 |
+
return message
|
57 |
+
except Exception as e:
|
58 |
+
message = str(e)
|
59 |
+
return message, TSP_PROBLEM_PATH, TSP_SOLUTION_PATH
|
60 |
+
|
61 |
+
|
62 |
+
def handle_tsp_clear():
|
63 |
+
# Replace the original image with the default image
|
64 |
+
shutil.copy(
|
65 |
+
src=TSP_DEFAULT_PATH,
|
66 |
+
dst=TSP_PROBLEM_PATH
|
67 |
+
)
|
68 |
+
shutil.copy(
|
69 |
+
src=TSP_DEFAULT_PATH,
|
70 |
+
dst=TSP_SOLUTION_PATH
|
71 |
+
)
|
72 |
+
message = "successfully clear the files!"
|
73 |
+
return message, TSP_PROBLEM_PATH, TSP_SOLUTION_PATH
|
74 |
+
|
75 |
+
|
76 |
+
with gr.Blocks() as tsp_page:
|
77 |
+
|
78 |
+
gr.Markdown(
|
79 |
+
'''
|
80 |
+
This space displays the solution to the TSP problem.
|
81 |
+
## How to use this Space?
|
82 |
+
- Upload a '.tsp' file from tsplib .
|
83 |
+
- The images of the TSP problem and solution will be shown after you click the solve button.
|
84 |
+
- Click the 'clear' button to clear all the files.
|
85 |
+
## Examples
|
86 |
+
- You can get the test examples from our [TSP Dataset Repo.](https://huggingface.co/datasets/SJTU-TES/TSP)
|
87 |
+
'''
|
88 |
+
)
|
89 |
+
|
90 |
+
with gr.Row(variant="panel"):
|
91 |
+
with gr.Column(scale=7):
|
92 |
+
with gr.Row():
|
93 |
+
tsp_file = gr.File(
|
94 |
+
file_types=[".tsp"],
|
95 |
+
scale=3
|
96 |
+
)
|
97 |
+
info = gr.Textbox(
|
98 |
+
value="",
|
99 |
+
label="Log",
|
100 |
+
scale=4,
|
101 |
+
)
|
102 |
+
norm = gr.Textbox(
|
103 |
+
label="Please input the edge_weight_type of the TSP file",
|
104 |
+
)
|
105 |
+
with gr.Column(scale=4):
|
106 |
+
tsp_problem_img = gr.Image(
|
107 |
+
value=TSP_PROBLEM_PATH,
|
108 |
+
type="filepath",
|
109 |
+
label="TSP Problem",
|
110 |
+
)
|
111 |
+
with gr.Column(scale=4):
|
112 |
+
tsp_solution_img = gr.Image(
|
113 |
+
value=TSP_SOLUTION_PATH,
|
114 |
+
type="filepath",
|
115 |
+
label="TSP Solution",
|
116 |
+
)
|
117 |
+
with gr.Row():
|
118 |
+
with gr.Column(scale=1, min_width=100):
|
119 |
+
solve_button = gr.Button(
|
120 |
+
value="Solve",
|
121 |
+
variant="primary",
|
122 |
+
scale=1
|
123 |
+
)
|
124 |
+
with gr.Column(scale=1, min_width=100):
|
125 |
+
clear_button = gr.Button(
|
126 |
+
"Clear",
|
127 |
+
variant="secondary",
|
128 |
+
scale=1
|
129 |
+
)
|
130 |
+
with gr.Column(scale=8):
|
131 |
+
pass
|
132 |
+
|
133 |
+
solve_button.click(
|
134 |
+
handle_tsp_solve,
|
135 |
+
[tsp_file, norm],
|
136 |
+
outputs=[info, tsp_problem_img, tsp_solution_img]
|
137 |
+
)
|
138 |
+
|
139 |
+
clear_button.click(
|
140 |
+
handle_tsp_clear,
|
141 |
+
inputs=None,
|
142 |
+
outputs=[info, tsp_problem_img, tsp_solution_img]
|
143 |
+
)
|
144 |
+
|
145 |
+
|
146 |
+
if __name__ == "__main__":
|
147 |
+
tsp_page.launch(debug = True)
|
example/a280.tsp
ADDED
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
NAME : a280
|
2 |
+
COMMENT : drilling problem (Ludwig)
|
3 |
+
TYPE : TSP
|
4 |
+
DIMENSION: 280
|
5 |
+
EDGE_WEIGHT_TYPE : EUC_2D
|
6 |
+
NODE_COORD_SECTION
|
7 |
+
1 288 149
|
8 |
+
2 288 129
|
9 |
+
3 270 133
|
10 |
+
4 256 141
|
11 |
+
5 256 157
|
12 |
+
6 246 157
|
13 |
+
7 236 169
|
14 |
+
8 228 169
|
15 |
+
9 228 161
|
16 |
+
10 220 169
|
17 |
+
11 212 169
|
18 |
+
12 204 169
|
19 |
+
13 196 169
|
20 |
+
14 188 169
|
21 |
+
15 196 161
|
22 |
+
16 188 145
|
23 |
+
17 172 145
|
24 |
+
18 164 145
|
25 |
+
19 156 145
|
26 |
+
20 148 145
|
27 |
+
21 140 145
|
28 |
+
22 148 169
|
29 |
+
23 164 169
|
30 |
+
24 172 169
|
31 |
+
25 156 169
|
32 |
+
26 140 169
|
33 |
+
27 132 169
|
34 |
+
28 124 169
|
35 |
+
29 116 161
|
36 |
+
30 104 153
|
37 |
+
31 104 161
|
38 |
+
32 104 169
|
39 |
+
33 90 165
|
40 |
+
34 80 157
|
41 |
+
35 64 157
|
42 |
+
36 64 165
|
43 |
+
37 56 169
|
44 |
+
38 56 161
|
45 |
+
39 56 153
|
46 |
+
40 56 145
|
47 |
+
41 56 137
|
48 |
+
42 56 129
|
49 |
+
43 56 121
|
50 |
+
44 40 121
|
51 |
+
45 40 129
|
52 |
+
46 40 137
|
53 |
+
47 40 145
|
54 |
+
48 40 153
|
55 |
+
49 40 161
|
56 |
+
50 40 169
|
57 |
+
51 32 169
|
58 |
+
52 32 161
|
59 |
+
53 32 153
|
60 |
+
54 32 145
|
61 |
+
55 32 137
|
62 |
+
56 32 129
|
63 |
+
57 32 121
|
64 |
+
58 32 113
|
65 |
+
59 40 113
|
66 |
+
60 56 113
|
67 |
+
61 56 105
|
68 |
+
62 48 99
|
69 |
+
63 40 99
|
70 |
+
64 32 97
|
71 |
+
65 32 89
|
72 |
+
66 24 89
|
73 |
+
67 16 97
|
74 |
+
68 16 109
|
75 |
+
69 8 109
|
76 |
+
70 8 97
|
77 |
+
71 8 89
|
78 |
+
72 8 81
|
79 |
+
73 8 73
|
80 |
+
74 8 65
|
81 |
+
75 8 57
|
82 |
+
76 16 57
|
83 |
+
77 8 49
|
84 |
+
78 8 41
|
85 |
+
79 24 45
|
86 |
+
80 32 41
|
87 |
+
81 32 49
|
88 |
+
82 32 57
|
89 |
+
83 32 65
|
90 |
+
84 32 73
|
91 |
+
85 32 81
|
92 |
+
86 40 83
|
93 |
+
87 40 73
|
94 |
+
88 40 63
|
95 |
+
89 40 51
|
96 |
+
90 44 43
|
97 |
+
91 44 35
|
98 |
+
92 44 27
|
99 |
+
93 32 25
|
100 |
+
94 24 25
|
101 |
+
95 16 25
|
102 |
+
96 16 17
|
103 |
+
97 24 17
|
104 |
+
98 32 17
|
105 |
+
99 44 11
|
106 |
+
100 56 9
|
107 |
+
101 56 17
|
108 |
+
102 56 25
|
109 |
+
103 56 33
|
110 |
+
104 56 41
|
111 |
+
105 64 41
|
112 |
+
106 72 41
|
113 |
+
107 72 49
|
114 |
+
108 56 49
|
115 |
+
109 48 51
|
116 |
+
110 56 57
|
117 |
+
111 56 65
|
118 |
+
112 48 63
|
119 |
+
113 48 73
|
120 |
+
114 56 73
|
121 |
+
115 56 81
|
122 |
+
116 48 83
|
123 |
+
117 56 89
|
124 |
+
118 56 97
|
125 |
+
119 104 97
|
126 |
+
120 104 105
|
127 |
+
121 104 113
|
128 |
+
122 104 121
|
129 |
+
123 104 129
|
130 |
+
124 104 137
|
131 |
+
125 104 145
|
132 |
+
126 116 145
|
133 |
+
127 124 145
|
134 |
+
128 132 145
|
135 |
+
129 132 137
|
136 |
+
130 140 137
|
137 |
+
131 148 137
|
138 |
+
132 156 137
|
139 |
+
133 164 137
|
140 |
+
134 172 125
|
141 |
+
135 172 117
|
142 |
+
136 172 109
|
143 |
+
137 172 101
|
144 |
+
138 172 93
|
145 |
+
139 172 85
|
146 |
+
140 180 85
|
147 |
+
141 180 77
|
148 |
+
142 180 69
|
149 |
+
143 180 61
|
150 |
+
144 180 53
|
151 |
+
145 172 53
|
152 |
+
146 172 61
|
153 |
+
147 172 69
|
154 |
+
148 172 77
|
155 |
+
149 164 81
|
156 |
+
150 148 85
|
157 |
+
151 124 85
|
158 |
+
152 124 93
|
159 |
+
153 124 109
|
160 |
+
154 124 125
|
161 |
+
155 124 117
|
162 |
+
156 124 101
|
163 |
+
157 104 89
|
164 |
+
158 104 81
|
165 |
+
159 104 73
|
166 |
+
160 104 65
|
167 |
+
161 104 49
|
168 |
+
162 104 41
|
169 |
+
163 104 33
|
170 |
+
164 104 25
|
171 |
+
165 104 17
|
172 |
+
166 92 9
|
173 |
+
167 80 9
|
174 |
+
168 72 9
|
175 |
+
169 64 21
|
176 |
+
170 72 25
|
177 |
+
171 80 25
|
178 |
+
172 80 25
|
179 |
+
173 80 41
|
180 |
+
174 88 49
|
181 |
+
175 104 57
|
182 |
+
176 124 69
|
183 |
+
177 124 77
|
184 |
+
178 132 81
|
185 |
+
179 140 65
|
186 |
+
180 132 61
|
187 |
+
181 124 61
|
188 |
+
182 124 53
|
189 |
+
183 124 45
|
190 |
+
184 124 37
|
191 |
+
185 124 29
|
192 |
+
186 132 21
|
193 |
+
187 124 21
|
194 |
+
188 120 9
|
195 |
+
189 128 9
|
196 |
+
190 136 9
|
197 |
+
191 148 9
|
198 |
+
192 162 9
|
199 |
+
193 156 25
|
200 |
+
194 172 21
|
201 |
+
195 180 21
|
202 |
+
196 180 29
|
203 |
+
197 172 29
|
204 |
+
198 172 37
|
205 |
+
199 172 45
|
206 |
+
200 180 45
|
207 |
+
201 180 37
|
208 |
+
202 188 41
|
209 |
+
203 196 49
|
210 |
+
204 204 57
|
211 |
+
205 212 65
|
212 |
+
206 220 73
|
213 |
+
207 228 69
|
214 |
+
208 228 77
|
215 |
+
209 236 77
|
216 |
+
210 236 69
|
217 |
+
211 236 61
|
218 |
+
212 228 61
|
219 |
+
213 228 53
|
220 |
+
214 236 53
|
221 |
+
215 236 45
|
222 |
+
216 228 45
|
223 |
+
217 228 37
|
224 |
+
218 236 37
|
225 |
+
219 236 29
|
226 |
+
220 228 29
|
227 |
+
221 228 21
|
228 |
+
222 236 21
|
229 |
+
223 252 21
|
230 |
+
224 260 29
|
231 |
+
225 260 37
|
232 |
+
226 260 45
|
233 |
+
227 260 53
|
234 |
+
228 260 61
|
235 |
+
229 260 69
|
236 |
+
230 260 77
|
237 |
+
231 276 77
|
238 |
+
232 276 69
|
239 |
+
233 276 61
|
240 |
+
234 276 53
|
241 |
+
235 284 53
|
242 |
+
236 284 61
|
243 |
+
237 284 69
|
244 |
+
238 284 77
|
245 |
+
239 284 85
|
246 |
+
240 284 93
|
247 |
+
241 284 101
|
248 |
+
242 288 109
|
249 |
+
243 280 109
|
250 |
+
244 276 101
|
251 |
+
245 276 93
|
252 |
+
246 276 85
|
253 |
+
247 268 97
|
254 |
+
248 260 109
|
255 |
+
249 252 101
|
256 |
+
250 260 93
|
257 |
+
251 260 85
|
258 |
+
252 236 85
|
259 |
+
253 228 85
|
260 |
+
254 228 93
|
261 |
+
255 236 93
|
262 |
+
256 236 101
|
263 |
+
257 228 101
|
264 |
+
258 228 109
|
265 |
+
259 228 117
|
266 |
+
260 228 125
|
267 |
+
261 220 125
|
268 |
+
262 212 117
|
269 |
+
263 204 109
|
270 |
+
264 196 101
|
271 |
+
265 188 93
|
272 |
+
266 180 93
|
273 |
+
267 180 101
|
274 |
+
268 180 109
|
275 |
+
269 180 117
|
276 |
+
270 180 125
|
277 |
+
271 196 145
|
278 |
+
272 204 145
|
279 |
+
273 212 145
|
280 |
+
274 220 145
|
281 |
+
275 228 145
|
282 |
+
276 236 145
|
283 |
+
277 246 141
|
284 |
+
278 252 125
|
285 |
+
279 260 129
|
286 |
+
280 280 133
|
287 |
+
EOF
|
example/att48.tsp
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
NAME : att48
|
2 |
+
COMMENT : 48 capitals of the US (Padberg/Rinaldi)
|
3 |
+
TYPE : TSP
|
4 |
+
DIMENSION : 48
|
5 |
+
EDGE_WEIGHT_TYPE : ATT
|
6 |
+
NODE_COORD_SECTION
|
7 |
+
1 6734 1453
|
8 |
+
2 2233 10
|
9 |
+
3 5530 1424
|
10 |
+
4 401 841
|
11 |
+
5 3082 1644
|
12 |
+
6 7608 4458
|
13 |
+
7 7573 3716
|
14 |
+
8 7265 1268
|
15 |
+
9 6898 1885
|
16 |
+
10 1112 2049
|
17 |
+
11 5468 2606
|
18 |
+
12 5989 2873
|
19 |
+
13 4706 2674
|
20 |
+
14 4612 2035
|
21 |
+
15 6347 2683
|
22 |
+
16 6107 669
|
23 |
+
17 7611 5184
|
24 |
+
18 7462 3590
|
25 |
+
19 7732 4723
|
26 |
+
20 5900 3561
|
27 |
+
21 4483 3369
|
28 |
+
22 6101 1110
|
29 |
+
23 5199 2182
|
30 |
+
24 1633 2809
|
31 |
+
25 4307 2322
|
32 |
+
26 675 1006
|
33 |
+
27 7555 4819
|
34 |
+
28 7541 3981
|
35 |
+
29 3177 756
|
36 |
+
30 7352 4506
|
37 |
+
31 7545 2801
|
38 |
+
32 3245 3305
|
39 |
+
33 6426 3173
|
40 |
+
34 4608 1198
|
41 |
+
35 23 2216
|
42 |
+
36 7248 3779
|
43 |
+
37 7762 4595
|
44 |
+
38 7392 2244
|
45 |
+
39 3484 2829
|
46 |
+
40 6271 2135
|
47 |
+
41 4985 140
|
48 |
+
42 1916 1569
|
49 |
+
43 7280 4899
|
50 |
+
44 7509 3239
|
51 |
+
45 10 2676
|
52 |
+
46 6807 2993
|
53 |
+
47 5185 3258
|
54 |
+
48 3023 1942
|
55 |
+
EOF
|
example/berlin52.tsp
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
NAME: berlin52
|
2 |
+
TYPE: TSP
|
3 |
+
COMMENT: 52 locations in Berlin (Groetschel)
|
4 |
+
DIMENSION: 52
|
5 |
+
EDGE_WEIGHT_TYPE: EUC_2D
|
6 |
+
NODE_COORD_SECTION
|
7 |
+
1 565.0 575.0
|
8 |
+
2 25.0 185.0
|
9 |
+
3 345.0 750.0
|
10 |
+
4 945.0 685.0
|
11 |
+
5 845.0 655.0
|
12 |
+
6 880.0 660.0
|
13 |
+
7 25.0 230.0
|
14 |
+
8 525.0 1000.0
|
15 |
+
9 580.0 1175.0
|
16 |
+
10 650.0 1130.0
|
17 |
+
11 1605.0 620.0
|
18 |
+
12 1220.0 580.0
|
19 |
+
13 1465.0 200.0
|
20 |
+
14 1530.0 5.0
|
21 |
+
15 845.0 680.0
|
22 |
+
16 725.0 370.0
|
23 |
+
17 145.0 665.0
|
24 |
+
18 415.0 635.0
|
25 |
+
19 510.0 875.0
|
26 |
+
20 560.0 365.0
|
27 |
+
21 300.0 465.0
|
28 |
+
22 520.0 585.0
|
29 |
+
23 480.0 415.0
|
30 |
+
24 835.0 625.0
|
31 |
+
25 975.0 580.0
|
32 |
+
26 1215.0 245.0
|
33 |
+
27 1320.0 315.0
|
34 |
+
28 1250.0 400.0
|
35 |
+
29 660.0 180.0
|
36 |
+
30 410.0 250.0
|
37 |
+
31 420.0 555.0
|
38 |
+
32 575.0 665.0
|
39 |
+
33 1150.0 1160.0
|
40 |
+
34 700.0 580.0
|
41 |
+
35 685.0 595.0
|
42 |
+
36 685.0 610.0
|
43 |
+
37 770.0 610.0
|
44 |
+
38 795.0 645.0
|
45 |
+
39 720.0 635.0
|
46 |
+
40 760.0 650.0
|
47 |
+
41 475.0 960.0
|
48 |
+
42 95.0 260.0
|
49 |
+
43 875.0 920.0
|
50 |
+
44 700.0 500.0
|
51 |
+
45 555.0 815.0
|
52 |
+
46 830.0 485.0
|
53 |
+
47 1170.0 65.0
|
54 |
+
48 830.0 610.0
|
55 |
+
49 605.0 625.0
|
56 |
+
50 595.0 360.0
|
57 |
+
51 1340.0 725.0
|
58 |
+
52 1740.0 245.0
|
59 |
+
EOF
|
60 |
+
|
example/ch130.tsp
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
NAME: ch130
|
2 |
+
TYPE: TSP
|
3 |
+
COMMENT: 130 city problem (Churritz)
|
4 |
+
DIMENSION: 130
|
5 |
+
EDGE_WEIGHT_TYPE: EUC_2D
|
6 |
+
NODE_COORD_SECTION
|
7 |
+
1 334.5909245845 161.7809319139
|
8 |
+
2 397.6446634067 262.8165330708
|
9 |
+
3 503.8741827107 172.8741151168
|
10 |
+
4 444.0479403502 384.6491809647
|
11 |
+
5 311.6137146746 2.0091699828
|
12 |
+
6 662.8551011379 549.2301263653
|
13 |
+
7 40.0979030612 187.2375430791
|
14 |
+
8 526.8941409181 215.7079092185
|
15 |
+
9 209.1887938487 691.0262291948
|
16 |
+
10 683.2674131973 414.2096286906
|
17 |
+
11 280.7494438748 5.9206392047
|
18 |
+
12 252.7493090080 535.7430385019
|
19 |
+
13 698.7850451923 348.4413729766
|
20 |
+
14 678.7574678104 410.7256424438
|
21 |
+
15 220.0041131179 409.1225812873
|
22 |
+
16 355.1528556851 76.3912076444
|
23 |
+
17 296.9724227786 313.1312792361
|
24 |
+
18 504.5154071733 240.8866564499
|
25 |
+
19 224.1079496785 358.4872228907
|
26 |
+
20 470.6801296968 309.6259188406
|
27 |
+
21 554.2530513223 279.4242466521
|
28 |
+
22 567.6332684419 352.7162027273
|
29 |
+
23 599.0532671093 361.0948690386
|
30 |
+
24 240.5232959211 430.6036007844
|
31 |
+
25 32.0825972787 345.8551009775
|
32 |
+
26 91.0538736891 148.7213270256
|
33 |
+
27 248.2179894723 343.9528017384
|
34 |
+
28 488.8909044347 3.6122311393
|
35 |
+
29 206.0467939820 437.7639406167
|
36 |
+
30 575.8409415632 141.9670960195
|
37 |
+
31 282.6089948164 329.4183805862
|
38 |
+
32 27.6581484868 424.7684581747
|
39 |
+
33 568.5737309870 287.0975660546
|
40 |
+
34 269.4638933331 295.9464636385
|
41 |
+
35 417.8004856811 341.2596589955
|
42 |
+
36 32.1680938737 448.8998721172
|
43 |
+
37 561.4775136009 357.3543930067
|
44 |
+
38 342.9482167470 492.3321423839
|
45 |
+
39 399.6752075383 156.8435035519
|
46 |
+
40 571.7371050025 375.7575350833
|
47 |
+
41 370.7559842751 151.9060751898
|
48 |
+
42 509.7093253204 435.7975189314
|
49 |
+
43 177.0206999750 295.6044772584
|
50 |
+
44 526.1674198605 409.4859418161
|
51 |
+
45 316.5725171854 65.6400108214
|
52 |
+
46 469.2908100279 281.9891445025
|
53 |
+
47 572.7630641427 373.3208821255
|
54 |
+
48 29.5176994283 330.0382309000
|
55 |
+
49 454.0082936692 537.2178547659
|
56 |
+
50 416.1546762271 227.6133100741
|
57 |
+
51 535.2514330806 471.0648643744
|
58 |
+
52 265.4455533675 684.9987192464
|
59 |
+
53 478.0542110167 509.6452028741
|
60 |
+
54 370.4781203413 332.5390063041
|
61 |
+
55 598.3479202004 446.8693279856
|
62 |
+
56 201.1521139175 649.0260268945
|
63 |
+
57 193.6925360026 680.2322840744
|
64 |
+
58 448.5792598859 532.7934059740
|
65 |
+
59 603.2853485624 134.4006473609
|
66 |
+
60 543.0102490781 481.5168231148
|
67 |
+
61 214.5750793346 43.6460117543
|
68 |
+
62 426.3501451825 61.7285415996
|
69 |
+
63 89.0447037063 277.1158385868
|
70 |
+
64 84.4920100219 31.8474816424
|
71 |
+
65 220.0468614154 623.0778103080
|
72 |
+
66 688.4613313444 0.4702312726
|
73 |
+
67 687.2857531630 373.5346236130
|
74 |
+
68 75.4934933967 312.9175377486
|
75 |
+
69 63.4170993511 23.7039309674
|
76 |
+
70 97.9363495877 211.0910930878
|
77 |
+
71 399.5255884970 170.8221968365
|
78 |
+
72 456.3167017346 597.1937161677
|
79 |
+
73 319.8855102422 626.8396604886
|
80 |
+
74 295.9250894897 664.6291554845
|
81 |
+
75 288.4868857235 667.7284070537
|
82 |
+
76 268.3951858954 52.9010181645
|
83 |
+
77 140.4709056068 513.5566720960
|
84 |
+
78 689.8079027159 167.5947003748
|
85 |
+
79 280.5784506848 458.7533546925
|
86 |
+
80 453.3884433554 282.9082328989
|
87 |
+
81 213.5704943432 525.8681817779
|
88 |
+
82 133.6953004520 677.1757808026
|
89 |
+
83 521.1658690522 132.8617086506
|
90 |
+
84 30.2657946347 450.0754502986
|
91 |
+
85 657.0199585283 39.7772908299
|
92 |
+
86 6.9252241961 23.8749241575
|
93 |
+
87 252.4286967767 535.1659364856
|
94 |
+
88 42.8551682504 63.8232081774
|
95 |
+
89 145.8999393902 399.5255884970
|
96 |
+
90 638.4885715591 62.6262558472
|
97 |
+
91 489.2756391122 665.3131282446
|
98 |
+
92 361.2231139311 564.2347787901
|
99 |
+
93 519.9475425732 347.9711417040
|
100 |
+
94 129.3349741063 435.6692740389
|
101 |
+
95 259.7172815016 454.6495181318
|
102 |
+
96 676.3421890013 371.0979706551
|
103 |
+
97 84.5133841706 183.3260738572
|
104 |
+
98 77.7164048671 354.3833863300
|
105 |
+
99 335.9802442534 660.6321896676
|
106 |
+
100 264.3554717810 377.5743377274
|
107 |
+
101 51.6826916855 676.0429509187
|
108 |
+
102 692.1376849300 543.8010925819
|
109 |
+
103 169.2191356800 547.8194325476
|
110 |
+
104 194.0131482339 263.4791316822
|
111 |
+
105 415.1928395332 78.9133571973
|
112 |
+
106 415.0432204919 479.0801701569
|
113 |
+
107 169.8389859939 245.6103433244
|
114 |
+
108 525.0987124228 213.5063718969
|
115 |
+
109 238.6851191283 33.4932910965
|
116 |
+
110 116.2112467718 363.5742702940
|
117 |
+
111 16.9283258126 656.5711014044
|
118 |
+
112 434.3440768162 92.6996831431
|
119 |
+
113 40.5253860363 424.6829615797
|
120 |
+
114 530.4849979086 183.8390534273
|
121 |
+
115 484.3595848990 49.2460387276
|
122 |
+
116 263.6501248722 426.5852608187
|
123 |
+
117 450.2891917862 126.3853415784
|
124 |
+
118 441.7822805823 299.7724362653
|
125 |
+
119 24.2169105375 500.3474481664
|
126 |
+
120 503.7886861157 514.6895019799
|
127 |
+
121 635.5389390312 200.9811207275
|
128 |
+
122 614.5922732529 418.8691931188
|
129 |
+
123 21.7161351334 660.9741760476
|
130 |
+
124 143.8266469611 92.6996831431
|
131 |
+
125 637.7191022040 54.2048412384
|
132 |
+
126 566.5645610042 199.9551615873
|
133 |
+
127 196.6849168280 221.8209157619
|
134 |
+
128 384.9270448985 87.4630166986
|
135 |
+
129 178.1107815614 104.6905805938
|
136 |
+
130 403.2874386776 205.8971749407
|
137 |
+
EOF
|
example/ch150.tsp
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
NAME: ch150
|
2 |
+
TYPE: TSP
|
3 |
+
COMMENT: 150 city Problem (churritz)
|
4 |
+
DIMENSION: 150
|
5 |
+
EDGE_WEIGHT_TYPE: EUC_2D
|
6 |
+
NODE_COORD_SECTION
|
7 |
+
1 37.4393516691 541.2090699418
|
8 |
+
2 612.1759508571 494.3166877396
|
9 |
+
3 38.1312338227 353.1484581781
|
10 |
+
4 53.4418081065 131.4849013650
|
11 |
+
5 143.0606355347 631.7200953923
|
12 |
+
6 689.9451267256 468.5354998742
|
13 |
+
7 112.7478815786 529.4177578260
|
14 |
+
8 141.4875865042 504.8184855710
|
15 |
+
9 661.0513901702 445.9375182115
|
16 |
+
10 98.7899036592 384.5926031158
|
17 |
+
11 697.3881696597 180.3962284275
|
18 |
+
12 536.4894189738 287.2279085051
|
19 |
+
13 192.4067320507 20.4394059310
|
20 |
+
14 282.7865258765 229.8001556189
|
21 |
+
15 240.8251726391 281.5141437200
|
22 |
+
16 246.9281323057 322.4613321160
|
23 |
+
17 649.7313216456 62.3331575282
|
24 |
+
18 352.9658562600 666.7873101942
|
25 |
+
19 633.3923676580 534.9398453712
|
26 |
+
20 488.3117994040 437.4869439948
|
27 |
+
21 141.4039286509 228.4325551488
|
28 |
+
22 17.3632612602 240.2407068508
|
29 |
+
23 397.5586451389 231.3591208928
|
30 |
+
24 565.7853781464 282.3858748974
|
31 |
+
25 475.8975387047 468.5392706317
|
32 |
+
26 322.4224566559 550.3165478233
|
33 |
+
27 397.5586634023 74.7588387765
|
34 |
+
28 672.8618339396 432.8826409630
|
35 |
+
29 571.2189680147 530.2616991530
|
36 |
+
30 104.6531165914 482.8224768783
|
37 |
+
31 356.7098388794 67.6477131712
|
38 |
+
32 400.4070255527 253.6794479997
|
39 |
+
33 282.3036243109 426.8380500923
|
40 |
+
34 58.7766988363 507.1712386832
|
41 |
+
35 189.7506224400 460.3815233617
|
42 |
+
36 659.9124120147 226.6284156239
|
43 |
+
37 639.0307636033 467.2302300719
|
44 |
+
38 415.0258357432 233.3045376118
|
45 |
+
39 547.2662016307 161.6589278401
|
46 |
+
40 616.6547902644 339.3409309407
|
47 |
+
41 494.8592427417 148.1217856389
|
48 |
+
42 629.9980812186 433.4548164038
|
49 |
+
43 471.1014312410 314.2219307579
|
50 |
+
44 138.2440514421 137.1679919735
|
51 |
+
45 91.5847556724 110.0203007516
|
52 |
+
46 390.6972811808 423.9774318385
|
53 |
+
47 565.1617825137 429.1598152874
|
54 |
+
48 54.5248980387 438.5515408431
|
55 |
+
49 334.3508329710 153.7969238040
|
56 |
+
50 531.0291024509 612.3874827889
|
57 |
+
51 475.7345905802 385.7844618897
|
58 |
+
52 228.8325218994 410.4461939615
|
59 |
+
53 578.3805347586 321.3303494537
|
60 |
+
54 358.9170574485 404.4670352898
|
61 |
+
55 486.4648554867 593.0429937016
|
62 |
+
56 343.1693707670 509.3123571315
|
63 |
+
57 530.3626972076 137.6881275684
|
64 |
+
58 498.8065475299 576.2102674608
|
65 |
+
59 224.3182715500 312.4677490415
|
66 |
+
60 595.8360732590 81.8130051356
|
67 |
+
61 661.5588724308 217.0456944477
|
68 |
+
62 43.6892045516 305.4722789165
|
69 |
+
63 79.4653452530 445.9641737689
|
70 |
+
64 210.4163247004 130.7151137038
|
71 |
+
65 432.2642292251 629.4092661116
|
72 |
+
66 623.2487161301 69.1892850840
|
73 |
+
67 436.5194739944 282.9356456070
|
74 |
+
68 59.4163265482 40.1280234442
|
75 |
+
69 630.9230074073 230.3429888130
|
76 |
+
70 579.3265539688 601.0359410602
|
77 |
+
71 117.8624507480 112.9796833705
|
78 |
+
72 297.7912565664 166.3131886803
|
79 |
+
73 22.7642703744 455.5340094037
|
80 |
+
74 259.7095810385 10.6199925885
|
81 |
+
75 342.3579873647 599.3880182608
|
82 |
+
76 10.0260950143 488.9310558282
|
83 |
+
77 315.2926064118 273.2275475579
|
84 |
+
78 220.7044919297 270.0819745721
|
85 |
+
79 192.1186059948 314.1839922798
|
86 |
+
80 271.5042718992 225.2921989972
|
87 |
+
81 530.7320005441 504.0670155337
|
88 |
+
82 42.5331441666 656.3645162886
|
89 |
+
83 396.1274792588 539.4648066027
|
90 |
+
84 118.6631474021 508.7129103929
|
91 |
+
85 395.6913876595 699.5376048429
|
92 |
+
86 559.0157105844 560.8866941411
|
93 |
+
87 22.6471035906 526.2470392816
|
94 |
+
88 135.6377085256 325.8409901555
|
95 |
+
89 141.4507014379 485.2477927763
|
96 |
+
90 396.7741299332 460.7557115283
|
97 |
+
91 87.7494562765 19.6170129082
|
98 |
+
92 350.4245639661 420.6531186835
|
99 |
+
93 216.7010817133 466.4816410995
|
100 |
+
94 130.9237737024 351.1491733079
|
101 |
+
95 72.6329856671 645.7852219213
|
102 |
+
96 144.6002949996 457.4224283926
|
103 |
+
97 212.3725077442 594.9216893413
|
104 |
+
98 49.9186786455 541.4350825349
|
105 |
+
99 656.6943525585 558.1109593509
|
106 |
+
100 176.5941623792 648.5239953299
|
107 |
+
101 500.3825200226 198.7428378322
|
108 |
+
102 634.3178678420 612.8291643194
|
109 |
+
103 59.7537372726 551.6321886765
|
110 |
+
104 15.2145765106 143.0441928532
|
111 |
+
105 283.0054378872 376.4439530184
|
112 |
+
106 146.5389000907 39.4231794338
|
113 |
+
107 101.8685605377 635.0986850180
|
114 |
+
108 588.1968537448 580.5946976921
|
115 |
+
109 457.2628632528 350.0164047376
|
116 |
+
110 537.4663680494 472.5842276692
|
117 |
+
111 269.3669098585 367.4763636538
|
118 |
+
112 239.9045383695 102.6297653390
|
119 |
+
113 88.4677500396 384.0507209275
|
120 |
+
114 658.9133693395 583.9575181023
|
121 |
+
115 97.7359146347 157.4558657632
|
122 |
+
116 506.6191384007 233.0022156094
|
123 |
+
117 500.2566898239 64.9136393489
|
124 |
+
118 594.4048565021 275.8741868990
|
125 |
+
119 66.2308146610 24.1317387604
|
126 |
+
120 598.4162993909 414.5557574275
|
127 |
+
121 172.3088330830 344.3963466366
|
128 |
+
122 299.4812851800 251.8295121320
|
129 |
+
123 303.8379894831 21.0526063790
|
130 |
+
124 197.8969269840 512.3888960980
|
131 |
+
125 56.0199567669 243.0663818382
|
132 |
+
126 255.5566183121 448.8651882442
|
133 |
+
127 608.4256112402 222.5421309272
|
134 |
+
128 70.2722703273 77.9227026433
|
135 |
+
129 398.2298999899 119.5576573860
|
136 |
+
130 635.4970237093 133.3225902609
|
137 |
+
131 378.3484559418 272.2907677147
|
138 |
+
132 484.8029663388 677.0730379436
|
139 |
+
133 278.8710882619 299.9308770828
|
140 |
+
134 381.6537300653 360.3337602785
|
141 |
+
135 557.6070707573 595.3185092281
|
142 |
+
136 249.0589749342 76.6595112599
|
143 |
+
137 562.9048787838 670.0382113114
|
144 |
+
138 398.5504365580 392.6493259144
|
145 |
+
139 590.8939720560 370.7414913742
|
146 |
+
140 558.2008003726 0.4198814512
|
147 |
+
141 461.4114714423 530.5254969413
|
148 |
+
142 354.7242881504 685.4045361900
|
149 |
+
143 193.6611295657 669.7432521028
|
150 |
+
144 352.3140807211 140.3273323662
|
151 |
+
145 308.4345709740 115.2054269847
|
152 |
+
146 299.5881370080 530.5889619020
|
153 |
+
147 334.2748764383 152.1494569394
|
154 |
+
148 690.9658585947 134.5793307203
|
155 |
+
149 48.0798124069 270.9680673720
|
156 |
+
150 91.6467647724 166.3541158474
|
157 |
+
EOF
|
media/tsp_default.png
ADDED
media/tsp_problem.png
ADDED
media/tsp_solution.png
ADDED
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
data4co
|
3 |
+
matplotlib
|