saealib.ParentSelection

class saealib.ParentSelection[source]

Bases: ABC

Base class for parent selection operators.

Methods

__init__

select

Select parents for reproduction.

Method Details

ParentSelection.__init__()
abstract ParentSelection.select(ctx, population, n_pair, n_parents, rng=Generator(PCG64) at 0x7FECD0E5BD80)[source]

Select parents for reproduction.

Parameters:
  • ctx (OptimizationContext) – Optimization context.

  • population (Population) – Population to select from.

  • n_pair (int) – Number of pairs to select.

  • n_parents (int) – Number of parents per pair.

  • rng (np.random.Generator, optional) – Random number generator, by default np.random.default_rng()

Returns:

Selected parent indices. shape = (n_pair, n_parents)

Return type:

np.ndarray