diff --git a/tests/04_cluster_ant_colony_no_animation.py b/tests/04_cluster_ant_colony_no_animation.py index 5281194..f75a771 100644 --- a/tests/04_cluster_ant_colony_no_animation.py +++ b/tests/04_cluster_ant_colony_no_animation.py @@ -59,10 +59,11 @@ class AntColony: self.pheromones = [[(1 - self.evaporation) * p for p in row] for row in self.pheromones] return [self.cities[i] for i in best_ant] -nb_ville = 200 -max_coords = 1000 -nb_truck = 4 -max_time = 5 +nb_ville = 50 +max_coords = 10 +nb_truck = 1 +max_time = 1 +nb_ants = 10 max_time_per_cluster = max_time / nb_truck @@ -116,12 +117,11 @@ for i, cluster_indices in enumerate(clusters.values()): cluster_cities = [cities[index] for index in cluster_indices] # Appel de la fonction AntColony.run - ant_colony = AntColony(cluster_cities, n_ants=10, max_time=max_time_per_cluster) + ant_colony = AntColony(cluster_cities, n_ants=nb_ants, max_time=max_time_per_cluster) best_route = ant_colony.run() best_routes.append((best_route, color)) - print("Final solution for cluster ", i, ":", best_route) - print("Total distance: ", total_distance(best_route)) + print("Total distance for cluster", i, ": ", total_distance(best_route)) for i, (route, color) in enumerate(best_routes): x = [city[0] for city in route]