Several strategies in the library derive from EvolvablePlayer
which specifies methods
allowing evolutionary or particle swarm algorithms to be used with these strategies. The
Axelrod Dojo library [Axelrod1980]_
contains implementations of both algorithms for use with the Axelrod library. Examples include
FSMPlayers, ANN (neural networks), and LookerUp and Gambler (lookup tables).
New EvolvablePlayer
subclasses can be added to the library. Any strategy that can
define mutation
and crossover
methods can be used with the evolutionary algorithm
and the atomic mutation version of the Moran process. To use the particle swarm algorithms, methods
to serialize the strategy to and from a vector of floats must be defined.
Additionally, the Moran process implementation supports a second style of mutation suitable for
evolving new strategies utilizing the EvolvablePlayer
class via its mutate
method.
This is in contrast to the transitional mutation that selects one of the other player types rather than (possibly)
generating a new player variant. To use this mutation style set mutation_method=atomic in the initialisation
of the Moran process:
>>> import axelrod as axl >>> C = axl.Action.C >>> players = [axl.EvolvableFSMPlayer(num_states=2, initial_state=1, initial_action=C) for _ in range(5)] >>> mp = axl.MoranProcess(players, turns=10, mutation_method="atomic", seed=1) >>> population = mp.play() # doctest: +SKIP
Note that this may cause the Moran process to fail to converge, if the mutation rates are very high or the population size very large. See :ref:`moran-process` for more information.
EvolvablePlayers
are inherently stochastic. For reproducibility of results, they can be seeded. When
using the Moran process, a process level seed is sufficient. Child seeds will be created and propagated
in a reproducible way. If initialized without a seed, an EvolvablePlayer
will be given a
random seed in a non-reproducible way.