I also tried:

IntegerGene[] sampleGenes= new IntegerGene[100];
for (int i=0;i<sampleGenes.length;i++)
          sampleGenes[i]= new IntegerGene(config,0,3);

But the error still persists, the error must happen somewhere in the evolve() function. Thank you!

Best regards,
phivu


On Wed, Aug 28, 2013 at 10:06 PM, Phi-Vu Nguyen <phivucs@gmail.com> wrote:
Hi colleagues,

Have you ever met this error when call the population.evolve() function in JGAP:

"java.lang.ClassCastException: [Lorg.jgap.Gene; cannot be cast to [Lorg.jgap.impl.IntegerGene;"

In my program, I am created a sampleGenes array of IntegerGene (as in the first example of "Getting started with JGAP" pdf documentation):

Gene[] sampleGenes= new Gene[100];
for (int i=0;i<sampleGenes.length;i++)
          sampleGenes[i]= new IntegerGene(config,0,3);

Chromosome sampleChromosome= new Chromosome(config, sampleGenes);
config.setSampleChromosome(sampleChromosome);

Then after I called population.evolve(), the above error happened. Does anyone know why this happens? Thank you so much!

Best regards,
phivu