Skip to content

Commit

Permalink
Store a deep copy of each generation's best genome, as genomes appear…
Browse files Browse the repository at this point in the history
… to be modified later, giving incorrect progress results.

NOTE: This is a temporary workaround to make displayed results more accurate, as the modification of a genome after its generation has passed is a bug.
  • Loading branch information
CodeReclaimers committed Dec 17, 2015
1 parent 78dc70f commit 00bc844
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion neat/population.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import print_function

import copy
import gzip
import random
import time
Expand Down Expand Up @@ -197,7 +198,7 @@ def epoch(self, fitness_function, n, report=True, save_best=False, checkpoint_in
self.__speciate(report)

# Current generation's best genome
self.most_fit_genomes.append(max(self.population))
self.most_fit_genomes.append(copy.deepcopy(max(self.population)))
# Current population's average fitness
self.avg_fitness_scores.append(mean([c.fitness for c in self.population]))

Expand Down

0 comments on commit 00bc844

Please sign in to comment.