geneticengine.representations.grammatical_evolution.structured_ge

Attributes

INFRASTRUCTURE_KEY

Classes

Genotype

StructuredListWrapper

StructuredGrammaticalEvolutionRepresentation

This version uses a list of lists of integers to represent individuals,

Module Contents

geneticengine.representations.grammatical_evolution.structured_ge.INFRASTRUCTURE_KEY = '$infrastructure'
class geneticengine.representations.grammatical_evolution.structured_ge.Genotype
dna: dict[str, list[int]]
class geneticengine.representations.grammatical_evolution.structured_ge.StructuredListWrapper(dna)

Bases: geneticengine.random.sources.RandomSource

dna: dict[str, list[int]]
indexes: dict[str, int]
randint(min, max, prod=INFRASTRUCTURE_KEY)
Parameters:
  • min (int)

  • max (int)

  • prod (str)

Return type:

int

random_float(min, max, prod=INFRASTRUCTURE_KEY)
Parameters:
  • min (float)

  • max (float)

  • prod (str)

Return type:

float

class geneticengine.representations.grammatical_evolution.structured_ge.StructuredGrammaticalEvolutionRepresentation(grammar, decider, gene_length=256)

Bases: geneticengine.representations.api.Representation[Genotype, geneticengine.solutions.tree.TreeNode], geneticengine.representations.api.RepresentationWithMutation[Genotype], geneticengine.representations.api.RepresentationWithCrossover[Genotype]

This version uses a list of lists of integers to represent individuals, based on non-terminal symbols.

Parameters:
grammar
decider
gene_length = 256
create_genotype(random, **kwargs)
Parameters:

random (geneticengine.random.sources.RandomSource)

Return type:

Genotype

genotype_to_phenotype(genotype)
Parameters:

genotype (Genotype)

Return type:

geneticengine.solutions.tree.TreeNode

mutate(random, genotype, **kwargs)
Parameters:
Return type:

Genotype

crossover(random, parent1, parent2, **kwargs)
Parameters:
Return type:

tuple[Genotype, Genotype]