Skip to content
CoreSource checked

Particle Swarm Optimization

Searches for good solutions by moving particles according to personal and group best positions.

Quick Facts

Compact metadata for implementation and discovery.

Category
Optimization
Difficulty
Intermediate
Family
Population-Based Optimization
Tier
Core
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
5
Code example
Ready
Visualization
Ready

Overview

Particle Swarm Optimization maintains candidate particles whose velocities are pulled toward each particle's best-known position and the swarm's best-known position.

Core Concepts

swarm populationvelocity updatepersonal bestglobal best

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(p)

Average

O(iterations * p * cost)

Worst

O(iterations * p * cost)

Space

O(p)

When to Use

  • Use when tuning model parameters needs swarm population.
  • Use when the input matches the assumptions behind population-Based Optimization.

When Not to Use

  • Avoid when the objective is cheap and convex enough for a simpler exact solver.
  • Avoid when a simpler algorithm gives the required result with less setup.

What It Does

  • Searches for good solutions by moving particles according to personal and group best positions
  • Uses swarm population and velocity update to guide the work.
  • Produces best candidate.

Use Cases

  • Tuning model parameters
  • Searching design spaces
  • Fitting models to noisy data

Inputs

  • Objective function
  • Initial candidate or population
  • Stopping rule

Outputs

  • Best candidate
  • Objective value
  • Search history

Key Formulas (1)

Velocity update

v = w·v + c1·r1·(pbest − x) + c2·r2·(gbest − x)
v = w*v + c1*r1*(pbest - x) + c2*r2*(gbest - x)

Moves a particle using inertia, personal memory, and swarm memory.

Pseudocode

  1. 1.Prepare the inputs and state needed for Particle Swarm Optimization.
  2. 2.Apply the swarm population step while the stopping condition has not been met.
  3. 3.Update intermediate state and discard invalid candidates.
  4. 4.Return best candidate.

Canonical Example

Input
Particle Swarm Optimization input with a small representative case
Output
Best candidate
Explanation
Particle Swarm Optimization applies swarm population to produce best candidate.

Implementation Notes

  • Track both best-so-far and current candidate state.
  • Keep the swarm population step separate enough to test independently.

Common Pitfalls

  • Stopping too early can make a poor local result look like convergence.
  • Forgetting to check edge cases can make Particle Swarm Optimization look correct on only ideal inputs.

Interactive Mechanism Walkthrough

Iterative Convergence & State Trajectory

Plot candidate points, objective values, and improvement steps across iterations.

Particle Swarm Optimization mechanism walkthrough step 1 of 4x₀x₁x₂x*
Step 1 of 4: Prepare the inputs and state needed for Particle Swarm Optimization.
optimization-mechanism

Notes

Particle Swarm Optimization should be used with the assumptions and tradeoffs of population-Based Optimization in mind.

Sources (1)

What each reference supports for this entry.

Kennedy and Eberhart 1995

Paper

Original particle swarm optimization reference.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Conceptual neighborDifferential Evolution

Both evolve a population of candidate solutions in continuous spaces.

Alternative toGenetic Algorithm

Both are population-based optimization methods.

Tags

OptimizationPopulation BasedMetaheuristicStochastic