constructive

This commit is contained in:
UmbertoJr 2019-11-18 08:26:35 +01:00
parent 77ebc9016c
commit 0f3a13736b

View file

@ -31,10 +31,10 @@ class nearest_neighbor:
return np.array(tour) return np.array(tour)
@staticmethod @staticmethod
def best_nn(self, instance_): def best_nn(instance_):
solutions, lens = [], [] solutions, lens = [], []
for start in range(instance_.nPoints): for start in range(instance_.nPoints):
new_solution = self.nn(instance_, starting_node=start) new_solution = nearest_neighbor.nn(instance_, starting_node=start)
solutions.append(new_solution) solutions.append(new_solution)
lens.append(compute_lenght(new_solution, instance_.dist_matrix)) lens.append(compute_lenght(new_solution, instance_.dist_matrix))