Skip to content

ga_instance.continue() after pygad.load() #123

Closed
@FeBe95

Description

@FeBe95

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions