diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-14 18:13:21 +0000 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-02-14 18:13:21 +0000 |
commit | afa484021ba94d12e98da682a9ff69c3837d5dbb (patch) | |
tree | 2150c437cb74ccf141f8cfde228ebf5dd442314a /src/jcgp/fitness | |
parent | 6419b69faeb4736db1ccb50cfa5a030f9aa818aa (diff) |
Generic data type functionality implemented. All tests were refactored to reflect this, and some chromosome tests were rewritten with more rigorous assertions.
Diffstat (limited to 'src/jcgp/fitness')
-rw-r--r-- | src/jcgp/fitness/TestCase.java | 14 | ||||
-rw-r--r-- | src/jcgp/fitness/TruthTableEvaluator.java | 1 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/jcgp/fitness/TestCase.java b/src/jcgp/fitness/TestCase.java index 95129c6..4c10de7 100644 --- a/src/jcgp/fitness/TestCase.java +++ b/src/jcgp/fitness/TestCase.java @@ -4,10 +4,10 @@ import jcgp.Parameters; public class TestCase { - private int[] inputs; - private int[] outputs; + private Object[] inputs; + private Object[] outputs; - public TestCase(int[] inputs, int[] outputs) throws ParameterMismatchException { + public TestCase(Object[] inputs, Object[] outputs) throws ParameterMismatchException { if (inputs.length == Parameters.getInputs()) { this.inputs = inputs; } else { @@ -22,19 +22,19 @@ public class TestCase { } - public int getInput(int index) { + public Object getInput(int index) { return inputs[index]; } - public int getOutput(int index) { + public Object getOutput(int index) { return outputs[index]; } - public int[] getInputs() { + public Object[] getInputs() { return inputs; } - public int[] getOutputs() { + public Object[] getOutputs() { return outputs; } diff --git a/src/jcgp/fitness/TruthTableEvaluator.java b/src/jcgp/fitness/TruthTableEvaluator.java index 987ea4c..4c26d60 100644 --- a/src/jcgp/fitness/TruthTableEvaluator.java +++ b/src/jcgp/fitness/TruthTableEvaluator.java @@ -19,6 +19,7 @@ public class TruthTableEvaluator implements FitnessFunction { } } chromosome.setFitness(fitness); + System.out.println("Fitness: " + fitness); } } } |