From 1821f31f29be0a43825cd95fc67c458d4aec7baa Mon Sep 17 00:00:00 2001 From: UmbertoJr Date: Mon, 4 Nov 2019 06:53:26 +0100 Subject: [PATCH] io --- run.py | 2 +- src/io_tsp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 50e9784..d09753e 100644 --- a/run.py +++ b/run.py @@ -32,7 +32,7 @@ def run(show_plots=False): if show_plots: solver.plot_solution() - if instance.optimal_tour: + if instance.exist_opt: solver.solution = np.concatenate([instance.optimal_tour, [instance.optimal_tour[0]]]) solver.method = "optimal" solver.plot_solution() diff --git a/src/io_tsp.py b/src/io_tsp.py index 00534b7..6ab9477 100644 --- a/src/io_tsp.py +++ b/src/io_tsp.py @@ -48,7 +48,7 @@ class Instance: self.optimal_tour = np.zeros(self.nPoints) for i in range(self.nPoints): line_i = lines[5 + i].split(' ') - self.optimal_tour[0] = int(line_i[0]) + self.optimal_tour[0] = int(line_i[0]) - 1 def print_info(self): print('name: ' + self.name)