aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/modules/problem
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-13 10:41:25 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-13 10:41:25 +0100
commite7d7e8506a511d78f9e323ac09587f79ad503f42 (patch)
tree8d87a718af29470b5bb8e5dfeb0ce18865f185cb /src/jcgp/backend/modules/problem
parentdbae5ce2e0765f229e11b692a2aba570286980f4 (diff)
Performance suddenly decreased, looking into why
Diffstat (limited to 'src/jcgp/backend/modules/problem')
-rw-r--r--src/jcgp/backend/modules/problem/TestCaseProblem.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/jcgp/backend/modules/problem/TestCaseProblem.java b/src/jcgp/backend/modules/problem/TestCaseProblem.java
index 68318cf..ee72860 100644
--- a/src/jcgp/backend/modules/problem/TestCaseProblem.java
+++ b/src/jcgp/backend/modules/problem/TestCaseProblem.java
@@ -52,8 +52,6 @@ public abstract class TestCaseProblem<U extends Object> extends Problem {
private IntegerParameter maxFitness;
private final int inputCount, outputCount;
- private U type;
-
public TestCaseProblem(Resources resources) {
super();
@@ -67,12 +65,14 @@ public abstract class TestCaseProblem<U extends Object> extends Problem {
}
};
testCases = FXCollections.observableArrayList();
- //testCases = new ObservableList<TestCase<U>>();
}
@Override
public void evaluate(Population population, Resources resources) {
+ // set fittest to 0, change it whenever a fitter one is found
+ population.setFittest(0);
+
// for every chromosome in the population
for (int i = 0; i < resources.populationSize(); i++) {
// assume an initial fitness of 0
@@ -89,6 +89,9 @@ public abstract class TestCaseProblem<U extends Object> extends Problem {
}
// assign the resulting fitness to the respective individual
population.getChromosome(i).setFitness(fitness);
+ if (fitness >= population.getFittest().getFitness()) {
+ population.setFittest(i);
+ }
}
}
@@ -147,10 +150,6 @@ public abstract class TestCaseProblem<U extends Object> extends Problem {
public int getOutputCount() {
return outputCount;
}
-
- public Class<?> getType() {
- return type.getClass();
- }
}