geneticengine.representations.grammatical_evolution.structured_ge

Module Contents

Classes

Genotype

StructuredListWrapper

StructuredGrammaticalEvolutionRepresentation

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

Attributes

INFRASTRUCTURE_KEY

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, max_depth, gene_length=256, initialization_mode=pi_grow_method)

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 (Grammar) – The grammar to use in the mapping

  • max_depth (int) – the maximum depth when performing the mapping

  • initialization_mode (InitializationMethodType) – method to create individuals in the mapping (e.g., pi_grow, full, grow)

  • gene_length (int)

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, internal, **kwargs)
Parameters:
Return type:

Genotype

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

tuple[Genotype, Genotype]