Requested file name changes
This commit is contained in:
@ -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
|
||||
|
||||
16
src/termination_point/examples.py
Normal file
16
src/termination_point/examples.py
Normal 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
|
||||
@ -1,5 +0,0 @@
|
||||
def fitness_based(ga):
|
||||
status = True
|
||||
if(ga.current_fitness > ga.goal_fitness):
|
||||
status = False
|
||||
return status
|
||||
@ -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
|
||||
0
src/termination_point/test_examples.py
Normal file
0
src/termination_point/test_examples.py
Normal file
Reference in New Issue
Block a user