structopt.common.population.selections¶
-
class
structopt.common.population.selections.
Selections
(parameters)¶ Bases:
object
-
static
best
(population, fits)¶ Deterministic selection function that chooses adjacently ranked individuals as pairs.
Parameters: - population (Population) – An population of individuals
- fits (list) – Fitnesses that corresponds to population
-
post_processing
(pairs)¶
-
static
random_selection
(population, fits)¶ Randomly selects parents
Parameters: - population (Population) – An population of individuals
- fits (list) – Fitnesses that corresponds to population
-
static
rank
(population, fits, p_min=None, unique_pairs=False, unique_parents=False)¶ Selection function that chooses pairs of structures based on linear ranking.
See “Grefenstette and Baker 1989 Whitley 1989”.
Parameters: - population (Population) – An object inherited from list that contains StructOpt individual objects.
- fits (list) – A list of fitnesses of the population
- p_min (float) – The probability of choosing the lowest ranked individual. Given population of size N, this should be below 1/nindiv. The probability of selecting rank N (worst) to rank 1 (best) increases from p_min to (2/N - p_min) in even, (1/N - p_min) increments. Defaults to (1/N)^2.
- unique_pairs (bool) – If True, all combinations of parents are unique. True increases the diveristy of the population.
- unique_parents (bool) – If True, all parents can only mate with on other individual. True increases the diversity of the population.
-
static
roulette
(population, fits, unique_pairs=False, unique_parents=False)¶ Selection function that chooses pairs of structures based on their fitness. Fitnesses are normalized from 0 to 1.
See “Grefenstette and Baker 1989 Whitley 1989”.
Parameters: - population (StructOpt population object) – An object inherited from list that contains StructOpt individual objects.
- fits (list) – A list of fitnesses of the population
- unique_pairs (bool) – If True, all combinations of parents are unique. True increases the diveristy of the population.
- unique_parents (bool) – If True, all parents can only mate with on other individual. True increases the diversity of the population.
-
select
(population)¶
-
select_selection
()¶
-
static
tournament
(population, fits, tournament_size=5, unique_pairs=False, unique_parents=False, keep_best=False)¶ Selects pairs in seperate “tournaments”, where a subset of the population are randomly selected and the highest fitness allowed to pass. In addition to a population, their fits, and end population size, takes in a tournament size parameter.
Parameters: - population (Population) – The population of individuals needed to be trimmed
- fits (list) – List of fitnesses that correspond to the population.
- tournament_size (int) – The number of individuals in each tournament. If 1, tournament is the same as random selection. If len(population), corresponds to the “best” selection process
- unique_pairs (bool) – If True, all combinations of parents are unique, though parents can show up in different pairs. True increases the diversity of the population.
- unique_parents (bool) – If True, all parents can only mate with on other individual. True increases the diversity of the population.
-
static