eckity.breeders.breeder
1from abc import abstractmethod 2 3from overrides import overrides 4 5from eckity.event_based_operator import Operator 6from eckity.population import Population 7 8 9class Breeder(Operator): 10 """ 11 The Breeder is responsible to activate the genetic operators (selection, crossover, mutation) 12 on the existing population 13 14 Parameters 15 ---------- 16 events: dict(str, dict(object, function)) 17 dictionary of event names to dictionary of subscribers to callback methods 18 """ 19 20 def __init__(self, 21 events=None): 22 super().__init__(events=events) 23 24 def breed(self, population): 25 """ 26 Breed the given population of the experiment. 27 Hence, apply genetic operators on the individuals of the population. 28 29 Parameters 30 ---------- 31 population: Population 32 The population of individuals existing in the current experiment. 33 """ 34 self.act(population) 35 36 @abstractmethod 37 def apply_breed(self, population): 38 pass 39 40 @overrides 41 def apply_operator(self, payload): 42 population: Population = payload 43 self.apply_breed(population)
10class Breeder(Operator): 11 """ 12 The Breeder is responsible to activate the genetic operators (selection, crossover, mutation) 13 on the existing population 14 15 Parameters 16 ---------- 17 events: dict(str, dict(object, function)) 18 dictionary of event names to dictionary of subscribers to callback methods 19 """ 20 21 def __init__(self, 22 events=None): 23 super().__init__(events=events) 24 25 def breed(self, population): 26 """ 27 Breed the given population of the experiment. 28 Hence, apply genetic operators on the individuals of the population. 29 30 Parameters 31 ---------- 32 population: Population 33 The population of individuals existing in the current experiment. 34 """ 35 self.act(population) 36 37 @abstractmethod 38 def apply_breed(self, population): 39 pass 40 41 @overrides 42 def apply_operator(self, payload): 43 population: Population = payload 44 self.apply_breed(population)
The Breeder is responsible to activate the genetic operators (selection, crossover, mutation) on the existing population
Parameters
- events (dict(str, dict(object, function))): dictionary of event names to dictionary of subscribers to callback methods
def
breed(self, population):
25 def breed(self, population): 26 """ 27 Breed the given population of the experiment. 28 Hence, apply genetic operators on the individuals of the population. 29 30 Parameters 31 ---------- 32 population: Population 33 The population of individuals existing in the current experiment. 34 """ 35 self.act(population)
Breed the given population of the experiment. Hence, apply genetic operators on the individuals of the population.
Parameters
population (Population):
The population of individuals existing in the current experiment.