if self.send_all:
calculate_fitness = self.evaluate_all(population)
else:
calculate_fitness = [self.measure(ind) for ind in calculate]
// save to cache
for key, fit in zip(map(self._hash, calculate), calculate_fitness):
self.cache[key] = fit
After Change
thread = Thread(target=self.queue.run)
thread.start()
with concurrent.futures.ThreadPoolExecutor(max_workers=len(calculate)) as executor:
futures = {executor.submit(self.measure, ind): ind for ind in calculate}
for future in futures:
calculate_fitness.append(future.result())
thread.join()