v0.13.0
New Algorithms
COMO-CatCMA with Margin [Hamano et al. 2026]
COMO-CatCMA with Margin (COMO-CatCMAwM) performs multi-objective mixed-variable optimization by coordinating multiple CatCMAwM optimizers. It currently supports two-objective problems; support for three or more objectives is planned.
import numpy as np
from cmaes import COMOCatCMAwM
def DSIntLFTL(x, z, c, cat_num):
Sphere1 = sum((x / 10) ** 2) / len(x)
Sphere2 = sum((x / 10 - 1) ** 2) / len(x)
SphereInt1 = sum((z / 10) ** 2) / len(z)
SphereInt2 = sum((z / 10 - 1) ** 2) / len(z)
c_idx = c.argmax(axis=1)
LF = (len(c) - (c_idx == 0).cumprod().sum()) / len(c)
TL = (len(c) - (c_idx == np.asarray(cat_num) - 1)[::-1].cumprod().sum()) / len(c)
obj1 = Sphere1 + SphereInt1 + LF
obj2 = Sphere2 + SphereInt2 + TL
return [obj1, obj2]
if __name__ == "__main__":
# [lower_bound, upper_bound] for each continuous variable
X = [[-5, 15]] * 3
# possible values for each integer variable
Z = [range(-5, 16)] * 3
# number of categories for each categorical variable
C = [5] * 3
optimizer = COMOCatCMAwM(x_space=X, z_space=Z, c_space=C)
evals = 0
while evals < 7000:
solutions = []
for sol in optimizer.ask_iter():
value = DSIntLFTL(sol.x, sol.z, sol.c, C)
evals += 1
solutions.append((sol, value))
optimizer.tell(solutions)
print(evals, optimizer.incumbent_objectives)References
- [Hamano et al. 2026] R. Hamano, M. Nomura, S. Saito, K. Uchida, S. Shirakawa, CatCMA with Margin for Single- and Multi-Objective Mixed-Variable Black-Box Optimization, arXiv:2504.07884, 2026.
What's Changed
- Update the Optuna's example code by @c-bata in #207
- Make cmaes a bit faster by @c-bata in #157
- COMO-CatCMA with Margin by @ha-mano in #211
- Update README.md by @nomuramasahir0 in #212
- Enable OIDC publishing for PyPI by @c-bata in #213
- Remove tests for free-threaded support by @c-bata in #214
- Update the supported Python versions to 3.9-3.14 by @c-bata in #215
- Migrate to ruff from black/isort/flake8 by @c-bata in #216
- Migrate to uv by @c-bata in #217
- Bump the version up to v0.13.0 by @c-bata in #218
- Update the workflow for release by @c-bata in #219
Full Changelog: v0.12.0...v0.13.0
PyPI: https://pypi.org/project/cmaes/