I wrote an algorithm with DEAP and now wish to wrap it up inside an app with PyQt. I set up and registered all my evolutionary operators in my controller module and then tried to run the algorithm from my GUI however I noticed that when I pass the toolbox the multiprocessing pool sort of disappears from the toolbox and I can't use it inside my algorithm module. I declared my pool inside the main guard in the controller like so:
if __name__ == '__main__':
pool = multiprocessing.Pool()
toolbox.register("map", pool.map)
main()
And have my toolbox as a global variable in the controller module too. When a button is clicked I pass the toolbox to the function inside my algorithm's module and that's where I seem to lose the reference to the pool?
I tried setting up the pool once my algorithm's start function is called but then I get a picklable error saying the class is not the same as the object. Is there a way to launch a pool from another module and pass it to another? Or is there another way of achieving my desired effect?
Thank you.