From e52b32f23c0f81b8a162efc7ae73624f61cb3223 Mon Sep 17 00:00:00 2001 From: SimpleArt <71458112+SimpleArt@users.noreply.github.com> Date: Mon, 12 Oct 2020 17:14:24 -0400 Subject: [PATCH] Fixed some errors with the new updates --- src/EasyGA.py | 2 +- src/survivor_selection/survivor_selection_methods.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EasyGA.py b/src/EasyGA.py index 382334d..f11090e 100644 --- a/src/EasyGA.py +++ b/src/EasyGA.py @@ -45,7 +45,7 @@ class GA: self.initialization_impl = Initialization_Methods.random_initialization self.fitness_function_impl = Fitness_Examples.index_dependent_values # Selects which chromosomes should be automaticly moved to the next population - self.survivor_selection_impl = Survivor_Selection.remove_worst + self.survivor_selection_impl = Survivor_Selection.fill_in_best # Methods for accomplishing parent-selection -> Crossover -> Mutation self.parent_selection_impl = Parent_Selection.Tournament.with_replacement self.crossover_impl = Crossover_Methods.single_point_crossover diff --git a/src/survivor_selection/survivor_selection_methods.py b/src/survivor_selection/survivor_selection_methods.py index 99e8daa..dd22e55 100644 --- a/src/survivor_selection/survivor_selection_methods.py +++ b/src/survivor_selection/survivor_selection_methods.py @@ -9,4 +9,4 @@ class Survivor_Selection: def fill_in_best(ga, next_population): """Fills in the next population with the best chromosomes from the last population until the population size is met.""" - return ga.population[:ga.population_size-next_population.size()] + next_population + return Population(ga.population.get_all_chromosomes()[:ga.population.size()-next_population.size()] + next_population.get_all_chromosomes())