aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/modules/fitness
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-08 20:04:12 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-08 20:04:12 +0100
commit260f1baaab10ab9b1db67ab587bc36adcb34494e (patch)
tree408c472a31c3fb26894c02f50803a36b684486bc /src/jcgp/backend/modules/fitness
parent226365bd6a0f56143ffbce7379857ff3e126fbaf (diff)
GUIParameters all refactored and commented.
Diffstat (limited to 'src/jcgp/backend/modules/fitness')
-rw-r--r--src/jcgp/backend/modules/fitness/TestCaseProblem.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jcgp/backend/modules/fitness/TestCaseProblem.java b/src/jcgp/backend/modules/fitness/TestCaseProblem.java
index 4259285..7dd24af 100644
--- a/src/jcgp/backend/modules/fitness/TestCaseProblem.java
+++ b/src/jcgp/backend/modules/fitness/TestCaseProblem.java
@@ -56,7 +56,7 @@ public abstract class TestCaseProblem<U> extends Problem {
maxFitness = new IntegerParameter(0, "Max fitness", true, false) {
@Override
- public void validate(int newValue) {
+ public void validate(Number newValue) {
// blank
}
};
@@ -67,14 +67,14 @@ public abstract class TestCaseProblem<U> extends Problem {
@Override
public void evaluate(Population population, Resources resources) {
// for every chromosome in the population
- for (int i = 0; i < resources.getInt("popSize"); i++) {
+ for (int i = 0; i < resources.populationSize(); i++) {
// assume an initial fitness of 0
int fitness = 0;
// for each test case
for (int t = 0; t < testCases.size(); t++) {
population.getChromosome(i).setInputs(testCases.get(t).getInputs());
// check each output
- for (int o = 0; o < resources.getInt("outputs"); o++) {
+ for (int o = 0; o < resources.outputs(); o++) {
if (population.getChromosome(i).getOutput(o).calculate() == testCases.get(t).getOutput(o)) {
fitness++;
}
@@ -86,7 +86,7 @@ public abstract class TestCaseProblem<U> extends Problem {
}
@Override
- public Parameter[] getLocalParameters() {
+ public Parameter<?>[] getLocalParameters() {
return new Parameter[]{maxFitness};
}