From aba5da7c066603555d845341482085d8d6794083 Mon Sep 17 00:00:00 2001 From: Daniel Wilczak Date: Mon, 12 Oct 2020 17:07:48 -0400 Subject: [PATCH 1/2] Remove useless folder and file --- src/initialization/gene_creation/gene_random.py | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 src/initialization/gene_creation/gene_random.py diff --git a/src/initialization/gene_creation/gene_random.py b/src/initialization/gene_creation/gene_random.py deleted file mode 100644 index dbcc874..0000000 --- a/src/initialization/gene_creation/gene_random.py +++ /dev/null @@ -1,13 +0,0 @@ -# Imported library -import random - -def check_values(low,high): - #Check to make sure its not less then zero - assert low > 0 , "The random gene low can not be less then zero" - # Check to make sure the high value is not - # lower than or equal to low and not 0. - assert high > low , "High value can not be smaller then low value" - assert high != 0, "High value can not be zero" - -def random_gene(): - return random.randint(1,100) From 80dcb7914481ecec812c87c73d8eaeb3e0ae48ea Mon Sep 17 00:00:00 2001 From: Daniel Wilczak Date: Mon, 12 Oct 2020 17:10:04 -0400 Subject: [PATCH 2/2] Fixed EasyGA to match survior selection method --- src/EasyGA.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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