stk.Generation
- class stk.Generation(fitness_values, mutation_records, crossover_records)[source]
Bases:
Generic
[T
]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.
- Parameters:
fitness_values (dict[T, FitnessValues]) – The records of molecules in the generation.
mutation_records (list[MutationRecord[T]]) – The records of mutations done during the generation.
crossover_records (list[CrossoverRecord[T]]) – The records of crossover operations done during the generation.
Methods
Yield the crossover records in the generation.
Get the fitness values of the generation.
Yield the molecule records in the generation.
Yield the mutation records in the generation.
- get_crossover_records()[source]
Yield the crossover records in the generation.
- Yields:
A crossover record.
- Return type:
- get_fitness_values()[source]
Get the fitness values of the generation.
- Returns:
The fitness values.
- Return type:
dict[T, FitnessValues]
- get_molecule_records()[source]
Yield the molecule records in the generation.
- Yields:
A molecule record.
- Return type:
Iterator[T]