Files
EasyGA/src/termination_point/examples.py
danielwilczak101 42f49c43ee Fixed names
2020-09-30 23:39:14 -04:00

17 lines
601 B
Python

class termination_examples:
"""Example functions that can be used to terminate the the algorithms loop"""
def fitness_based(ga):
"""Fitness based approach to terminate when the goal fitness has been reached"""
status = True
if(ga.current_fitness > ga.fitness_goal):
status = False
return status
def generation_based(ga):
"""Generation based approach to terminate when the goal generation has been reached"""
status = True
if(ga.current_generation > ga.generation_goal):
status = False
return status