Raul, the bug you identify below has been fixed for a while on the SVN repository. I suggest you use that version rather than the current tarball. I'm delaying putting out a new tarball because I'm waiting -- hopefully -- for some submitted benchmark code to be readied prior to the next release. Sean On Oct 18, 2012, at 6:25 AM, Raul Lara Cabrera wrote: > Hello everyone, > > I think I have found a bug inside the "setGenomeLength" method of the > GeneVectorIndividual class. I am using individuals with random length > initialization and custom genes. When initialising the population, the > method "setGenomeLength" raises an ArrayIndexOutOfBounds exception. This > method's implementation is the following: > > public void setGenomeLength(int len) > { > GeneVectorSpecies s = (GeneVectorSpecies) species; > VectorGene[] newGenome = new VectorGene[len]; > System.arraycopy(genome, 0, newGenome, 0, > genome.length < newGenome.length ? genome.length : newGenome.length); > for(int x=genome.length; x< newGenome.length; x++) > if (genome[x]==null) genome[x] = (VectorGene)(s.genePrototype.clone()); // not reset > genome = newGenome; > } > > The line which raises the exception is: > if (genome[x]==null) genome[x] = (VectorGene)(s.genePrototype.clone()); // not reset > > I think that this line should be > if (newGenome[x]==null) newGenome[x] = (VectorGene)(s.genePrototype.clone()); > > because after the for-loop newGenome is assigned to genome, and when entering the loop, genome.length is 1 so it always raises an exception. > > Am I right? > > > Regards, > > Raul.