From 856ff4015eb070a548fa93224e352e4473de77f5 Mon Sep 17 00:00:00 2001 From: UmbertoJr Date: Thu, 31 Oct 2019 16:00:34 +0100 Subject: [PATCH] solver --- code/TSP_solver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/TSP_solver.py b/code/TSP_solver.py index 56a5cd3..e620df7 100644 --- a/code/TSP_solver.py +++ b/code/TSP_solver.py @@ -28,7 +28,8 @@ class Solver_TSP: def random_method(self, instance_): n = int(instance_.nPoints) - self.solution = np.random.choice(np.arange(n), size=n, replace=False) + solution = np.random.choice(np.arange(n), size=n, replace=False) + self.solution = np.concatenate([solution, [solution[0]]]) self.solved = True return self.solution