From fe2804bdbcd98a1d743c2cadadd67425079ded95 Mon Sep 17 00:00:00 2001 From: SimpleArt <71458112+SimpleArt@users.noreply.github.com> Date: Mon, 4 Jan 2021 23:01:54 -0500 Subject: [PATCH] Customizable update_population method --- src/EasyGA.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/EasyGA.py b/src/EasyGA.py index dd278c7..6776c4f 100644 --- a/src/EasyGA.py +++ b/src/EasyGA.py @@ -76,7 +76,7 @@ class GA(Attributes): self.parent_selection_impl() self.crossover_population_impl() self.survivor_selection_impl() - self.population.update() + self.update_population() self.sort_by_best_fitness() self.mutation_population_impl() @@ -97,6 +97,12 @@ class GA(Attributes): self.current_generation += 1 + def update_population(self): + """Updates the population to the new population and resets the mating pool and new population.""" + + self.population.update() + + def reset_run(self): """Resets a run by re-initializing the population and modifying counters."""