Added save_population

for easier front-end usage.
This commit is contained in:
SimpleArt
2020-11-07 18:21:43 -05:00
parent e1f794d7b7
commit 96767ad03c
2 changed files with 7 additions and 2 deletions

View File

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

View File

@ -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):