aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/ea/StandardEA.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/ea/StandardEA.java')
-rw-r--r--src/jcgp/ea/StandardEA.java47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/jcgp/ea/StandardEA.java b/src/jcgp/ea/StandardEA.java
deleted file mode 100644
index 5f38513..0000000
--- a/src/jcgp/ea/StandardEA.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package jcgp.ea;
-
-import jcgp.Parameters;
-import jcgp.population.Chromosome;
-import jcgp.population.Population;
-
-/**
- * (1 + λ) EA.
- *
- *
- * @author Eduardo Pedroni
- *
- */
-public class StandardEA implements EvolutionaryAlgorithm {
-
- private Chromosome fittestChromosome;
-
- @Override
- public void evolve(Population population, Mutator mutator) {
- // select fittest chromosome
- int fittest = 0;
-
- for (int i = 1; i < Parameters.getPopulationSize(); i++) {
- if (population.getChromosome(i).getFitness() >= population.getChromosome(fittest).getFitness()) {
- fittest = i;
- }
- }
- fittestChromosome = population.getChromosome(fittest);
- population.setBestIndividual(fittest);
- if (Parameters.getDebug()) {
- System.out.println("Best fitness: " + fittestChromosome.getFitness());
- }
- // create copies of fittest chromosome, mutate them
- Chromosome fc = population.getChromosome(fittest);
- for (int i = 0; i < Parameters.getPopulationSize(); i++) {
- if (i != fittest) {
- population.getChromosome(i).copyConnections(fc);
- mutator.mutate(population.getChromosome(i));
- }
- }
- }
-
- @Override
- public Chromosome getFittestChromosome() {
- return fittestChromosome;
- }
-}