aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/modules/fitness
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/backend/modules/fitness')
-rw-r--r--src/jcgp/backend/modules/fitness/testcase/TestCaseEvaluator.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/jcgp/backend/modules/fitness/testcase/TestCaseEvaluator.java b/src/jcgp/backend/modules/fitness/testcase/TestCaseEvaluator.java
index 51676e3..4b0654c 100644
--- a/src/jcgp/backend/modules/fitness/testcase/TestCaseEvaluator.java
+++ b/src/jcgp/backend/modules/fitness/testcase/TestCaseEvaluator.java
@@ -1,6 +1,7 @@
package jcgp.backend.modules.fitness.testcase;
import java.util.ArrayList;
+import java.util.Collections;
import jcgp.backend.modules.fitness.FitnessFunction;
import jcgp.backend.population.Population;
@@ -45,7 +46,7 @@ public abstract class TestCaseEvaluator implements FitnessFunction {
}
}
- protected ArrayList<TestCase> testCases;
+ protected ArrayList<TestCase<?>> testCases;
@Override
public void evaluate(Population population, Resources resources) {
@@ -69,7 +70,18 @@ public abstract class TestCaseEvaluator implements FitnessFunction {
}
public int getMaxFitness() {
- return 0;
+ int fitness = 0;
+
+ for (TestCase<?> tc : testCases) {
+ fitness += tc.getOutputs().length;
+ }
+
+ return fitness;
+ }
+
+ public void setTestCases(TestCase<?>... testCases) {
+ this.testCases = new ArrayList<TestCase<?>>();
+ Collections.addAll(this.testCases, testCases);
}
}