neat-python
neat-python copied to clipboard
Population assumes fitness_criterion to be max while reporting
on Population.run(), while compiling statistics for reporting, the methods looks for the genome with the highest fitness value irrespective of what was set under fitness_criterion.
best = None
for g in itervalues(self.population):
if best is None or g.fitness > best.fitness:
best = g
self.reporters.post_evaluate(self.config, self.population, self.species, best)
#Track the best genome ever seen.
if self.best_genome is None or best.fitness > self.best_genome.fitness:
self.best_genome = best
Seems consistent with what is checked in the population class for the termination:
if not self.config.no_fitness_termination:
# End if the fitness threshold is reached.
fv = self.fitness_criterion(g.fitness for g in itervalues(self.population))
if fv >= self.config.fitness_threshold:
self.reporters.found_solution(self.config, self.generation, best)
break