population_management

Functions for combining populations in EA algorithms.

Package Contents

Functions

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

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

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

Select len(old_genotypes) individuals using the provided selection function from combined set of old and new individuals.

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).

steady_state(old_genotypes: list[Genotype], old_fitnesses: list[Fitness], new_genotypes: list[Genotype], new_fitnesses: list[Fitness], selection_function: Callable[[int, list[Genotype], list[Fitness]], numpy.typing.NDArray[numpy.float_]]) tuple[list[int], list[int]]

Select len(old_genotypes) individuals using the provided selection function from combined set of old and new individuals.

Parameters:
  • old_genotypes – Genotypes of the individuals in the parent population.

  • old_fitnesses – Fitnesses of the individuals in the parent population.

  • 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:

(indices of selected individuals from parent population, indices of selected individuals from offspring).