Skip to content
Snippets Groups Projects
Commit 9b225108 authored by Lennart Eichhorn's avatar Lennart Eichhorn
Browse files

Renamed mutation method in Mutator.

parent 779685af
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ import MainClasses.Candidate; ...@@ -5,7 +5,7 @@ import MainClasses.Candidate;
public interface Mutator { public interface Mutator {
Candidate[] mutatePopulation(Candidate[] population); Candidate[] generateMutatedPopulation(Candidate[] population);
//TODO Remove, when decided on FRL vs NESW //TODO Remove, when decided on FRL vs NESW
static <T extends Enum<?>> boolean isFRLEncoding(Class<T> possibleDirections) { static <T extends Enum<?>> boolean isFRLEncoding(Class<T> possibleDirections) {
......
...@@ -130,7 +130,7 @@ public class GeneticAlgorithm { ...@@ -130,7 +130,7 @@ public class GeneticAlgorithm {
this.population = this.selector.selectNewPopulation(this.population, this.fitness, this.totalFitness); this.population = this.selector.selectNewPopulation(this.population, this.fitness, this.totalFitness);
for (Mutator m : mutators) { // SinglePoint and Crossover at the moment for (Mutator m : mutators) { // SinglePoint and Crossover at the moment
this.population = m.mutatePopulation(this.population); this.population = m.generateMutatedPopulation(this.population);
} }
System.out.println(); System.out.println();
......
...@@ -27,7 +27,7 @@ public class Crossover<T extends Enum<?>> implements Mutator { ...@@ -27,7 +27,7 @@ public class Crossover<T extends Enum<?>> implements Mutator {
} }
@Override @Override
public Candidate[] mutatePopulation(Candidate[] population) { public Candidate[] generateMutatedPopulation(Candidate[] population) {
Candidate[] mutatedPopulation = new Candidate[population.length]; Candidate[] mutatedPopulation = new Candidate[population.length];
if (this.crossoverChance > crossoverMinimalChance) { if (this.crossoverChance > crossoverMinimalChance) {
int populationSize = population.length; int populationSize = population.length;
......
...@@ -27,7 +27,7 @@ public class SinglePoint<T extends Enum<?>> implements Mutator { ...@@ -27,7 +27,7 @@ public class SinglePoint<T extends Enum<?>> implements Mutator {
} }
@Override @Override
public Candidate[] mutatePopulation(Candidate[] population) { public Candidate[] generateMutatedPopulation(Candidate[] population) {
Candidate[] mutatedPopulation = new Candidate[population.length]; Candidate[] mutatedPopulation = new Candidate[population.length];
if (this.mutationChance > mutationMinimalChance) { if (this.mutationChance > mutationMinimalChance) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment