Skip to content

Commit 562bfee

Browse files
committed
Add basic documentation for EvolvablePlayer
1 parent 348a4a5 commit 562bfee

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.. _evolvable_players:
2+
3+
Evolvable Players
4+
=================
5+
6+
Several strategies in the library derive from :code:`EvolvablePlayer` which specifies methods
7+
allowing evolutionary or particle swarm algorithms to be used with these strategies. The
8+
`Axelrod Dojo library <https://github.com/Axelrod-Python/axelrod-dojo>`_ [Axelrod1980]_
9+
contains implementations of both algorithms for use with the Axelrod library. Examples include
10+
FSMPlayers, ANN (neural networks), and LookerUp and Gambler (lookup tables).
11+
12+
New :code:`EvolvablePlayer` subclasses can be added to the library. Any strategy that can
13+
define :code:`mutation` and :code:`crossover` methods can be used with the evolutionary algorithm
14+
and the atomic mutation version of the Moran process. To use the particle swarm algorithms, methods
15+
to serialize the strategy to and from a vector of floats must be defined.

docs/tutorials/further_topics/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ Contents:
1818
ecological_variant.rst
1919
fingerprinting.rst
2020
meta_strategies.rst
21+
evolvable_players.rst

docs/tutorials/getting_started/moran.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,18 @@ Other types of implemented Moran processes:
132132

133133
- :ref:`moran-process-on-graphs`
134134
- :ref:`approximate-moran-process`
135+
136+
Atomic Mutation for Evolvable Players
137+
-------------------------------------
138+
139+
Additionally, the Moran process implementation supports a second style of mutation suitable for
140+
evolving new strategies. The :code:`EvolvablePlayer` class supplies a method that typically produces
141+
a similar but mutated strategy. This is in contrast to the above method of mutation that selects
142+
one of the other player types rather than generating a new player type. To use this mutation style
143+
set `mutation_method=atomic`
144+
145+
>>> C = axl.Action.C
146+
>>> players = [axl.EvolvableFSMPlayer(num_states=2, initial_state=1, initial_action=C) for _ in range(5)]
147+
>>> mp = axl.MoranProcess(players, turns=10, mutation_method="atomic")
148+
>>> population = mp.play() # doctest: +SKIP
149+

0 commit comments

Comments
 (0)