Suggestion:
I created a GA with pygad where the fitness function needs a lot of time to calculate (several minutes per fitness calculation). When I am manually stopping it by hitting Ctrl+C I let the code continue and save the current state with ga_instance.save("file"). When I start another run I load the last state with ga_instance.load("file") and call ga_instance.run() to continue with the current population. It would be neat to be able to continue the calculations without loosing ga_instance.solutions etc., so when I call plot_fitness() my old data is still there. Currently with ga_instance.run() everything gets reset to [].
Sample Code:
try:
ga_instance = pygad.load("file")
ga_instance.continue()
except FileNotFoundError:
ga_instance = pygad.GA([...])
ga_instance.run()
ga_instance.save("file")
ga_instance.plot_fitness()
Suggestion:
I created a GA with pygad where the fitness function needs a lot of time to calculate (several minutes per fitness calculation). When I am manually stopping it by hitting Ctrl+C I let the code continue and save the current state with
ga_instance.save("file"). When I start another run I load the last state withga_instance.load("file")and callga_instance.run()to continue with the current population. It would be neat to be able to continue the calculations without loosingga_instance.solutionsetc., so when I callplot_fitness()my old data is still there. Currently withga_instance.run()everything gets reset to[].Sample Code: