From e54824238bba4edbd7447cd05f758b767cfbc00c Mon Sep 17 00:00:00 2001 From: SimpleArt <71458112+SimpleArt@users.noreply.github.com> Date: Fri, 27 Nov 2020 19:13:37 -0500 Subject: [PATCH] Ensure sorted not needed. The problem was not appending old chromosomes to the front of the next population during survivor selection. --- src/mutation/mutation_methods.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/mutation/mutation_methods.py b/src/mutation/mutation_methods.py index f0b4617..82ef0f4 100644 --- a/src/mutation/mutation_methods.py +++ b/src/mutation/mutation_methods.py @@ -35,17 +35,6 @@ def check_gene_mutation_rate(individual_method): return new_method -def ensure_sorted(population_method): - """Sorts the population by fitness before running.""" - - def new_method(ga): - - ga.population.sort_by_best_fitness(ga) - population_method(ga) - - return new_method - - def loop_selections(population_method): """Runs the population method until enough chromosomes are mutated.""" @@ -78,7 +67,6 @@ class Mutation_Methods: # Private method decorators, see above. _check_chromosome_mutation_rate = check_chromosome_mutation_rate _check_gene_mutation_rate = check_gene_mutation_rate - _ensure_sorted = ensure_sorted _loop_selections = loop_selections _loop_mutations = loop_mutations @@ -96,7 +84,6 @@ class Mutation_Methods: @check_chromosome_mutation_rate - @ensure_sorted @loop_selections def random_avoid_best(ga): """Selects random chromosomes while avoiding the best chromosomes. (Elitism)"""