From dd294db95255007621897931118623b88274638f Mon Sep 17 00:00:00 2001 From: SimpleArt <71458112+SimpleArt@users.noreply.github.com> Date: Sun, 18 Oct 2020 21:08:54 -0400 Subject: [PATCH] Renamed parent selection subclasses to rank/fitness --- src/attributes.py | 2 +- src/parent_selection/parent_selection_methods.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/attributes.py b/src/attributes.py index b039742..1c6f49b 100644 --- a/src/attributes.py +++ b/src/attributes.py @@ -53,7 +53,7 @@ class attributes: self.make_gene = create_gene # Methods for accomplishing Parent-Selection -> Crossover -> Survivor_Selection -> Mutation - self.parent_selection_impl = Parent_Selection.Tournament.with_replacement + self.parent_selection_impl = Parent_Selection.Rank.tournament self.crossover_individual_impl = Crossover_Methods.Individual.single_point self.crossover_population_impl = Crossover_Methods.Population.random_selection self.survivor_selection_impl = Survivor_Selection.fill_in_best diff --git a/src/parent_selection/parent_selection_methods.py b/src/parent_selection/parent_selection_methods.py index bd17623..8bc272d 100644 --- a/src/parent_selection/parent_selection_methods.py +++ b/src/parent_selection/parent_selection_methods.py @@ -2,9 +2,9 @@ import random class Parent_Selection: - class Tournament: + class Rank: - def with_replacement(ga): + def tournament(ga): """ Will make tournaments of size tournament_size and choose the winner (best fitness) from the tournament and use it as a parent for the next generation The total number of parents selected is determined by parent_ratio, an attribute to the GA object. @@ -46,9 +46,9 @@ class Parent_Selection: break - class Roulette: + class Fitness: - def roulette_selection(ga): + def roulette(ga): """Roulette selection works based off of how strong the fitness is of the chromosomes in the population. The stronger the fitness the higher the probability that it will be selected. Using the example of a casino roulette wheel. @@ -95,7 +95,7 @@ class Parent_Selection: break - def stochastic_selection(ga): + def stochastic(ga): """Stochastic roulette selection works based off of how strong the fitness is of the chromosomes in the population. The stronger the fitness the higher the probability that it will be selected. Instead of dividing the fitness by the sum of all fitnesses