eckity.evaluators.population_evaluator
1from concurrent.futures import Executor 2 3from eckity.event_based_operator import Operator 4 5 6class PopulationEvaluator(Operator): 7 def __init__(self): 8 super().__init__() 9 self.executor = None 10 11 def _evaluate(self, population): 12 """ 13 Evaluate the fitness score of the entire population 14 15 Parameters 16 ---------- 17 population: 18 a population instance 19 20 Returns 21 ------- 22 individual 23 the individual with the best fitness out of the given individuals 24 """ 25 self.applied_individuals = population 26 27 def apply_operator(self, payload): 28 return self._evaluate(payload) 29 30 def set_executor(self, executor: Executor): 31 self.executor = executor
7class PopulationEvaluator(Operator): 8 def __init__(self): 9 super().__init__() 10 self.executor = None 11 12 def _evaluate(self, population): 13 """ 14 Evaluate the fitness score of the entire population 15 16 Parameters 17 ---------- 18 population: 19 a population instance 20 21 Returns 22 ------- 23 individual 24 the individual with the best fitness out of the given individuals 25 """ 26 self.applied_individuals = population 27 28 def apply_operator(self, payload): 29 return self._evaluate(payload) 30 31 def set_executor(self, executor: Executor): 32 self.executor = executor