Renamed termination method
This commit is contained in:
@ -63,7 +63,7 @@ class Attributes:
|
|||||||
survivor_selection_impl = Survivor_Selection.fill_in_best,
|
survivor_selection_impl = Survivor_Selection.fill_in_best,
|
||||||
mutation_individual_impl = Mutation_Methods.Individual.single_gene,
|
mutation_individual_impl = Mutation_Methods.Individual.single_gene,
|
||||||
mutation_population_impl = Mutation_Methods.Population.random_selection,
|
mutation_population_impl = Mutation_Methods.Population.random_selection,
|
||||||
termination_impl = Termination_Methods.fitness_and_generation_based,
|
termination_impl = Termination_Methods.fitness_generation_tolerance,
|
||||||
Database = sql_database.SQL_Database,
|
Database = sql_database.SQL_Database,
|
||||||
database_name = 'database.db',
|
database_name = 'database.db',
|
||||||
sql_create_data_structure = """CREATE TABLE IF NOT EXISTS data (
|
sql_create_data_structure = """CREATE TABLE IF NOT EXISTS data (
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
class Termination_Methods:
|
class Termination_Methods:
|
||||||
"""Example functions that can be used to terminate the the algorithms loop"""
|
"""Example functions that can be used to terminate the the algorithms loop"""
|
||||||
|
|
||||||
def fitness_and_generation_based(ga):
|
def fitness_generation_tolerance(ga):
|
||||||
"""Fitness based approach to terminate when the goal fitness has been reached"""
|
"""Terminate GA when any of the
|
||||||
|
- fitness,
|
||||||
|
- generation, or
|
||||||
|
- tolerance
|
||||||
|
goals are met."""
|
||||||
|
|
||||||
# Need to start the algorithm if the population is None.
|
# Need to start the algorithm if the population is None.
|
||||||
if ga.population == None:
|
if ga.population == None:
|
||||||
|
|||||||
Reference in New Issue
Block a user