feat(algorithms): add AntColonyTsp ant colony optimization for TSP-style permutations

Dorigo-style Ant System for permutation problems on a complete graph:
each generation, every ant constructs a tour by probabilistically
picking the next node from those it has not yet visited, weighted by
`τ_ij^α · η_ij^β` where τ is the pheromone level on edge (i, j) and
η is the heuristic desirability (1 / distance, here). After all ants
finish, pheromone evaporates by a factor `(1 - ρ)` and is reinforced
on each ant's tour proportional to that tour's quality.

Decision type is `Vec<usize>` (a permutation of 0..n_cities). The user
supplies a distance matrix and the n_cities is inferred. Single-objective
only (the cost is total tour length, which the Problem evaluates).

Tests build a 5-city ring and verify ACO finds a near-optimal tour,
plus deterministic reruns and panic on multi-objective.
This commit is contained in:
2026-05-05 09:51:11 -06:00
parent 7213bdd148
commit 974011796e
3 changed files with 389 additions and 1 deletions
+2
View File
@@ -1,5 +1,6 @@
//! Built-in reference optimizers.
pub mod ant_colony_tsp;
pub mod cma_es;
pub mod differential_evolution;
pub mod genetic_algorithm;
@@ -17,6 +18,7 @@ pub mod simulated_annealing;
pub mod spea2;
pub mod tabu_search;
pub use ant_colony_tsp::*;
pub use cma_es::*;
pub use differential_evolution::*;
pub use genetic_algorithm::*;