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

get_crossover_records

Yield the crossover records in the generation.

get_fitness_values

Get the fitness values of the generation.

get_molecule_records

Yield the molecule records in the generation.

get_mutation_records

Yield the mutation records in the generation.

get_crossover_records()[source]

Yield the crossover records in the generation.

Yields:

A crossover record.

Return type:

Iterator[CrossoverRecord[T]]

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]

get_mutation_records()[source]

Yield the mutation records in the generation.

Yields:

A mutation record.

Return type:

Iterator[MutationRecord[T]]