Generation
- class Generation(molecule_records, mutation_records, crossover_records)[source]
Bases:
object
An abstract base class for EA generations.
Notes
You might notice that the public methods of this abstract base class are implemented. This is just a default implementation, which you can ignore or override when implementing subclasses.
Methods
Yield the crossover records in the generation.
Yield the molecule records in the generation.
Yield the mutation records in the generation.
- __init__(molecule_records, mutation_records, crossover_records)[source]
Initialize a
Generation
instance.- Parameters
molecule_records (
tuple
ofMoleculeRecord
) – The records of molecules in the generation.mutation_records (
tuple
ofMutationRecord
) – The records of mutations done during the generation.crossover_records (
tuple
ofCrossoverRecord
) – The records of crossover operations done during the generation.
- get_crossover_records()[source]
Yield the crossover records in the generation.
- Yields
CrossoverRecord
– A crossover record.
- get_molecule_records()[source]
Yield the molecule records in the generation.
- Yields
MoleculeRecord
– A molecule record.
- get_mutation_records()[source]
Yield the mutation records in the generation.
- Yields
MutationRecord
– A mutation record.