diff --git a/src/attributes.py b/src/attributes.py index 12632a4..417ed17 100644 --- a/src/attributes.py +++ b/src/attributes.py @@ -40,7 +40,7 @@ class attributes: self.current_generation = 0 self.current_fitness = 0 self.generation_goal = 15 - self.fitness_goal = 9 + self.fitness_goal = None # Mutation variables self.mutation_rate = 0.10 @@ -61,7 +61,7 @@ class attributes: self.mutation_population_impl = Mutation_Methods.Population.random_selection # The type of termination to impliment - self.termination_impl = Termination_Methods.generation_based + self.termination_impl = Termination_Methods.fitness_and_generation_based # Getter and setters for all varibles diff --git a/src/termination_point/termination_methods.py b/src/termination_point/termination_methods.py index 9a3beae..15fb823 100644 --- a/src/termination_point/termination_methods.py +++ b/src/termination_point/termination_methods.py @@ -1,7 +1,7 @@ class Termination_Methods: """Example functions that can be used to terminate the the algorithms loop""" - def fitness_based(ga): + def fitness_and_generation_based(ga): """Fitness based approach to terminate when the goal fitness has been reached""" # Need to start the algorithm if the population is None. @@ -17,10 +17,4 @@ class Termination_Methods: return False # Otherwise continue ga. - return True - - - def generation_based(ga): - """Generation based approach to terminate when the goal generation has been reached.""" - return ga.current_generation < ga.generation_goal