aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/JCGP.java
diff options
context:
space:
mode:
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());
}
}
}