saealib.TruncationSelection#

class saealib.TruncationSelection(randomize_ties=False)[source]#

Bases: SurvivorSelection

Truncation selection operator.

Parameters:

randomize_ties (bool)

randomize_ties#

When True, individuals tied at the truncation boundary (equal under comparator.compare_population) are shuffled before truncating, matching pymoo’s randomized_argsort treatment of the splitting front. When False (default), ties keep the order returned by comparator.rank_population (deterministic).

Type:

bool

Methods

__init__

Initialize truncation selection operator.

contract

Return the truncation-selection contract.

select

Select survivors by truncating the sorted pool.

Method Details

TruncationSelection.__init__(randomize_ties=False)[source]#

Initialize truncation selection operator.

Parameters:

randomize_ties (bool, optional) – Randomize the order of individuals tied at the truncation boundary, by default False.

TruncationSelection.contract()[source]#

Return the truncation-selection contract.

Return type:

ComponentContract

TruncationSelection.select(ctx, pool, n_survivors)[source]#

Select survivors by truncating the sorted pool.

Parameters:
  • ctx (ExecutionContext) – Optimization context.

  • pool (Population) – Selection pool to choose survivors from.

  • n_survivors (int) – Number of survivors to select.

Returns:

Indices of selected survivors in the pool.

Return type:

np.ndarray