xlemoo.selection

class XLEMOO.selection.SelectNBest(pop: SurrogatePopulation, n_best: int)[source]

A class implementing a selection operator that simply returns the indices of n population members with the best (lowest) fitnesses. If the population is smaller than n_best, then return the indices of the whole population.

Parameters:
  • pop (SurrogatePopulation) – The population form which the members are selected from.

  • n_best (int) – The number of best members to select.

do(pop: SurrogatePopulation, fitness: ndarray) List[int][source]

Perform the selection.

Parameters:
  • pop (SurrogatePopulation) – The population of solutions.

  • fitness (np.ndarray) – The fitness of each member of the population.

Returns:

A list of indices with the self._n_best members with the highest fitness.

Return type:

List[int]