[ https://issues.apache.org/jira/browse/MATH-775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246558#comment-13246558 ]
Thomas Neidhart commented on MATH-775: -------------------------------------- Good catch. After looking at the class, I see even more problems: * setPopulationSize allows to change the population size, but does not check the chromosome list for compatible size * addChromosome does not check the population size at all * the chromosome list given as parameter to the ctor and setChromosomes is assigned directly, allowing the list to be changed from the outside later on >From my understanding the following should happen: * setPopulationSize should shrink the existing chromosome list if it is larger than the new size (optionally we could also remove this method) * addChromosome should throw an exception if adding a chromosome would exceed the population size * when setting an externally provided chromosome list, the entries should be copied to a new internal list > In the ListPopulation constructor, the check for a negative populationLimit > should occur first. > ----------------------------------------------------------------------------------------------- > > Key: MATH-775 > URL: https://issues.apache.org/jira/browse/MATH-775 > Project: Commons Math > Issue Type: Bug > Affects Versions: 3.0 > Reporter: Reid Hochstedler > Labels: genetics > Fix For: 3.1 > > Attachments: MATH-775.txt > > Original Estimate: 1h > Remaining Estimate: 1h > > In the ListPopulation constructor, the check to see whether the > populationLimit is positive should occur before the check to see if the > number of chromosomes is greater than the populationLimit. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira