aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/modules/fitness/TestCaseEvaluator.java
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/fitness/TestCaseEvaluator.java
parentc7969623b44f375e30fa3f15dcd7581609276a0f (diff)
About to make big changes to the way fitness works, committing just in case
Diffstat (limited to 'src/jcgp/backend/modules/fitness/TestCaseEvaluator.java')
-rw-r--r--src/jcgp/backend/modules/fitness/TestCaseEvaluator.java43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/jcgp/backend/modules/fitness/TestCaseEvaluator.java b/src/jcgp/backend/modules/fitness/TestCaseEvaluator.java
deleted file mode 100644
index 5ff6973..0000000
--- a/src/jcgp/backend/modules/fitness/TestCaseEvaluator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package jcgp.backend.modules.fitness;
-
-import jcgp.JCGP.Resources;
-import jcgp.backend.modules.ModuleStatus;
-import jcgp.backend.parameters.Parameter;
-import jcgp.backend.population.Population;
-
-public class TestCaseEvaluator implements FitnessFunction {
-
- @Override
- public void evaluate(Population population, Resources resources) {
- // for every chromosome in the population
- for (int i = 0; i < resources.getInt("popSize"); i++) {
- int fitness = 0;
- // for every test case
- for (int t = 0; t < resources.getTestCaseCount(); t++) {
- population.getChromosome(i).setInputs(resources.getTestCase(t).getInputs());
- // check every output
- for (int o = 0; o < resources.getInt("outputs"); o++) {
- if (population.getChromosome(i).getOutput(o).calculate() == resources.getTestCase(t).getOutput(o)) {
- fitness++;
- }
- }
- }
- population.getChromosome(i).setFitness(fitness);
- }
- }
-
- @Override
- public Parameter[] getLocalParameters() {
- return null;
- }
-
- @Override
- public String toString() {
- return "Test case";
- }
-
- @Override
- public ModuleStatus getStatus(Resources resources) {
- return null;
- }
-}