aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/JCGP.java
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-13 10:41:25 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-13 10:41:25 +0100
commite7d7e8506a511d78f9e323ac09587f79ad503f42 (patch)
tree8d87a718af29470b5bb8e5dfeb0ce18865f185cb /src/jcgp/JCGP.java
parentdbae5ce2e0765f229e11b692a2aba570286980f4 (diff)
Performance suddenly decreased, looking into why
Diffstat (limited to 'src/jcgp/JCGP.java')
-rw-r--r--src/jcgp/JCGP.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/jcgp/JCGP.java b/src/jcgp/JCGP.java
index 6d881d4..e124dbf 100644
--- a/src/jcgp/JCGP.java
+++ b/src/jcgp/JCGP.java
@@ -158,9 +158,9 @@ public class JCGP {
if (resources.currentGeneration() < resources.generations()) {
// we still have generations left to go
- if (problem.isPerfectSolution(population.getChromosome(evolutionaryStrategy.getFittestChromosome()))) {
+ if (problem.isPerfectSolution(population.getFittest())) {
// solution has been found, start next run
- resources.println("[CGP] Solution found, generation " + resources.currentGeneration() + ", chromosome " + evolutionaryStrategy.getFittestChromosome());
+ resources.println("[CGP] Solution found, generation " + resources.currentGeneration() + ", chromosome " + population.getFittestIndex());
if (resources.currentRun() < resources.runs()) {
// there are still runs left
@@ -179,8 +179,8 @@ public class JCGP {
} else {
// the run has ended, check if any more runs must be done
resources.println("[CGP] Solution not found, highest fitness achieved was "
- + population.getChromosome(evolutionaryStrategy.getFittestChromosome()).getFitness()
- + " by chromosome " + evolutionaryStrategy.getFittestChromosome());
+ + population.getFittest().getFitness()
+ + " by chromosome " + population.getFittestIndex());
if (resources.currentRun() < resources.runs()) {
// the run has ended but there are still runs left
@@ -188,7 +188,7 @@ public class JCGP {
resources.setCurrentGeneration(0);
// start a new population
- population.reinitialise();;
+ population.reinitialise();
} else {
// no more generations and no more runs, we're done
finished = true;
@@ -203,7 +203,7 @@ public class JCGP {
private void report() {
if (resources.report() > 0) {
if (resources.currentGeneration() % resources.report() == 0) {
- resources.println("[CGP] Generation: " + resources.currentGeneration() + ", fitness: " + population.getChromosome(evolutionaryStrategy.getFittestChromosome()).getFitness());
+ resources.println("[CGP] Generation: " + resources.currentGeneration() + ", fitness: " + population.getFittest().getFitness());
}
}
}