Swarm Intelligence Algorithms
Nature-inspired optimization algorithms based on collective behavior of decentralized, self-organized systems.
Overview
Swarm intelligence algorithms mimic the collective behavior observed in nature, such as bird flocking, fish schooling, ant colonies, and bee swarms. These algorithms use multiple agents (particles, individuals) that interact locally with each other and their environment.
Characteristics
- Decentralized: No central control mechanism
- Self-organized: Global behavior emerges from local interactions
- Population-based: Multiple agents work together
- Stochastic: Random components help explore solution space
Available Algorithms
Classic Swarm Algorithms
- Particle Swarm Optimization (PSO) - Inspired by bird flocking behavior
- Ant Colony Optimization (ACO) - Based on ant foraging behavior
- Artificial Bee Colony (ABC) - Mimics honey bee foraging
- Firefly Algorithm - Based on firefly flashing patterns
- Bat Algorithm - Inspired by bat echolocation
Predator-Prey Algorithms
- Grey Wolf Optimizer - Simulates grey wolf hunting strategy
- Whale Optimization - Based on whale bubble-net feeding
- Harris Hawks - Cooperative hunting behavior
- Marine Predators - Ocean predator hunting strategies
And 47+ more algorithms!
See the sidebar for the complete list of available swarm intelligence algorithms.
Usage Example
python
from opt.swarm_intelligence import ParticleSwarm, AntColony, GreyWolf
from opt.benchmark.functions import shifted_ackley
# Particle Swarm Optimization
pso = ParticleSwarm(
func=shifted_ackley,
lower_bound=-32.768,
upper_bound=32.768,
dim=10,
max_iter=100,
population_size=30
)
best_solution, best_fitness = pso.search()
# Ant Colony Optimization
aco = AntColony(
func=shifted_ackley,
lower_bound=-32.768,
upper_bound=32.768,
dim=10,
max_iter=100
)
best_solution, best_fitness = aco.search()Common Parameters
Most swarm intelligence algorithms share these common parameters:
func: Objective function to minimizelower_bound: Lower bounds for variablesupper_bound: Upper bounds for variablesdim: Problem dimensionmax_iter: Maximum number of iterationspopulation_size: Number of agents/particles (algorithm-specific default)
Performance Characteristics
Swarm intelligence algorithms generally:
- Work well for multi-modal problems
- Are robust to noise
- Can escape local optima
- Scale reasonably with problem dimension
- Are simple to implement and understand
See Also
- API Reference - Complete API documentation
- Benchmark Results - Algorithm performance comparisons