lab6
This commit is contained in:
@@ -14,7 +14,7 @@ cities = list(cities)
|
||||
config = ACOConfig(
|
||||
cities=cities,
|
||||
n_ants=50,
|
||||
n_iterations=400,
|
||||
n_iterations=50,
|
||||
alpha=1.2,
|
||||
beta=5.0,
|
||||
rho=0.5,
|
||||
@@ -29,7 +29,9 @@ print(f"Лучший тур: {result.best_tour}")
|
||||
results_dir = os.path.join(os.path.dirname(__file__), "report", "img")
|
||||
os.makedirs(results_dir, exist_ok=True)
|
||||
|
||||
plot_tour(config.cities, result.best_tour, os.path.join(results_dir, "aco_best_tour.png"))
|
||||
plot_tour(
|
||||
config.cities, result.best_tour, os.path.join(results_dir, "aco_best_tour.png")
|
||||
)
|
||||
plot_history(result.history, os.path.join(results_dir, "aco_history.png"))
|
||||
|
||||
with open(os.path.join(results_dir, "aco_best_tour.txt"), "w", encoding="utf-8") as f:
|
||||
|
||||
Reference in New Issue
Block a user