cmaes: A Simple yet Practical Python Library for CMA-ES
Masahiro Nomura, Masashi Shibata, Ryoki Hamano
TL;DR
This paper presents cmaes, a simple yet practical Python library implementing CMA-ES with a focus on readability and easy integration into real-world workflows. It combines core CMA-ES mechanics with modern enhancements—learning-rate adaptation (LRA-CMA), transfer learning (WS-CMA), mixed-variable handling (CMAwM/CatCMAwM), and multi-objective support (COMO-CatCMAwM)—through user-friendly APIs and an ask-and-tell interface. The authors also emphasize software quality through fuzz testing, animated visualizations, and real-world integration (e.g., Optuna), while acknowledging current limitations relative to larger libraries like pycma and COCO. Overall, cmaes aims to bridge theory and practice, offering practitioners a lightweight, extensible foundation for robust CMA-ES optimization across continuous, mixed, and multi-objective problems.
Abstract
The covariance matrix adaptation evolution strategy (CMA-ES) has been highly effective in black-box continuous optimization, as demonstrated by its success in both benchmark problems and various real-world applications. To address the need for an accessible and powerful tool in this domain, we developed cmaes, a simple and practical Python library for CMA-ES. cmaes is characterized by its simplicity, offering intuitive use and high code readability. This makes it suitable for quick use of CMA-ES, as well as for educational purposes and seamless integration into other libraries. Despite its simple design, cmaes maintains advanced functionality. It incorporates recent advancements in CMA-ES, such as learning rate adaptation for challenging scenarios, transfer learning, mixed-variable optimization, and multi-objective optimization capabilities. These advanced features are accessible through a user-friendly API, ensuring that cmaes can be easily adopted in practical applications. We present cmaes as a strong candidate for a practical Python CMA-ES library aimed at practitioners. The software is available under the MIT license at https://github.com/CyberAgentAILab/cmaes.
