pycma implements CMA-ES and related derivative-free optimizers for difficult continuous and mixed-integer problems. Install it from PyPI as the cma package.
Overview
pycma provides a Python realization of Covariance Matrix Adaptation Evolution Strategy (CMA-ES), a randomized derivative-free method aimed at non-convex, ill-conditioned, multimodal, and noisy objectives in continuous and mixed-integer search spaces.
The main entry points optimize black-box fitness functions with support for bound constraints, nonlinear constraints through dedicated handlers, noise treatment, and integer decision variables. An ask-and-tell interface, restarts, logging, and plotting utilities support experimentation and benchmarking.
Jupyter notebooks in the project demonstrate basic use, constraint handling, noise, and interactive optimization loops. API documentation and practical hints accompany releases on PyPI, with optional installation straight from the GitHub repository for development versions.
Recent releases add constraint support in ask-and-tell mode, mixed-integer variance handling, surrogate-assisted variants, parallel optimization hooks, and utilities for sharing logged run data.
Key features
- CMA-ES core algorithm
- Bounds and nonlinear constraints
- Mixed-integer variable support
- Noise handling options
- Ask-and-tell optimization interface
- Logging, plotting, and restarts
- Surrogate and parallel helpers
Use cases
- Tuning non-smooth numerical models
- Mixed-integer black-box optimization
- Benchmarking on synthetic fitness landscapes
- Constrained engineering design search
- Teaching evolution strategies in Python