_generational

Module Contents

Functions

generational(→ tuple[list[int], list[int]])

Select len(old_genotypes) individuals using the provided selection function from only the offspring(new_genotypes).

Attributes

Genotype

Fitness

Genotype
Fitness
generational(old_genotypes: list[Genotype], old_fitnesses: list[Fitness], new_genotypes: list[Genotype], new_fitnesses: list[Fitness], selection_function: Callable[[int, list[Genotype], list[Fitness]], list[int]]) tuple[list[int], list[int]]

Select len(old_genotypes) individuals using the provided selection function from only the offspring(new_genotypes).

Parameters:
  • old_genotypes – Genotypes of the individuals in the parent population. Ignored and only here for function signature compatibility with steady_state.

  • old_fitnesses – Fitnesses of the individuals in the parent population. Ignored and only here for function signature compatibility with steady_state.

  • new_genotypes – Genotypes of the individuals from the offspring.

  • new_fitnesses – Fitnesses of the individuals from the offspring.

  • selection_function – Function that selects n individuals from a population based on their genotype and fitness. (n, genotypes, fitnesses) -> indices

Returns:

(always empty list of indices of selected old individuals, indices of selected individuals from offspring).