From 1aa314a8051ab5fd921d07d3517d557da31ff5b3 Mon Sep 17 00:00:00 2001 From: SimpleArt <71458112+SimpleArt@users.noreply.github.com> Date: Tue, 1 Dec 2020 19:01:07 -0500 Subject: [PATCH] Cleaner gene reflection method. --- src/mutation/mutation_methods.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mutation/mutation_methods.py b/src/mutation/mutation_methods.py index 1527472..fb3acf0 100644 --- a/src/mutation/mutation_methods.py +++ b/src/mutation/mutation_methods.py @@ -144,7 +144,7 @@ class Mutation_Methods: """Reflects genes against the best chromosome.""" difference = ga.population[0][index].value - chromosome[index].value - value = ga.population[0][index].value + difference * len(chromosome)**2 + value = ga.population[0][index].value + 2*difference chromosome[index] = ga.make_gene(value)