Evolvable Players

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.

Moran Process: Atomic Mutation for Evolvable Players

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")
>>> 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 Moran Process for more information.