feat(algorithms): add ParticleSwarm (canonical PSO) for Vec<f64>
Eberhart & Kennedy 1995 PSO with the standard inertia-weight update: v[i,t+1] = w·v[i,t] + c1·r1·(pbest[i] - x[i,t]) + c2·r2·(gbest - x[i,t]) x[i,t+1] = clamp(x[i,t] + v[i,t+1], bounds) Single-objective only, `Vec<f64>` decisions only (PSO's velocity vector needs a Euclidean structure that doesn't generalize cleanly to bool/perm). Velocities are clamped to ±(hi - lo) per dim to keep particles from exploding off into space. Config exposes the four standard knobs — swarm size, generations, inertia w, cognitive c1, social c2 — plus a seed. Tests cover convergence on Sphere1D, deterministic reruns, and panic on multi-objective.
This commit is contained in:
+3
-2
@@ -24,6 +24,7 @@ pub use crate::operators::{
|
||||
pub use crate::algorithms::{
|
||||
DifferentialEvolution, DifferentialEvolutionConfig, GeneticAlgorithm,
|
||||
GeneticAlgorithmConfig, HillClimber, HillClimberConfig, Moead, MoeadConfig, Nsga2,
|
||||
Nsga2Config, Nsga3, Nsga3Config, Paes, PaesConfig, RandomSearch, RandomSearchConfig,
|
||||
SimulatedAnnealing, SimulatedAnnealingConfig, Spea2, Spea2Config,
|
||||
Nsga2Config, Nsga3, Nsga3Config, Paes, PaesConfig, ParticleSwarm, ParticleSwarmConfig,
|
||||
RandomSearch, RandomSearchConfig, SimulatedAnnealing, SimulatedAnnealingConfig, Spea2,
|
||||
Spea2Config,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user