aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/modules/ea
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-06 21:58:53 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-06 21:58:53 +0100
commite6dd7711c7dad5e000445208eb5845801f4ccffc (patch)
tree1454bd20a8dd7069b1283184c42f4def6d5f7e6f /src/jcgp/backend/modules/ea
parentc7969623b44f375e30fa3f15dcd7581609276a0f (diff)
About to make big changes to the way fitness works, committing just in case
Diffstat (limited to 'src/jcgp/backend/modules/ea')
-rw-r--r--src/jcgp/backend/modules/ea/EvolutionaryAlgorithm.java2
-rw-r--r--src/jcgp/backend/modules/ea/MuPlusLambda.java20
-rw-r--r--src/jcgp/backend/modules/ea/TournamentSelection.java12
3 files changed, 11 insertions, 23 deletions
diff --git a/src/jcgp/backend/modules/ea/EvolutionaryAlgorithm.java b/src/jcgp/backend/modules/ea/EvolutionaryAlgorithm.java
index 7719111..3aca104 100644
--- a/src/jcgp/backend/modules/ea/EvolutionaryAlgorithm.java
+++ b/src/jcgp/backend/modules/ea/EvolutionaryAlgorithm.java
@@ -1,9 +1,9 @@
package jcgp.backend.modules.ea;
-import jcgp.JCGP.Resources;
import jcgp.backend.modules.Module;
import jcgp.backend.modules.mutator.Mutator;
import jcgp.backend.population.Population;
+import jcgp.backend.resources.Resources;
public interface EvolutionaryAlgorithm extends Module {
diff --git a/src/jcgp/backend/modules/ea/MuPlusLambda.java b/src/jcgp/backend/modules/ea/MuPlusLambda.java
index ad8c5d8..0d16111 100644
--- a/src/jcgp/backend/modules/ea/MuPlusLambda.java
+++ b/src/jcgp/backend/modules/ea/MuPlusLambda.java
@@ -1,13 +1,12 @@
package jcgp.backend.modules.ea;
-import jcgp.JCGP.Resources;
-import jcgp.backend.modules.ModuleStatus;
import jcgp.backend.modules.mutator.Mutator;
-import jcgp.backend.parameters.BooleanParameter;
-import jcgp.backend.parameters.IntegerParameter;
-import jcgp.backend.parameters.Parameter;
-import jcgp.backend.parameters.ParameterStatus;
import jcgp.backend.population.Population;
+import jcgp.backend.resources.Resources;
+import jcgp.backend.resources.parameters.BooleanParameter;
+import jcgp.backend.resources.parameters.IntegerParameter;
+import jcgp.backend.resources.parameters.Parameter;
+import jcgp.backend.resources.parameters.ParameterStatus;
/**
* (μ + λ) EA.
@@ -62,8 +61,7 @@ public class MuPlusLambda implements EvolutionaryAlgorithm {
@Override
public void evolve(Population population, Mutator mutator, Resources resources) {
- // TODO actually use parents and offspring
- // select fittest chromosome
+ // select fittest chromosomes
fittestChromosome = 0;
for (int i = 1; i < resources.getInt("popSize"); i++) {
@@ -79,6 +77,7 @@ public class MuPlusLambda implements EvolutionaryAlgorithm {
mutator.mutate(population.getChromosome(i), resources);
}
}
+
}
@Override
@@ -95,10 +94,5 @@ public class MuPlusLambda implements EvolutionaryAlgorithm {
public String toString() {
return "(μ + λ)";
}
-
- @Override
- public ModuleStatus getStatus(Resources resources) {
- return ModuleStatus.READY;
- }
}
diff --git a/src/jcgp/backend/modules/ea/TournamentSelection.java b/src/jcgp/backend/modules/ea/TournamentSelection.java
index 32ac54d..baf6704 100644
--- a/src/jcgp/backend/modules/ea/TournamentSelection.java
+++ b/src/jcgp/backend/modules/ea/TournamentSelection.java
@@ -2,12 +2,11 @@ package jcgp.backend.modules.ea;
import java.util.HashMap;
-import jcgp.JCGP.Resources;
-import jcgp.backend.modules.ModuleStatus;
import jcgp.backend.modules.mutator.Mutator;
-import jcgp.backend.parameters.IntegerParameter;
-import jcgp.backend.parameters.Parameter;
import jcgp.backend.population.Population;
+import jcgp.backend.resources.Resources;
+import jcgp.backend.resources.parameters.IntegerParameter;
+import jcgp.backend.resources.parameters.Parameter;
public class TournamentSelection implements EvolutionaryAlgorithm {
@@ -51,9 +50,4 @@ public class TournamentSelection implements EvolutionaryAlgorithm {
public String toString() {
return "Tournament";
}
-
- @Override
- public ModuleStatus getStatus(Resources resources) {
- return null;
- }
}