geneticengine.algorithms.gp.cooperativegp

Module Contents

Classes

CooperativeGP

CooperativeGP takes two representations and a function that pits two

Attributes

a

b

geneticengine.algorithms.gp.cooperativegp.a
geneticengine.algorithms.gp.cooperativegp.b
class geneticengine.algorithms.gp.cooperativegp.CooperativeGP(grammar1, grammar2, function, representation1=None, representation2=None, population1_size=100, population2_size=200, coevolutions=1000, random=None, kwargs1=None, kwargs2=None)

CooperativeGP takes two representations and a function that pits two individuals against each other.

Given grammar1 and grammar 2, a population of each is generated and evolved one after the other. The fitness function is the same for both evolutions, but first minimizes the function, and the second maximizes the fitness. It runs for a given number of iterations defined by the coevolutions parameter.

Creates a new object to co-evolve species1 and species2.

Parameters:
  • grammar1 (Grammar) – Grammar of species1

  • grammar2 (Grammar) – Grammar of species2

  • function (Callable[[a,b], float]) – Function that returns a score for a battle between one individual of species1 and another of species2

  • representation1 (Representation) – Representation of species1

  • representation2 (Representation) – Representation of species2

  • population1_size (int) – Population size of species1

  • population2_size (int) – Population size of species2

  • coevolutions (int) – How many iterations of a pair of evolutions

  • random (Source) – The random number generator

  • kwargs1 (dict) – The extra arguments for the GP object of species1

  • kwargs2 (dict) – The extra arguments for the GP object of species2

search()
Return type:

tuple[a, b]