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.
37 lines
757 B
Rust
37 lines
757 B
Rust
//! Built-in reference optimizers.
|
|
|
|
pub mod ant_colony_tsp;
|
|
pub mod cma_es;
|
|
pub mod differential_evolution;
|
|
pub mod genetic_algorithm;
|
|
pub mod hill_climber;
|
|
pub mod ibea;
|
|
pub mod moead;
|
|
pub mod mopso;
|
|
pub mod nsga2;
|
|
pub mod nsga3;
|
|
pub mod paes;
|
|
pub(crate) mod parallel_eval;
|
|
pub mod particle_swarm;
|
|
pub mod random_search;
|
|
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::*;
|
|
pub use hill_climber::*;
|
|
pub use ibea::*;
|
|
pub use moead::*;
|
|
pub use mopso::*;
|
|
pub use nsga2::*;
|
|
pub use nsga3::*;
|
|
pub use paes::*;
|
|
pub use particle_swarm::*;
|
|
pub use random_search::*;
|
|
pub use simulated_annealing::*;
|
|
pub use spea2::*;
|
|
pub use tabu_search::*;
|