-
-
Couldn't load subscription status.
- Fork 490
Description
I was checking my CPU usage while running a GA instance with adaptive mutation and noticed it's actually off most of the time. The fitness function I use takes several seconds to compute for every solution, so the lack of parallel processing on this type of mutation really hurts the overall time per generation.
I had a look at the code and expected a simple copy-paste with some minor updates to enable parallel processing in the mutation, but the architecture of the package (i.e. pygad.GA is a child class of pygad.utils.Mutation) makes it difficult for the Mutation methods to know if parallel processing is enabled without passing additional parameters. What might work is to add an __init__ method to Mutation and calling this method from GA.__init__. The parallel processing setup could be moved to Mutation, which is then inherited by GA. I don't think this is the cleanest solution in terms of OOP best practices, but it would work.
I might be able to put some time into creating a PR for this sometime soon.