Menu

#20 m_fittestChromosome

next JGAP version
closed-fixed
Klaus
9
2006-02-03
2006-02-02
Fanguad
No

if determineFittestChromosome() and
determineFittestChromosomes(int) calls are intermixed,
results are not consistent.

This problem is caused by the use of the single
variable m_changed to monitor the dirty state of both
variables.

Proposed fix attached. Changes made to
determineFittestChromosome and determineFittestChromosomes

JUnit test also attached.

Discussion

  • Fanguad

    Fanguad - 2006-02-02

    Population.java

     
  • Fanguad

    Fanguad - 2006-02-02

    Logged In: YES
    user_id=717728

    uploading test cases

     
  • Fanguad

    Fanguad - 2006-02-02

    JGAP_TestCase2.java

     
  • Klaus

    Klaus - 2006-02-03

    Logged In: YES
    user_id=722855

    The problem was with the caching (m_changed). While
    testing, I discovered that another state, namely "is
    sorted" (m_sorted) needs to be introduced, which I did.
    I would like to keep the current implementation (with
    caching) instead of using what you proposed (although your
    solution is easier to follow, but less performant).

    Great that you included a test case. I added it to
    PopulationTest (with slight modifications to optimize its
    execution time and by using the StaticFitnessFunction).

    Is it correct that your chage to method
    determineFittestChromosomes was the replacement
    of "numberOfChromosomes" with "a_numberOfChromosomes" at
    two places? I think this would lead to an
    ArrayOutfBoundsException as you already mentioned in an
    earlier bug. I couldn't see any other change to that method.

     
  • Klaus

    Klaus - 2006-02-03
    • labels: --> coding error
    • milestone: --> next JGAP version
    • priority: 5 --> 9
    • assigned_to: nobody --> klausikm
    • status: open --> open-fixed
     
  • Fanguad

    Fanguad - 2006-02-03

    Logged In: YES
    user_id=717728

    Looks good to me. Introducing a second dirty flag works too.

    The use of numberOfChromosomes vs a_numberOfChromosomes was
    unintentional. I may have been working off a not quite up
    to date version (since I still can't pull the files down
    from CVS), or it might have just been a copy-and-paste error.

     
  • Klaus

    Klaus - 2006-02-03
    • status: open-fixed --> closed-fixed
     
  • Klaus

    Klaus - 2006-02-03

    Logged In: YES
    user_id=722855

    Thanx for your great feedback! May I ask how you are
    accessing the CVS (via web or via CS program, such as
    WinCVS)? For me, using WinCVS works fine. It reflects any
    change in realtime.

     
  • Fanguad

    Fanguad - 2006-02-03

    Logged In: YES
    user_id=717728

    I have been accessing it via the web, although I usually
    have to try each page 2-3 times before it will load
    properly. I use command-line CVS for the most part, and
    sourceforge CVS servers are *always* flakey when using that.
    (home or office)

     

Log in to post a comment.

MongoDB Logo MongoDB