Skip to content

useful-optimizerOptimization Algorithms Library

120+ optimization algorithms for numeric problems

Quick Example

python
from opt.swarm_intelligence import ParticleSwarm
from opt.benchmark.functions import shifted_ackley

# Create optimizer
optimizer = ParticleSwarm(
    func=shifted_ackley,
    lower_bound=-12.768,
    upper_bound=12.768,
    dim=2,
    max_iter=100
)

# Run optimization
best_solution, best_fitness = optimizer.search()
print(f"Best fitness: {best_fitness:.6f}")

Algorithm Categories

🦋 Swarm Intelligence

Particle Swarm, Ant Colony, Firefly, Bat, Grey Wolf, Whale Optimization, and 50+ more nature-inspired algorithms.

🧬 Evolutionary

Genetic Algorithm, Differential Evolution, CMA-ES, Cultural Algorithm, and Imperialist Competitive Algorithm.

🧠 Gradient-Based

SGD, Adam, AdamW, RMSprop, Adagrad, Adadelta, AMSGrad, and Nesterov Accelerated Gradient.

🎯 Classical

BFGS, L-BFGS, Nelder-Mead, Powell, Simulated Annealing, Hill Climbing, and Trust Region methods.

Installation

bash
pip install git+https://github.com/Anselmoo/useful-optimizer
bash
uv add git+https://github.com/Anselmoo/useful-optimizer

Released under the MIT License.