diff --git a/src/crossover/crossover_methods.py b/src/crossover/crossover_methods.py index 48c1cf7..2f2c7a5 100644 --- a/src/crossover/crossover_methods.py +++ b/src/crossover/crossover_methods.py @@ -1,6 +1,6 @@ import random -def append_children_from_mating_pool(crossover_method): +def append_children_to_next_population(crossover_method): """Appends the new chromosomes to the next population.""" return lambda ga:\ ga.population.append_children( @@ -29,11 +29,11 @@ def values_to_genes(crossover_method): class Crossover_Methods: # Private method decorators, see above. - def __append_children_from_mating_pool(crossover_method): - return append_children_from_mating_pool(crossover_method) - def __genes_to_chromosome(crossover_method): + def _append_children_to_next_population(crossover_method): + return append_children_to_next_population(crossover_method) + def _genes_to_chromosome(crossover_method): return values_to_chromosome(crossover_method) - def __values_to_genes(crossover_method): + def _values_to_genes(crossover_method): return values_to_genes(crossover_method) diff --git a/src/initialization/initialization_methods.py b/src/initialization/initialization_methods.py index 242eb69..edb7a7f 100644 --- a/src/initialization/initialization_methods.py +++ b/src/initialization/initialization_methods.py @@ -22,11 +22,11 @@ class Initialization_Methods: """Initialization examples that are used as defaults and examples""" # Private method decorators, see above. - def __chromosomes_to_population(initialize): + def _chromosomes_to_population(initialize): return chromosomes_to_population(initialize) - def __genes_to_chromosome(initialize): + def _genes_to_chromosome(initialize): return genes_to_chromosome(initialize) - def __value_to_gene(initialize): + def _value_to_gene(initialize): return value_to_gene(initialize) diff --git a/src/mutation/mutation_methods.py b/src/mutation/mutation_methods.py index f39518f..f399acc 100644 --- a/src/mutation/mutation_methods.py +++ b/src/mutation/mutation_methods.py @@ -25,9 +25,9 @@ def loop_mutations(mutation_method): class Mutation_Methods: # Private method decorators, see above. - def __loop_selections(selection_method): + def _loop_selections(selection_method): return loop_selections(selection_method) - def __loop_mutations(mutation_method): + def _loop_mutations(mutation_method): return loop_mutations(mutation_method) diff --git a/src/parent_selection/parent_selection_methods.py b/src/parent_selection/parent_selection_methods.py index 0785228..87ac82e 100644 --- a/src/parent_selection/parent_selection_methods.py +++ b/src/parent_selection/parent_selection_methods.py @@ -9,7 +9,7 @@ def check_selection_probability(selection_method): if 0 < ga.selection_probability < 1: selection_method(ga) else: - raise Exception("Selection probability must be greater than 0 to select parents.") + raise Exception("Selection probability must be between 0 and 1 to select parents.") return helper @@ -39,11 +39,11 @@ def ensure_sorted(selection_method): class Parent_Selection: # Private method decorators, see above. - def __check_selection_probability(selection_method): + def _check_selection_probability(selection_method): return check_selection_probability(selection_method) - def __check_positive_fitness(selection_method): + def _check_positive_fitness(selection_method): return check_positive_fitness(selection_method) - def __ensure_sorted(selection_method): + def _ensure_sorted(selection_method): return ensure_sorted(selection_method) diff --git a/src/survivor_selection/survivor_selection_methods.py b/src/survivor_selection/survivor_selection_methods.py index 80c396d..0b8d057 100644 --- a/src/survivor_selection/survivor_selection_methods.py +++ b/src/survivor_selection/survivor_selection_methods.py @@ -9,7 +9,7 @@ class Survivor_Selection: """Survivor selection determines which individuals should be brought to the next generation""" # Private method decorator, see above. - def __append_to_next_population(survivor_method): + def _append_to_next_population(survivor_method): return append_to_next_population(survivor_method) diff --git a/src/termination_point/termination_methods.py b/src/termination_point/termination_methods.py index c6f64e9..4c2a999 100644 --- a/src/termination_point/termination_methods.py +++ b/src/termination_point/termination_methods.py @@ -57,11 +57,11 @@ class Termination_Methods: """Example functions that can be used to terminate the the algorithms loop""" # Private method decorators, see above. - def __add_by_fitness_goal(termination_impl): + def _add_by_fitness_goal(termination_impl): return add_by_fitness_goal(termination_impl) - def __add_by_generation_goal(termination_impl): + def _add_by_generation_goal(termination_impl): return add_by_generation_goal(termination_impl) - def __add_by_tolerance_goal(termination_impl): + def _add_by_tolerance_goal(termination_impl): return add_by_tolerance_goal(termination_impl)