geneticengine.representations.grammatical_evolution.ge
Classes
GE variant that appends random codons when mapping exhausts the genome. |
Module Contents
- class geneticengine.representations.grammatical_evolution.ge.ListWrapper
Bases:
geneticengine.random.sources.RandomSource- dna: list[int]
- index: int = 0
- random: geneticengine.random.sources.RandomSource | None = None
- extend: bool = False
- consumed: int = 0
- _next_gene()
- Return type:
int
- randint(min, max)
- Parameters:
min (int)
max (int)
- Return type:
int
- random_float(min, max)
- Parameters:
min (float)
max (float)
- Return type:
float
- class geneticengine.representations.grammatical_evolution.ge.GrammaticalEvolutionRepresentation(grammar, decider, gene_length=256, mutation=None, extend_genotype=False)
Bases:
geneticengine.representations.api.Representation[Genotype,geneticengine.solutions.tree.TreeNode],geneticengine.representations.api.RepresentationWithMutation[Genotype],geneticengine.representations.api.RepresentationWithCrossover[Genotype]- Parameters:
grammar (Grammar) – The grammar to use in the mapping
decider (SynthesisDecider) – Controls phenotype tree construction depth
gene_length (int) – Initial genome length for new individuals
mutation (geneticengine.representations.linear_mutation.LinearGenomeMutation[int] | None) – Mutation strategy for the integer codon list. Defaults to
PointMutation. PassUMADfor addition/deletion mutation.extend_genotype (bool)
- grammar
- decider
- gene_length = 256
- extend_genotype = False
- _expressed_length(genotype)
Return the number of codons used to map
genotype.- Parameters:
genotype (Genotype)
- Return type:
int
- create_genotype(random, **kwargs)
- Parameters:
- Return type:
- _random_gene(random)
- Parameters:
- Return type:
int
- class geneticengine.representations.grammatical_evolution.ge.ExtensibleGrammaticalEvolutionRepresentation(grammar, decider, gene_length=256)
Bases:
GrammaticalEvolutionRepresentationGE variant that appends random codons when mapping exhausts the genome.
- Parameters:
grammar (Grammar) – The grammar to use in the mapping
decider (SynthesisDecider) – Controls phenotype tree construction depth
gene_length (int) – Initial genome length for new individuals
mutation – Mutation strategy for the integer codon list. Defaults to
PointMutation. PassUMADfor addition/deletion mutation.