saealib.TopKBipartitionSet#

class saealib.TopKBipartitionSet(source='archive', top_ratio=0.5)[source]#

Bases: TrainingSet

Binary labels from a sorted bipartition: 1 for top-k, 0 for the rest.

Individuals are sorted by ctx.comparator.sort_population (best-first), then the top floor(n * top_ratio) receive label 1 (promising) and the remainder receive label 0 (unpromising).

Literature patterns: CPS-MOEA (P2), CSEA / pre-selection (P5).

Parameters:
  • source (str) – "archive" or "population".

  • top_ratio (float) – Fraction of individuals labelled as promising. Clamped to [0, 1]. At least one individual always receives label 1.

Raises:

ValueError – If ctx is None or source="population" with population=None.

Methods

__init__

build

Return bipartition labels based on sorted rank.

contract

Return the training-set contract.

Method Details

TopKBipartitionSet.__init__(source='archive', top_ratio=0.5)[source]#
Parameters:
  • source (str)

  • top_ratio (float)

Return type:

None

TopKBipartitionSet.build(archive, population, ctx, candidate_x=None)[source]#

Return bipartition labels based on sorted rank.

Parameters:
  • archive (Archive)

  • population (Population | None)

  • ctx (OptimizationState | None)

  • candidate_x (np.ndarray | None)

Return type:

TrainingData

TopKBipartitionSet.contract()#

Return the training-set contract.

Return type:

ComponentContract