I am trying to use cma for a continuous optimization problem. The
cma_minfct.py example seems to be and ideal template for my case, where I basically need to change just a few parameters and the evaluation function to get a working script. Yet the evaluation of my objective functions is rather time consuming, therefore I would like to perform a parallel evaluation via
toolbox.register("map",pool.map). As I first step I tried to parallelize the
cma_minfct.py example itself, yet I get the following error:
Process ForkPoolWorker-1:
Traceback (most recent call last):
File "/home/giovi/anaconda3/lib/python3.4/multiprocessing/process.py", line 254, in _bootstrap
self.run()
File "/home/giovi/anaconda3/lib/python3.4/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/home/giovi/anaconda3/lib/python3.4/multiprocessing/pool.py", line 108, in worker
task = get()
File "/home/giovi/anaconda3/lib/python3.4/multiprocessing/queues.py", line 357, in get
return ForkingPickler.loads(res)
AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from '/home/giovi/anaconda3/lib/python3.4/site-packages/deap-1.1.0-py3.4-linux-x86_64.egg/deap/creator.py'>
It is my understanding the workers are unable to see the creator generated with
creator.create("Individual", list, fitness=creator.FitnessMin)
but I really do not understand how to fix the example in order to execute it in a parallel fashion.
Best and thanks for deap
Giovanni