usage of new "save_solutions" option #57
rengel8
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Usage of new "save_solutions" option
I'm saving the solutions with save_solutions=True and adjusted the fitness-calculation so that only former unseen, thus new solutions will be executed ( ~ a second each). It is then possible to save much time..
My GA has 20 genes and I did run with stop_criteria='saturate_20'
Modus 1
mutation_percent_genes=20
random_mutation_max_val=5
Modus 2
mutation_percent_genes=50
random_mutation_max_val=10
Speed-Factor:
Since num_parents_mating=200 is half as high as sol_per_pop=400, I suppose that 50% of all 400 solutions per generation are known, thus not recalculated, which results in the doubled speed. Theoretically this increases further, if solutions from generations long ago are "seen" again.
Conclusion:
The saving-feature is available in PyGAD > 2.16.0 and it is great that there are plans of implementing a feature to neglect the redundant calculation of already calculated fitness results for known solutions. Each time the fitness calculation takes more time than just a few ms (in my example around a second), this approach obviously does make sense.
One can access the data via:
Beyond the saving of solutions + their fitness, the described functionality has been added independantly from PyGAD. But, as this example does show, it makes sense in certain use cases, to NOT recalculate the fitness for known solutions again and again.
Beta Was this translation helpful? Give feedback.
All reactions