m_fittestChromosome
Brought to you by:
klausikm
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.
Population.java
Logged In: YES
user_id=717728
uploading test cases
JGAP_TestCase2.java
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.
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.
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.
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)