Skip to content

Algorithms Overview

Useful Optimizer provides 54+ optimization algorithms organized into logical categories. Each algorithm is designed to solve numeric optimization problems with different characteristics.

Algorithm Categories

🦋 Swarm Intelligence (57+ algorithms)

Nature-inspired algorithms based on collective behavior of decentralized, self-organized systems.

AlgorithmInspirationBest For
Particle SwarmBird flockingGeneral-purpose, fast convergence
Ant ColonyAnt behaviorDiscrete/continuous optimization
Firefly AlgorithmFirefly flashingMulti-modal problems
Grey WolfWolf pack huntingExploration-exploitation balance
Whale OptimizationHumpback whalesLarge-scale problems
Cuckoo SearchCuckoo birdsGlobal optimization

🧬 Evolutionary (6 algorithms)

Algorithms inspired by biological evolution and natural selection.

AlgorithmKey FeatureBest For
Genetic AlgorithmCrossover, mutationDiscrete and continuous
Differential EvolutionVector differencesRobust global search
CMA-ESCovariance adaptationHigh-dimensional
Cultural AlgorithmBelief spaceKnowledge-based optimization

🧠 Gradient-Based (11 algorithms)

Optimizers using gradient information for smooth landscapes.

AlgorithmKey FeatureBest For
SGD MomentumMomentum termSimple problems
AdamAdaptive momentsDeep learning
AdamWWeight decayRegularized optimization
RMSpropRMS scalingNon-stationary

🎯 Classical (9 algorithms)

Traditional mathematical optimization methods.

AlgorithmTypeBest For
BFGSQuasi-NewtonSmooth functions
Nelder-MeadDirect searchDerivative-free
Simulated AnnealingProbabilisticGlobal optimization
Hill ClimbingLocal searchUnimodal problems

🔬 Metaheuristic (12 algorithms)

High-level problem-independent algorithmic frameworks.

AlgorithmInspirationBest For
Harmony SearchMusic improvisationDiscrete/continuous
Cross EntropyInformation theoryRare event simulation
Sine CosineMathematical functionsMulti-modal

Choosing an Algorithm

By Problem Type

Problem TypeRecommended Algorithms
Smooth, unimodalBFGS, L-BFGS, Conjugate Gradient
Multi-modalPSO, DE, CMA-ES, Firefly
High-dimensionalCMA-ES, DE, Grey Wolf
Noisy objectivePSO, DE, SA
ConstrainedAugmented Lagrangian, SLP
Black-boxNelder-Mead, PSO, DE

By Computational Budget

BudgetRecommended Algorithms
Very limitedNelder-Mead, Hill Climbing
MediumPSO, DE, Grey Wolf
LargeCMA-ES, multi-start BFGS

Common Interface

All algorithms share the same interface:

python
from opt.swarm_intelligence import ParticleSwarm

optimizer = ParticleSwarm(
    func=objective_function,    # Callable[[np.ndarray], float]
    lower_bound=-10.0,          # Lower bound of search space
    upper_bound=10.0,           # Upper bound of search space
    dim=10,                     # Number of dimensions
    max_iter=100                # Maximum iterations
)

best_solution, best_fitness = optimizer.search()

Performance Comparison

See the Benchmarks section for detailed performance comparisons on standard test functions.

Released under the MIT License.