saealib.KNNConstraintObjectiveSet#

class saealib.KNNConstraintObjectiveSet(n_neighbors=50)[source]#

Bases: TrainingSet

Retrieve the k nearest archive neighbours of candidate_x.

Analogue of KNNObjectiveSet for constraint surrogates. Returns the k-NN subset of (archive.x, archive.g) centred on candidate_x.

Parameters:

n_neighbors (int) – Number of nearest neighbours to retrieve.

Raises:

ValueError – If candidate_x is None, or if the archive has no constraint columns.

Methods

__init__

build

Return k nearest-neighbour archive points with raw constraint values.

contract

Return the training-set contract.

Method Details

KNNConstraintObjectiveSet.__init__(n_neighbors=50)[source]#
Parameters:

n_neighbors (int)

Return type:

None

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

Return k nearest-neighbour archive points with raw constraint values.

Parameters:
  • archive (Archive)

  • population (Population | None)

  • ctx (OptimizationState | None)

  • candidate_x (np.ndarray | None)

Return type:

TrainingData

KNNConstraintObjectiveSet.contract()#

Return the training-set contract.

Return type:

ComponentContract