Requested file name changes

This commit is contained in:
danielwilczak101
2020-09-30 23:25:44 -04:00
parent 8377650c58
commit aa0c5320c8
23 changed files with 96 additions and 72 deletions

View File

@ -1,3 +1,2 @@
# FROM (. means local) file_name IMPORT function_name
from .generation_based import generation_based
from .fitness_based import fitness_based
# FROM (. means local) file_name IMPORT class name
from .examples import termination_examples

View File

@ -0,0 +1,16 @@
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.goal_fitness):
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.max_generations):
status = False
return status

View File

@ -1,5 +0,0 @@
def fitness_based(ga):
status = True
if(ga.current_fitness > ga.goal_fitness):
status = False
return status

View File

@ -1,7 +0,0 @@
def generation_based(ga):
"""Generation based approach to termination - If the current generation is
less then the """
status = True
if(ga.current_generation > ga.max_generations):
status = False
return status

View File