Function to evolve the population with multiprocessing approach.
Using pathos to be able to include class-owned functions.
This function will create a pool with <self.grid_options["amt_cores"]> processes, and perform an imap_unordered to run the different `threads`.
Before this was done by giving a generator as the iterable, and have the processes get a certain chunksize each round.
Later on this seemed to be a bad decision, because it is difficult to pass information back to the main controller, and because with each new batch of systems a new object instance was created.
What I do now is I spawn these X amount of processes, and pass a range(self.grid_options["amt_cores"]) as iterable.
In that way, only once do they fetch a `job`, but that job is just a ID number.
With this ID number each thread/process loops over the whole generator,
but only runs the one <ID>'th system (if (localcounter+ID) % self.grid_options["amt_cores"]==0)'
When they are finished, these jobs are instructed to return a set of information (the result dict, TODO: describe what more)
These resultation dictionaries are then merged and stored as object properties again.
"""
# TODO: make further use of a queue to handle jobs or at least
...
...
@@ -685,43 +764,68 @@ class Population:
# TODO: make good example of how to deal with a result_dict