Fitness value does not always survive Chromosome.clone()
Brought to you by:
klausikm
It looks to me as if the fitness value is only copied if there is not a Chromosome from the pool.
I checked that this bug still exists in the current distribution.
A patch:
--- src/org/jgap/Chromosome.java (revision 1514)
+++ src/org/jgap/Chromosome.java (working copy)
@@ -376,8 +376,8 @@
else {
copy = new Chromosome(getConfiguration());
}
- copy.setFitnessValue(m_fitnessValue);
}
+ copy.setFitnessValue(m_fitnessValue);
// Clone constraint checker.
// -------------------------
copy.setConstraintChecker(getConstraintChecker());
Thanx for your report and the hint for removing the bug. I will check it and fix the bug til end of the week.
Sorry for the delay. Fixed it according to your patch.