This commit is contained in:
UmbertoJr 2019-11-04 06:44:32 +01:00
parent de3e3f0793
commit 904ce65413
2 changed files with 2 additions and 1 deletions

1
run.py
View File

@ -34,6 +34,7 @@ def run(show_plots=False):
if instance.optimal_tour:
solver.solution = np.concatenate([instance.optimal_tour, [instance.optimal_tour[0]]])
solver.method = "optimal"
solver.plot_solution()
index = pd.MultiIndex.from_tuples(index, names=['problem', 'method'])

View File

@ -69,7 +69,7 @@ class Solver_TSP:
assert self.solved, "You can't plot the solution, you need to solve it first!"
plt.figure(figsize=(8, 8))
self._gap()
plt.title(f"{self.instance.name} solved with {self.method}, gap {self.gap}")
plt.title(f"{self.instance.name} solved with {self.method} solver, gap {self.gap}")
ordered_points = self.instance.points[self.solution]
plt.plot(ordered_points[:, 1], ordered_points[:, 2], 'b-')
plt.show()