Avoid overwriting initial population

This commit is contained in:
SimpleArt
2020-11-19 16:48:02 -05:00
parent 1bd806591e
commit 454edb13d1

View File

@ -46,15 +46,19 @@ class GA(Attributes):
cond3 = lambda: cond2() or self.active() # check termination conditions.
while cond1() and cond3():
# If its the first generation
if self.current_generation == 0:
# Create the database here to allow the user to change
# the database name and structure before running the function.
# Create the database here to allow the user to change the
# database name and structure before running the function.
self.database.create_all_tables(self)
# Add the current configuration to the config table
self.database.insert_config(self)
# Create the initial population
if self.population is None:
self.initialize_population()
# Otherwise evolve the population