#46 PrototypeProgram gets always overwritten by GPPopulation

next JGAP version
closed-fixed
Klaus
5
2007-10-01
2007-07-30
kelsaka
No

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);
}

Discussion

  • Klaus
    Klaus
    2007-07-30

    • labels: --> coding error
    • milestone: --> next JGAP version
    • assigned_to: nobody --> klausikm
    • status: open --> open-fixed
     
  • Klaus
    Klaus
    2007-07-30

    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!

     
  • Klaus
    Klaus
    2007-10-01

    Logged In: YES
    user_id=722855
    Originator: NO

    done.

     
  • Klaus
    Klaus
    2007-10-01

    • status: open-fixed --> closed-fixed