pyRVEA.Population¶
pyRVEA.Population.Population module¶
-
class
pyRVEA.Population.Population.
Population
(problem: baseProblem, assign_type: str = 'RandomAssign', plotting: bool = True, *args)¶ Bases:
object
Define the population.
-
add
(new_pop: numpy.ndarray)¶ Evaluate and add individuals to the population. Update ideal and nadir point.
- Parameters
new_pop (np.ndarray) – Decision variable values for new population.
-
append_individual
(ind: numpy.ndarray)¶ Evaluate and add individual to the population.
- Parameters
ind (np.ndarray) –
-
create_new_individuals
(design: str = 'LHSDesign', pop_size: int = None, decision_variables=None)¶ Create, evaluate and add new individuals to the population. Initiate Plots.
The individuals can be created randomly, by LHS design, or can be passed by the user.
- Parameters
design (str, optional) – Describe the method of creation of new individuals. “RandomDesign” creates individuals randomly. “LHSDesign” creates individuals using Latin hypercube sampling.
pop_size (int, optional) – Number of individuals in the population. If none, some default population size based on number of objectives is chosen.
decision_variables (numpy array or list, optional) – Pass decision variables to be added to the population.
-
eval_fitness
()¶ Calculate fitness based on objective values. Fitness = obj if minimized.
-
evaluate_individual
(ind: numpy.ndarray)¶ Evaluate individual.
Returns objective values, constraint violation, and fitness.
- Parameters
ind (np.ndarray) –
-
evolve
(EA: BaseEA = None, EA_parameters: dict = None) → Population¶ Evolve the population with interruptions.
Evolves the population based on the EA sent by the user.
- Parameters
EA ("BaseEA") – Should be a derivative of BaseEA (Default value = None)
EA_parameters (dict) – Contains the parameters needed by EA (Default value = None)
-
hypervolume
(ref_point)¶ Calculate hypervolume. Uses package pygmo. Add checks to prevent errors.
- Parameters
ref_point –
-
keep
(indices: list)¶ Remove individuals from population which are not in “indices”.
- Parameters
indices (list) – Indices of individuals to keep
-
mate
()¶ Conduct crossover and mutation over the population.
Conduct simulated binary crossover and bounded polunomial mutation.
-
non_dominated
()¶ Fix this. check if nd2 and nds mean the same thing
-
plot_init_
()¶ Initialize animation objects. Return figure
-
plot_objectives
(iteration: int)¶ Plot the objective values of individuals in notebook. This is a hack.
- Parameters
iteration (int) – Iteration count.
-
update_ideal_and_nadir
(new_objective_vals: list = None)¶ Updates self.ideal and self.nadir in the fitness space.
Uses the entire population if new_objective_vals is none.
- Parameters
new_objective_vals (list, optional) – Objective values for a newly added individual (the default is None, which calculated the ideal and nadir for the entire population.)
-