PrototypeProgram gets always overwritten by GPPopulation
Brought to you by:
klausikm
GP Programming does not respect a PrototypeProgram configured with a GPConfiguration.
In org.jgap.gp.impl.GPPopulation: void create(..) line 195 it is checked for
if (i == 0) {
getGPConfiguration().setPrototypeProgram(program);
}
as the enclosing loop always starts with i:=0, an initially set prototype program gets overwritten, before a fitness check is applied to the prototype program in the following else if branch. Thus, the "real" prototype is probably never used.
I suppose in line 195 there should better be an additional check for null before overwriting the prototype:
if (i == 0 && getGPConfiguration().getPrototypeProgram() == null) {
getGPConfiguration().setPrototypeProgram(program);
}
Logged In: YES
user_id=722855
Originator: NO
You are right! I fixed the bug according to your suggestion. A test case revealing the bug will follow. Thanx!
Logged In: YES
user_id=722855
Originator: NO
done.