From e7d7e8506a511d78f9e323ac09587f79ad503f42 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Sun, 13 Apr 2014 10:41:25 +0100 Subject: Performance suddenly decreased, looking into why --- src/jcgp/backend/modules/problem/TestCaseProblem.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/jcgp/backend/modules/problem/TestCaseProblem.java') diff --git a/src/jcgp/backend/modules/problem/TestCaseProblem.java b/src/jcgp/backend/modules/problem/TestCaseProblem.java index 68318cf..ee72860 100644 --- a/src/jcgp/backend/modules/problem/TestCaseProblem.java +++ b/src/jcgp/backend/modules/problem/TestCaseProblem.java @@ -52,8 +52,6 @@ public abstract class TestCaseProblem extends Problem { private IntegerParameter maxFitness; private final int inputCount, outputCount; - private U type; - public TestCaseProblem(Resources resources) { super(); @@ -67,12 +65,14 @@ public abstract class TestCaseProblem extends Problem { } }; testCases = FXCollections.observableArrayList(); - //testCases = new ObservableList>(); } @Override public void evaluate(Population population, Resources resources) { + // set fittest to 0, change it whenever a fitter one is found + population.setFittest(0); + // for every chromosome in the population for (int i = 0; i < resources.populationSize(); i++) { // assume an initial fitness of 0 @@ -89,6 +89,9 @@ public abstract class TestCaseProblem extends Problem { } // assign the resulting fitness to the respective individual population.getChromosome(i).setFitness(fitness); + if (fitness >= population.getFittest().getFitness()) { + population.setFittest(i); + } } } @@ -147,10 +150,6 @@ public abstract class TestCaseProblem extends Problem { public int getOutputCount() { return outputCount; } - - public Class getType() { - return type.getClass(); - } } -- cgit v1.2.3