getFittestChromosomes semantics?
Brought to you by:
klausikm
What are the semantics if getFittestChromosomes(int) is
called where a_numberOfChromosomes is more than the
total population? Admittedly, this is only really of
concern in test problems where the population size is
unrealistically small, but I think it would be to
define the semantics in the javadoc.
Right now, no bounds checking is performed on the
argument, so an ArrayIndexOutOfBounds exception is thrown.
Logged In: YES
user_id=722855
You are right. I added javadoc comments and fixed the code
as well extending a test case
Logged In: YES
user_id=717728
Looks good to me. You might want to comment on the line
assertEquals(4, p.determineFittestChromosomes(5).size());
in
testDetermineFittestChromosomes_1(), since it's not
intuitive why 4 is the correct answer, and not 5 (since the
four chromosomes are added in a different method).
Logged In: YES
user_id=722855
OK, good suggestion. I checked in the changed class.