desdeo_emo.population.Population
¶
Module Contents¶
Classes¶
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
-
class
desdeo_emo.population.Population.
BasePopulation
(problem: desdeo_problem.MOProblem, pop_size: int, pop_params: Dict = None)[source]¶ Bases:
abc.ABC
Helper class that provides a standard way to create an ABC using inheritance.
-
abstract
add
(self, offsprings: Union[List, numpy.ndarray]) → List[source]¶ Evaluate and add offspring to the population.
- Parameters
offsprings (Union[List, np.ndarray]) – List or array of individuals to be evaluated and added to the population.
- Returns
Indices of the evaluated individuals
- Return type
List
-
abstract
keep
(self, indices: List)[source]¶ - Save the population members given by the list of indices for the next
generation. Delete the rest.
- Parameters
indices (List) –
- List of indices of the population members to be kept for the next
generation.
-
abstract
delete
(self, indices: List)[source]¶ - Delete the population members given by the list of indices for the next
generation. Keep the rest.
- Parameters
indices (List) – List of indices of the population members to be deleted.
-
abstract
mate
(self, mating_individuals: List = None, params: Dict = None) → Union[List, numpy.ndarray][source]¶ Perform crossover and mutation over the population members.
- Parameters
mating_individuals (List, optional) –
- List of individuals taking part in recombination. By default None, which
recombinated all individuals in random order.
params (Dict, optional) – Parameters for the mutation or crossover operator, by default None.
- Returns
The offspring population
- Return type
Union[List, np.ndarray]
-
abstract
-
class
desdeo_emo.population.Population.
Population
(problem: desdeo_problem.MOProblem, pop_size: int, pop_params: Dict = None, use_surrogates: bool = False)[source]¶ Bases:
BasePopulation
Helper class that provides a standard way to create an ABC using inheritance.
-
add
(self, offsprings: Union[List, numpy.ndarray], use_surrogates: bool = False) → List[source]¶ Evaluate and add offspring to the population.
- Parameters
offsprings (Union[List, np.ndarray]) – List or array of individuals to be evaluated and added to the population.
use_surrogates (bool) – If true, use surrogate models rather than true function evaluations.
use_surrogates – If true, use surrogate models rather than true function evaluations.
- Returns
Indices of the evaluated individuals
- Return type
List
-
keep
(self, indices: List)[source]¶ - Save the population members given by the list of indices for the next
generation. Delete the rest.
- Parameters
indices (List) –
- List of indices of the population members to be kept for the next
generation.
-
delete
(self, indices: List)[source]¶ - Delete the population members given by the list of indices for the next
generation. Keep the rest.
- Parameters
indices (List) – List of indices of the population members to be deleted.
-
mate
(self, mating_individuals: List = None) → Union[List, numpy.ndarray][source]¶ Perform crossover and mutation over the population members.
- Parameters
mating_individuals (List, optional) –
- List of individuals taking part in recombination. By default None, which
recombinated all individuals in random order.
params (Dict, optional) – Parameters for the mutation or crossover operator, by default None.
- Returns
The offspring population
- Return type
Union[List, np.ndarray]
-
replace
(self, indices: List, individual: numpy.ndarray, evaluation: tuple)[source]¶ - Replace the population members given by the list of indices by the given individual and its evaluation.
Keep the rest of the population unchanged.
- Parameters
indices (List) – List of indices of the population members to be replaced.
individual (np.ndarray) – Decision variables of the individual that will replace the positions given in the list.
evaluation (tuple) – Result of the evaluation of the objective function, constraints, etc. obtained using the evaluate method.
-