MachineLearning/particle_swarm library
Particle Swarm Optimization (PSO) - generic
A compact, production-minded particle swarm optimizer that supports:
- generic particle position type represented as List
- velocity-based updates, inertia, cognitive and social coefficients
- per-particle best and global best tracking, seeded RNG
Contract:
- Input: initial swarm positions generator, fitness(List
- Output:
optimizereturnsbestPositionandbestFitness. - Errors: throws ArgumentError for invalid shapes. Particle Swarm Optimization (PSO) - generic over particle type T
A production-minded particle swarm optimizer that is generic over the
particle representation T. The implementation internally operates on
numeric vectors, but the API accepts any T provided the caller supplies
mapping functions between T and List<double>.
Features:
- generic particle type
TviatoVector/fromVectorconverters - inertia, cognitive and social coefficients with seeded RNG
- maintains per-particle best and global best
Contract:
- Input:
initParticles-> List - Output:
optimizereturns a map withbest(T) andbestFitness. - Errors: throws ArgumentError for invalid shapes.