def check_for_ec(self, gen: int, ga: GeneticAlgorithm, population: Population): w = population.get_least_fit().get_fitness() b = population.get_fittest().get_fitness() return b - w < self.dist
def check_for_ec(self, gen: int, ga: GeneticAlgorithm, population: Population): f = population.get_fittest().get_fitness() m = mean(ch.get_fitness() for ch in population) return f - m < self.dist_from_avg