Skip to content

Introduction

Useful Optimizer is a comprehensive Python library containing 54+ optimization algorithms for solving numeric problems. The library is designed to be easy to use while providing research-grade performance and flexibility.

Why Useful Optimizer?

  • Comprehensive Coverage: From swarm intelligence to gradient-based methods, covering all major optimization paradigms
  • Consistent API: All optimizers follow the same interface for easy experimentation
  • Well Documented: Every algorithm includes docstrings following Google style conventions
  • Research Ready: Includes benchmark functions and visualization tools for academic use
  • Pure Python: Easy to understand, modify, and extend

Algorithm Categories

CategoryCountDescription
Swarm Intelligence57+Nature-inspired population-based algorithms
Evolutionary6Evolution-based optimization methods
Gradient-Based11Gradient descent variants and adaptive methods
Classical9Traditional mathematical optimization
Metaheuristic12Problem-independent optimization frameworks
Constrained2Methods for constrained optimization
Probabilistic2Probability-based optimization

Key Features

Unified Interface

All optimizers implement the AbstractOptimizer base class with a consistent search() method:

python
from opt.swarm_intelligence import ParticleSwarm

optimizer = ParticleSwarm(
    func=objective_function,
    lower_bound=-10.0,
    upper_bound=10.0,
    dim=10,
    max_iter=100
)

best_solution, best_fitness = optimizer.search()

Multiple Import Styles

python
# Categorical imports (recommended)
from opt.swarm_intelligence import ParticleSwarm
from opt.gradient_based import AdamW

# Direct imports (backward compatible)
from opt import ParticleSwarm, AdamW

Built-in Benchmark Functions

python
from opt.benchmark.functions import (
    sphere,
    rosenbrock,
    rastrigin,
    ackley,
    shifted_ackley,
    griewank
)

Getting Started

  1. Installation - Set up the library
  2. Quick Start - Run your first optimization
  3. Advanced Usage - Customize and extend

Community

Released under the MIT License.