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

Population.update_fitness now uses multithreading.Pool if there is one

parent fe860006
......@@ -180,4 +180,13 @@ class EvolutionSimulator(object):
def update_fitness(self):
all_manducas = self.population + self._children + self._mutants
[ for manduca in all_manducas]
if self.pool is not None:
# Don't bother sending manducas that already have _fitness saved
all_manducas = filter(lambda m: m._fitness is None, all_manducas)
for idx, fitness in enumerate(, all_manducas)):
all_manducas[idx]._fitness = fitness
[ for manduca in all_manducas]
def compute_fitness(manduca):
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