## Definition **Particle Swarm Optimization (PSO)** is a population-based metaheuristic inspired by the social behaviour of bird flocks and fish schools. Each "particle" represents a candidate solution; particles move through the search space influenced by their own best-known position and the swarm's collective best. Introduced by Kennedy & Eberhart (1995). ## The Algorithm ``` initialise N particles with random positions x_i and velocities v_i for each particle: pbest_i ← x_i (personal best) gbest ← argmin f(pbest_i) # global best while not done: for each particle i: update velocity: v_i ← w·v_i + c_1·r_1·(pbest_i - x_i) + c_2·r_2·(gbest - x_i) update position: x_i ← x_i + v_i if f(x_i) < f(pbest_i): pbest_i ← x_i if f(x_i) < f(gbest): gbest ← x_i return gbest ``` - $w$ — inertia weight. - $c_1$ — cognitive component (pull toward personal best). - $c_2$ — social component (pull toward swarm's best). - $r_1, r_2$ — random factors in $[0, 1]$. ## The Three Influences Each particle's motion at each step is: 1. **Inertia** — continue current trajectory. 2. **Cognition** — head toward your own best-known location. 3. **Social** — head toward the swarm's best-known location. The interplay of these creates a flocking-like dynamic that balances exploration and exploitation. ## Strengths - **Simple to implement** — few lines of code. - **Few hyperparameters** (3-4) vs GA (10+). - **Naturally parallel** — particles can be evaluated independently. - **Continuous optimisation friendly** — no need for special crossover operators. - **Often fast convergence** on smooth multimodal landscapes. ## Weaknesses - **Premature convergence** — swarm collapses to a local optimum; loses diversity. - **Limited theoretical analysis** — convergence guarantees are weaker than for SA. - **Beaten by CMA-ES** on most continuous benchmarks. - **Less effective on discrete / combinatorial problems** without special discretisation. ## Common Hyperparameter Settings - **Population size:** 20-50. - **$w$:** 0.5-0.9, often decreased over iterations (high early for exploration, low late for refinement). - **$c_1, c_2$:** both around 1.5-2.0; typical $c_1 + c_2 \approx 4$. ## Variants - **Constricted PSO.** Adds a constriction factor to ensure convergence. - **Discrete PSO.** Adaptations for combinatorial problems (binary, set-based). - **Multi-objective PSO.** Maintains a Pareto archive. - **Quantum PSO.** Particles distributed probabilistically. ## When to Use - **Continuous black-box optimisation** at moderate dimensions (10-100). - **Hyperparameter tuning** for ML models. - **Engineering design** problems with simulator-based evaluations. - **When simplicity matters.** For best continuous performance in 2026, CMA-ES is usually the better default. PSO's value is its simplicity and intuitive behaviour. ## Related - [[Genetic Algorithms]] - [[Simulated Annealing]] - [[Ant Colony Optimization]]