pycellga.selection package
Submodules
pycellga.selection.roulette_wheel_selection module
- class pycellga.selection.roulette_wheel_selection.RouletteWheelSelection(pop_list: List[Individual] = [], c: int = 0)[source]
Bases:
SelectionOperator
RouletteWheelSelection performs a roulette wheel selection on a population of individuals to select parent individuals for crossover.
- Parameters:
pop_list (list of Individual) – The population of individuals to select from.
c (int) – The index of the individual to start selection from.
- __init__(pop_list: List[Individual] = [], c: int = 0)[source]
Initialize the RouletteWheelSelection object.
- Parameters:
pop_list (list of Individual) – The population of individuals to select from.
c (int) – The index of the individual to start selection from.
- get_parents() List[Individual] [source]
Perform the roulette wheel selection to get parent individuals.
- Returns:
A list containing the selected parent individuals.
- Return type:
list of Individual
pycellga.selection.selection_operator module
pycellga.selection.tournament_selection module
- class pycellga.selection.tournament_selection.TournamentSelection(pop_list: List[Individual] = [], c: int = 0, K: int = 2)[source]
Bases:
SelectionOperator
TournamentSelection performs a tournament selection on a population of individuals to select parent individuals for crossover.
- Parameters:
pop_list (list of Individual) – The population of individuals to select from.
c (int) – The index of the individual to start selection from.
K (int) – The number of individuals to be chosen at random from neighbors.
- __init__(pop_list: List[Individual] = [], c: int = 0, K: int = 2)[source]
Initialize the TournamentSelection object.
- Parameters:
pop_list (list of Individual) – The population of individuals to select from.
c (int) – The index of the individual to start selection from.
K (int) – The number of individuals to be chosen at random from neighbors.
- get_parents() List[Individual] [source]
Perform the tournament selection to get parent individuals.
- Returns:
A list containing the selected parent individuals.
- Return type:
list of Individual