1.. _cma-es:
2
3===============================================
4Covariance Matrix Adaptation Evolution Strategy
5===============================================
6The Covariance Matrix Adaptation Evolution Strategy (CMA-ES) [Hansen2001]_
7implemented in the :mod:`~deap.cma` module makes use of the generate-update
8paradigm where a population is generated from a strategy and the strategy is
9updated from the population. It is then straight forward to use it for
10continuous problem optimization.
11
12As usual the first thing to do is to create the types and as usual we'll need
13a minimizing fitness and an individual that is a :class:`list`. A toolbox is
14then created with the desired evaluation function.
15
16.. literalinclude:: /../examples/es/cma_minfct.py
17   :lines: 28-32
18
19Then, it does not get any harder. Once a :class:`~deap.cma.Strategy` is
20instantiated, its :meth:`~deap.cma.Strategy.generate` and
21:meth:`~deap.cma.Strategy.update` methods are registered in the toolbox for
22uses in the :func:`~deap.algorithms.eaGenerateUpdate` algorithm. The
23:meth:`~deap.cma.Strategy.generate` method is set to produce the created
24:class:`Individual` class. The random number generator from numpy is seeded
25because the :mod:`~deap.cma` module draws all its number from it.
26
27.. literalinclude:: /../examples/es/cma_minfct.py
28   :lines: 34,36,37,41-50,52,54
29
30.. [Hansen2001] Hansen and Ostermeier, 2001. Completely Derandomized
31   Self-Adaptation in Evolution Strategies. *Evolutionary Computation*
32