diff --git a/src/EasyGA.py b/src/EasyGA.py index 72d331f..81661a3 100644 --- a/src/EasyGA.py +++ b/src/EasyGA.py @@ -68,7 +68,7 @@ class GA(Attributes): self.population.sort_by_best_fitness(self) # Save the population to the database - self.database.insert_current_population(self) + self.save_population() number_of_generations -= 1 self.current_generation += 1 @@ -76,7 +76,7 @@ class GA(Attributes): def evolve(self): """Runs the ga until the termination point has been satisfied.""" - while(self.active()): + while self.active(): self.evolve_generation() diff --git a/src/attributes.py b/src/attributes.py index c934468..1cbd0c2 100644 --- a/src/attributes.py +++ b/src/attributes.py @@ -125,6 +125,11 @@ class Attributes: self.graph = Graph(self.database) + def save_population(self): + """Saves the current population to the database.""" + self.database.insert_current_population(self) + + # Getter and setters for all required varibles @property def chromosome_length(self):