structopt.common.population.Population¶
-
class
structopt.common.population.
Population
(parameters, individuals=None)¶ Bases:
structopt.tools.sorted_dict.SortedDict
A list-like class that contains the Individuals and the operations to be run on them.
-
add
(individual)¶ Adds an Individual to the population.
-
allgather
(individuals_per_core)¶ - Performs an MPI.allgather on self (the population) and updates the
correct individuals that have been modified based on the inputs from individuals_per_core.
See stuctopt.tools.parallel.allgather for a similar function.
(@parallel) Designed to run code that runs differently on different cores. The MPI functionality should be implemented inside these functions.
-
apply_fingerprinters
()¶ Apply fingerprinters on the entire population.
(@parallel) Designed to run code that runs differently on different cores. The MPI functionality should be implemented inside these functions.
-
bcast
()¶ Performs and MPI.bcast on self.
(@parallel) Designed to run code that runs differently on different cores. The MPI functionality should be implemented inside these functions.
-
calculate_fitnesses
()¶ Perform the fitness evaluations on the entire population.
(@parallel) Designed to run code that runs differently on different cores. The MPI functionality should be implemented inside these functions.
-
clear
() → None. Remove all items from od.¶
-
copy
() → a shallow copy of od¶
-
crossover
(pairs)¶ Perform crossovers on the population.
(@parallel) Designed to run code that runs differently on different cores. The MPI functionality should be implemented inside these functions.
-
extend
(individuals)¶ Overwrites and adds to the population using the id attribute of the individuals as a keyword. Assigns an id to an individual if it doesn’t already have one.
-
fromkeys
(S[, v]) → New ordered dictionary with keys from S.¶ If not specified, the value defaults to None.
-
get
(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
get_by_position
(position)¶ Returns the individual at position position.
-
get_new_id
()¶
-
items
() → a set-like object providing a view on D's items¶
-
keys
() → a set-like object providing a view on D's keys¶
-
kill
()¶ Remove individuals from the population based on a predator scheme.
(@parallel) Designed to run code that runs differently on different cores. The MPI functionality should be implemented inside these functions.
-
load_modules
()¶
-
mutate
()¶ Perform mutations on the population.
(@root) Designed to run on the root node only.
-
pop
(k[, d]) → v, remove specified key and return the corresponding¶ value. If key is not found, d is returned if given, otherwise KeyError is raised.
-
popitem
() → (k, v), return and remove a (key, value) pair.¶ Pairs are returned in LIFO order if last is true or FIFO order if false.
-
position
(individual)¶ Returns the position of the individual in the population.
-
relax
()¶ Relax the entire population.
(@parallel) Designed to run code that runs differently on different cores. The MPI functionality should be implemented inside these functions.
-
remove
(individual)¶ Removes individual form the population.
-
replace
(a_list)¶ Deletes the current list of individuals and replaces them with the ones in a_list.
-
run_pso_moves
(best_swarm, best_particles)¶ Perform PSO moves on the population.
(@root) Designed to run on the root node only.
-
select
()¶ Select the individuals in the population to perform crossovers on.
(@root) Designed to run on the root node only.
-
setdefault
(k[, d]) → od.get(k,d), also set od[k]=d if k not in od¶
-
update
(individuals)¶ Overwrites and adds to the population using the id attribute of the individuals as a keyword. Assigns an id to an individual if it doesn’t already have one.
-
values
() → an object providing a view on D's values¶
-