Caught bug if population is None

This commit is contained in:
SimpleArt
2020-12-01 18:17:33 -05:00
parent 62ecfc38fa
commit 8579565bb6

View File

@ -4,7 +4,7 @@ def add_by_fitness_goal(termination_impl):
def new_method(ga): def new_method(ga):
# If fitness goal is set, check it. # If fitness goal is set, check it.
if ga.fitness_goal is not None: if ga.fitness_goal is not None and ga.population is not None:
# If minimum fitness goal reached, stop ga. # If minimum fitness goal reached, stop ga.
if ga.target_fitness_type == 'min' and ga.population[0].fitness <= ga.fitness_goal: if ga.target_fitness_type == 'min' and ga.population[0].fitness <= ga.fitness_goal: