1
=======================
2
Cooperative Coevolution
3
=======================
5
This example explores cooperative coevolution using DEAP. This tutorial is not
6
as complete as previous examples concerning type creation and other
7
basic stuff. Instead, we cover the concepts of coevolution as they would be
8
applied in DEAP. Assume that if a function from the toolbox is used,
9
it has been properly registered. This example makes a great template for
10
implementing your own coevolutionary algorithm, it is based on the description
11
of cooperative coevolution by [Potter2001]_.
13
Coevolution is, in fact, just an extension of how algorithms works in deap.
14
Multiple populations are evolved in turn (or simultaneously on multiple
15
processors) just like in traditional genetic algorithms. The implementation of
16
the coevolution is thus straightforward. A first loop acts for iterating over
17
the populations and a second loop iterates over the individuals of these
20
The first step is to create a bunch of species that will evolve in our
23
.. literalinclude:: /../examples/coev/coop_evol.py
26
Cooperative coevolution works by sending the best individual of each species
27
(called representative) to help in the evaluation of the individuals of the
28
other species. Since the individuals are not yet evaluated we select randomly
29
the individuals that will be in the set of representatives.
31
.. literalinclude:: /../examples/coev/coop_evol.py
34
The evaluation function takes a list of individuals to be evaluated including
35
the representatives of the other species and possibly some other arguments.
36
It is not presented in detail for scope reasons, the structure would be, as
37
usual, something like this ::
39
def evaluate(individuals):
40
# Compute the collaboration fitness
43
The evolution can now begin.
45
.. literalinclude:: /../examples/coev/coop_evol.py
46
:lines: 85-96,103-106,113-114
48
The last lines evolve each species once before sharing their representatives.
49
The common parts of an evolutionary algorithm are all present, variation,
50
evaluation and selection occurs for each species. The species index is simply
51
a unique number identifying each species, it can be used to keep independent
52
statistics on each new species added.
54
After evolving each species, steps described in [Potter2001]_ are achieved
55
to add a species and remove useless species on stagnation. These steps are not
56
covered in this example but are present in the complete source code of
57
the coevolution examples.
59
- :example:`Coevolution Base <coev/coop_base>`
60
- :example:`Coevolution Niching <coev/coop_niche>`
61
- :example:`Coevolution Generalization <coev/coop_gen>`
62
- :example:`Coevolution Adaptation <coev/coop_adapt>`
63
- :example:`Coevolution Final <coev/coop_evol>`
65
.. [Potter2001] Potter, M. and De Jong, K., 2001, Cooperative
66
Coevolution: An Architecture for Evolving Co-adapted Subcomponents.