Commit 15d07009 authored by David A.. Werner's avatar David A.. Werner
Browse files

Sort population after survival

parent 24af9984
......@@ -164,6 +164,7 @@ class EvolutionSimulator(object):
num_after_survival = [len(self.population), len(self._children), len(self._mutants)]
self.population = self.population + self._children + self._mutants
self._children = self._mutants = []
self.population.sort(key=lambda val: val.fitness, reverse=True)
return num_after_survival
def run_simulation(self, num_generations, history_interval=1, progress_bar=True):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment