Installation
Requirements
- Python: 3.10 - 3.12
- Dependencies: numpy, scipy, scikit-learn
Quick Install
bash
pip install git+https://github.com/Anselmoo/useful-optimizerbash
uv add git+https://github.com/Anselmoo/useful-optimizerbash
poetry add git+https://github.com/Anselmoo/useful-optimizerDevelopment Installation
For contributing or local development:
bash
# Clone the repository
git clone https://github.com/Anselmoo/useful-optimizer.git
cd useful-optimizer
# Install with uv (recommended)
uv sync
# Or with pip
pip install -e ".[dev]"Optional Dependencies
Visualization Support
For benchmark visualization capabilities:
bash
# With pip
pip install git+https://github.com/Anselmoo/useful-optimizer[visualization]
# With uv
uv add git+https://github.com/Anselmoo/useful-optimizer --extra visualizationBenchmark Support
For running benchmark suites with advanced plotting:
bash
# With pip
pip install git+https://github.com/Anselmoo/useful-optimizer[benchmark]
# With uv
uv add git+https://github.com/Anselmoo/useful-optimizer --extra benchmarkVerifying Installation
After installation, verify everything works:
python
# Basic import test
from opt import ParticleSwarm
from opt.benchmark.functions import shifted_ackley
# Quick optimization test
optimizer = ParticleSwarm(
func=shifted_ackley,
lower_bound=-2.768,
upper_bound=2.768,
dim=2,
max_iter=50
)
best_solution, best_fitness = optimizer.search()
print(f"Installation verified! Best fitness: {best_fitness:.6f}")Troubleshooting
ImportError: No module named 'opt'
Ensure the package is installed in your active Python environment:
bash
pip list | grep useful-optimizerNumPy Version Conflicts
If you encounter NumPy compatibility issues:
bash
pip install numpy>=1.26.4SciPy Missing
Some classical optimizers require SciPy:
bash
pip install scipy>=1.12.0