Particle swarm optimization

Also known as: PSO

On this page 7

Particle swarm optimization (PSO) is a population-based, derivative-free optimization method in which a swarm of candidate solutions, called particles, moves through the search space and adjusts each trajectory using the best position the particle has found and the best position found by its neighbors. Introduced by James Kennedy and Russell Eberhart in 1995, it belongs to the swarm intelligence branch of evolutionary computation.

Unlike a genetic algorithm, PSO uses no crossover, mutation or selection. Particles are never discarded or recombined; they persist and learn, which makes the method simple to implement, cheap per iteration and well suited to continuous problems where gradients are unavailable or unreliable.

How particles update velocity and position

Each particle stores a position vector, a velocity vector and its personal best position, often written pbest. At every iteration the velocity is recomputed from three terms and the position is moved by that velocity, after which the fitness function is evaluated again.

In the widely used inertia-weight form, the update is v = w·v + c1·r1·(pbest − x) + c2·r2·(gbest − x) followed by x = x + v, where r1 and r2 are uniform random numbers in [0, 1] drawn per dimension. The three terms below together produce the balance between exploration and exploitation.

ComponentFormula termRole in the search
Inertiaw·vKeeps momentum and supports exploration
Cognitive termc1·r1·(pbest − x)Pulls the particle toward its own best
Social termc2·r2·(gbest − x)Pulls the particle toward the group best
The three components of the velocity update

The search stops when an evaluation budget is exhausted, when the best fitness stops improving for a set number of iterations, or when a target value is reached. Because every particle can be evaluated independently, PSO is easy to parallelize across processors.

Key parameters and typical values

PSO has few parameters, but their values strongly affect convergence. A common default is the constriction-equivalent setting of w ≈ 0.729 and c1 = c2 ≈ 1.49, derived by Clerc and Kennedy to guarantee stable trajectories.

ParameterTypical rangeEffect of increasing it
Swarm size20 to 100 particlesBroader coverage, more evaluations
Inertia weight w0.4 to 0.9More exploration, slower convergence
Cognitive coefficient c11.0 to 2.0More independent particle behavior
Social coefficient c21.0 to 2.0Faster consensus, higher stagnation risk
Maximum velocity10 to 50 percent of rangeLarger steps, risk of overshooting
Main PSO parameters

Many implementations use a linearly decreasing inertia weight, for example from 0.9 to 0.4, so that the swarm explores widely at first and refines locally later. Velocity clamping prevents the swarm explosion that occurs when velocities grow without limit.

Neighborhood topologies and PSO variants

The topology defines which particles share information, and it controls how quickly good news spreads. In the global best (gbest) topology, every particle sees the best position of the whole swarm; in the local best (lbest) ring topology, each particle sees only a few neighbors, which slows convergence but reduces premature convergence.

VariantKey ideaBest suited to
Global best PSOAll particles follow one leaderSmooth, unimodal problems
Ring or von Neumann PSOInformation spreads slowlyMultimodal landscapes
Binary PSOVelocity sets bit-flip probabilityFeature selection, discrete choices
Fully informed PSOUses all neighbors, not only the bestRobust general search
Multi-objective PSOKeeps an archive of Pareto solutionsTrade-off optimization
Common topologies and variants

Standard reference versions such as SPSO 2011 fix topology, initialization and update rules so that results remain comparable between studies, which is important because small implementation details change performance.

PSO sits beside other population methods in evolutionary computation, and the choice among them depends on problem structure and evaluation cost. Its strengths are simplicity and fast early progress; its main weakness is a tendency to stagnate on rugged landscapes.

MethodSearch mechanismRelative strength
Particle swarm optimizationVelocity guided by personal and social bestsVery simple, quick initial progress
Genetic algorithmSelection, crossover and mutationNatural fit for discrete encodings
Differential evolutionVector differences between membersStrong on continuous benchmarks
CMA-ESAdapts a full covariance matrixExcellent on ill-conditioned problems
Ant colony optimizationPheromone trails on a graphCombinatorial routing problems
PSO compared with neighboring algorithms

Benchmark comparisons rarely produce a universal winner, a consequence of the no free lunch theorems for optimization. On smooth, low-dimensional problems PSO often matches its rivals with fewer tuning decisions, while on high-dimensional, ill-conditioned functions methods that learn variable correlations, such as CMA-ES, usually outperform it.

PSO is also frequently hybridized. A common pattern runs the swarm for global exploration and then hands the best particle to a local search method such as Nelder-Mead or a quasi-Newton routine, an approach close in spirit to a memetic algorithm.

Practical use, limitations and common mistakes

PSO is applied to hyperparameter tuning, antenna and controller design, power system dispatch, neural network training in small settings and feature selection through its binary variant. It is most useful when the objective is a black box and each evaluation is moderately expensive but not prohibitive.

Practitioners should be aware of several well-documented limitations. No convergence to a global optimum is guaranteed, and the canonical algorithm can converge to points that are not even local optima.

  • Premature convergence: gbest swarms collapse early; use lbest topologies or restarts.
  • Boundary handling ignored: particles leave the feasible region; clamp, reflect or penalize.
  • Scale mismatch: dimensions with different units distort steps; normalize variables first.
  • Too few runs: results depend on random seeds; report statistics over at least 20 to 30 runs.
  • Origin bias: some test functions have optima at zero; shift benchmarks to avoid misleading results.

Understanding it simply

Imagine a group of people searching a large field for the deepest spot. Each person remembers the lowest place they have found. Everyone also hears where the group’s best spot is. Each searcher walks toward a mix of both memories, with a little randomness.

Over time the group gathers around a very good spot. Nobody needs a map or a slope to follow. The shared memory guides the search. That is particle swarm optimization in a nutshell.

Applied in practice

An engineering team needs to tune the three gains of a PID controller for a motor drive. The plant model is a simulation that takes about two seconds per run, and its response has several local optima, so gradient methods are impractical. The team defines a fitness function that combines overshoot, settling time and steady-state error.

They run a ring-topology PSO with 30 particles, w = 0.729 and c1 = c2 = 1.49 for 100 iterations, which costs about 3,000 simulations or under two hours on one workstation. Repeated over 20 seeds, the best gains reduce settling time by roughly a third compared with the manually tuned baseline, and the spread of results confirms that the solution is stable rather than a lucky run.