saealib.LinearRankSelection#

class saealib.LinearRankSelection[ソース]#

ベースクラス: ParentSelection

Parent selection using linear rank-based probabilities.

Selection probability is proportional to rank: the best individual has the highest probability and the worst has the lowest. This avoids numerical issues with raw fitness values (negative values, scale sensitivity) while preserving a fitness-proportionate behaviour.

Methods

__init__

contract

Return the linear-rank-selection contract.

select

Execute linear rank selection.

Method Details

LinearRankSelection.__init__()[ソース]#
LinearRankSelection.contract()[ソース]#

Return the linear-rank-selection contract.

戻り値の型:

ComponentContract

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

Execute linear rank 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