saealib.TournamentSelection#

class saealib.TournamentSelection(tournament_size)[ソース]#

ベースクラス: ParentSelection

Tournament selection operator.

参照

[14]: Miller, B. L., & Goldberg, D. E. (1995). Genetic algorithms, tournament selection, and the effects of noise. Complex Systems, 9(3), 193-212.

[15]: Blickle, T., & Thiele, L. (1996). A comparison of selection schemes used in evolutionary algorithms. Evolutionary Computation, 4(4), 361-394. (Basis for the tournament_size design.)

パラメータ:

tournament_size (int)

Methods

__init__

contract

Return the tournament-selection contract.

select

Execute tournament selection.

Method Details

TournamentSelection.__init__(tournament_size)[ソース]#
パラメータ:

tournament_size (int)

TournamentSelection.contract()[ソース]#

Return the tournament-selection contract.

戻り値の型:

ComponentContract

TournamentSelection.select(ctx, population, n_pair, n_parents, rng=Generator(PCG64) at 0x7FE0F45F9700)[ソース]#

Execute tournament selection.

パラメータ:
  • ctx (ExecutionContext) -- 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()

戻り値:

Selected parent indices. shape = (n_pair, n_parents)

戻り値の型:

np.ndarray