"cannot be cast to [Lorg.jgap.impl.IntegerGene" in JGAP

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

"cannot be cast to [Lorg.jgap.impl.IntegerGene" in JGAP

Phi-Vu Nguyen
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

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: "cannot be cast to [Lorg.jgap.impl.IntegerGene" in JGAP

Phi-Vu Nguyen
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 <[hidden email]> 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


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users
Loading...