作者:Masashi Shibata
作者邮箱:shibata_masashi@cyberagent.co.jp
首页:https://github.com/CyberAgent/cmaes
文档:None
下载链接
CMA-ES
Lightweight Covariance Matrix Adaptation Evolution Strategy (CMA-ES) [1] implementation.
Rosenbrock function.
IPOP-CMA-ES [2] on Himmelblau function.
BIPOP-CMA-ES [3] on Himmelblau function.
These GIF animations are generated by visualizer.py.
Installation
Supported Python versions are 3.6 or later.
$ pip install cmaes
Or you can install via conda-forge.
$ conda install -c conda-forge cmaes
Usage
This library provides an "ask-and-tell" style interface.
import numpy as np
from cmaes import CMA
def quadratic(x1, x2):
return (x1 - 3) ** 2 + (10 * (x2 + 2)) ** 2
if __name__ == "__main__":
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 = qu