aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/modules/fitness
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/modules/fitness')
-rw-r--r--src/jcgp/modules/fitness/FitnessFunction.java11
-rw-r--r--src/jcgp/modules/fitness/TestCase.java29
-rw-r--r--src/jcgp/modules/fitness/TestCaseEvaluator.java45
3 files changed, 0 insertions, 85 deletions
diff --git a/src/jcgp/modules/fitness/FitnessFunction.java b/src/jcgp/modules/fitness/FitnessFunction.java
deleted file mode 100644
index f0800b0..0000000
--- a/src/jcgp/modules/fitness/FitnessFunction.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package jcgp.modules.fitness;
-
-import jcgp.JCGP.Resources;
-import jcgp.modules.Module;
-import jcgp.population.Population;
-
-public interface FitnessFunction extends Module {
-
- public void evaluate(Population population, Resources resources);
-
-}
diff --git a/src/jcgp/modules/fitness/TestCase.java b/src/jcgp/modules/fitness/TestCase.java
deleted file mode 100644
index 081a257..0000000
--- a/src/jcgp/modules/fitness/TestCase.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package jcgp.modules.fitness;
-
-public class TestCase {
-
- private Object[] inputs;
- private Object[] outputs;
-
- public TestCase(Object[] inputs, Object[] outputs) {
- this.inputs = inputs;
- this.outputs = outputs;
- }
-
- public Object getInput(int index) {
- return inputs[index];
- }
-
- public Object getOutput(int index) {
- return outputs[index];
- }
-
- public Object[] getInputs() {
- return inputs;
- }
-
- public Object[] getOutputs() {
- return outputs;
- }
-
-}
diff --git a/src/jcgp/modules/fitness/TestCaseEvaluator.java b/src/jcgp/modules/fitness/TestCaseEvaluator.java
deleted file mode 100644
index d8c1255..0000000
--- a/src/jcgp/modules/fitness/TestCaseEvaluator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package jcgp.modules.fitness;
-
-import java.util.HashMap;
-
-import jcgp.JCGP.Resources;
-import jcgp.modules.ModuleStatus;
-import jcgp.parameters.Parameter;
-import jcgp.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 HashMap<String, Parameter> getLocalParameters() {
- return null;
- }
-
- @Override
- public String toString() {
- return "Test case";
- }
-
- @Override
- public ModuleStatus getStatus(Resources resources) {
- return null;
- }
-}