cmaes
Lightweight Covariance Matrix Adaptation Evolution Strategy (CMA-ES) implementation for Python 3.
What it is and what it does
cmaes is a Python implementation of the Covariance Matrix Adaptation Evolution Strategy, a derivative-free optimization algorithm designed to minimize or maximize black-box objective functions. It uses an ask-and-tell interface where you request candidate solutions from the optimizer, evaluate them with your objective function, and report results back—making it suitable for expensive or noisy function evaluations where gradients are unavailable or unreliable.
The library supports multiple problem types: standard continuous optimization via the CMA class, mixed continuous-integer-categorical optimization via CatCMAwM, and multi-objective mixed-variable problems via COMOCatCMAwM. It depends only on numpy and integrates with Optuna for hyperparameter tuning workflows. The implementation is actively maintained and supports Python 3.9 through 3.14.
Use it for:
- Hyperparameter tuning for machine learning models when gradient-based methods are impractical or unavailable.
- Optimizing expensive simulations or physical experiments where function evaluations are costly and noisy.
- Mixed-variable optimization combining continuous parameters, discrete choices, and categorical selections in a single problem.
- Multi-objective optimization balancing competing objectives in mixed-variable spaces.
- Black-box function optimization where the objective function is a complex pipeline or external tool.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides CMA-ES (Covariance Matrix Adaptation Evolution Strategy) optimization in an ask-and-tell interface, supporting continuous, integer, and categorical variable optimization with variants for mixed-variable and multi-objective problems.
Yes. Low install friction (numpy only), active maintenance, MIT license, no known vulnerabilities, and a focused implementation of a well-established algorithm make it a solid choice for derivative-free optimization. Install if you need CMA-ES specifically; if you're unsure whether CMA-ES is the right algorithm for your problem, verify that first.
Install
cmaes on PyPI
pip
pip install cmaesuv
uv add cmaespoetry
poetry add cmaesInstalling cmaes
Before you install
Low friction: pure Python wheel with only numpy as a runtime dependency. Active maintenance with recent releases; last commit 2026-08-07 and 515 repository stars indicate ongoing development.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it suitable for most projects without legal friction.
Quickstart
pip install cmaes
import numpy as np
from cmaes import CMA
optimizer = CMA(mean=np.zeros(2), sigma=1.3)
for generation in range(50):
solutions = []
for _ in range(optimizer.population_size):
x = optimizer.ask()
value = objective(x) # your function
solutions.append((x, value))
optimizer.tell(solutions)
Requires Python 3.9 or later.
Verify before relying
- Performance characteristics and convergence speed compared to other CMA-ES implementations or optimization libraries.
- Whether the library is suitable for high-dimensional problems (scalability limits not documented in excerpt).
- Integration requirements and compatibility with Optuna beyond the basic sampler example shown.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 139 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,335,688/month — #4,034 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cmaes-0.13.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
cmaCMA-ES is a derivative-free numerical…
permissive · top 5,000 on PyPI
pyswarmsPySwarms implements particle swarm optimization…
permissive · top 15,000 on PyPI
deapDEAP is an evolutionary computation framework…
copyleft · top 15,000 on PyPI
optunaOptuna is a hyperparameter optimization…
permissive · top 5,000 on PyPI
nevergradNevergrad is a gradient-free optimization…
permissive · top 15,000 on PyPI
formulaic-contrastsBuilds arbitrary contrasts for statistical…
permissive · top 15,000 on PyPI
directsearchSolves unconstrained and linearly constrained…
copyleft · top 15,000 on PyPI
paretosetComputes the Pareto (non-dominated) set from…
permissive · top 15,000 on PyPI
SALibSALib implements global sensitivity analysis…
permissive · top 15,000 on PyPI
gekkoGEKKO is a Python package for optimization and…
permissive · top 15,000 on PyPI