Problem with adding a chromosome containing values equal zero

View: New views
2 Messages — Rating Filter:   Alert me  

Problem with adding a chromosome containing values equal zero

by vladimir nejkov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I use the JGAP library.
For my optimization problem, I use the DefaultConfiguration and invoke gaConf.setSampleChromosome(sampleChromosome);
where sampleChromosome is
IChromosome sampleChromosome = new Chromosome(gaConf,
                  new IntegerGene(gaConf, 0, 89), chromeSize);

I want the program to add a solution chromosome to the population. I do it this way for genes with allele equal zero:

Gene[] genes = new Gene[chromeSize];                   
for (int i = 0; i < chromeSize; i++) {
    Gene gene = new IntegerGene(gaConf);
    Integer integerValue = new Integer(0);
    gene.setAllele(integerValue);
    genes[i] = gene;
}
genotype.getPopulation().addChromosome(new Chromosome(gaConf, genes));


Here is my problem:
-If I set the allele value for all genes in the chromosome to zero, I get in the method evaluate() in the input array sometimes a negative entry, namely -1 , although I have configured the value range (0,89) of the genes' alleles.



If I add a solution with gene alleles all different from zero, the problem doesn't appear, the evaluate method gets values only from 0 to 89.

It does not matter, whether I keep the population size constant or not.

Is the described problem a bug in JGAP? Did I implement or understand something wrong?

Thank you for your answer.

Best wishes,
Vladimir Neykov


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users

Re: Problem with adding a chromosome containing valuesequal zero

by Klaus Meffert-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Vladimir,
 
I wonder if you get a -1 as a fitness value or -1 as gene value. You mentioned an evaluate() method. What is done there?
 
Why do you want to add a solution chromosome and when do you do this (before evolving, during...)?
 
Best
 


From: jgap-users-bounces@... [mailto:jgap-users-bounces@...] On Behalf Of Vladimir Neykov
Sent: Tuesday, May 06, 2008 4:55 PM
To: JGAP Group
Subject: [jgap-users] Problem with adding a chromosome containing valuesequal zero

Hi!

I use the JGAP library.
For my optimization problem, I use the DefaultConfiguration and invoke gaConf.setSampleChromosome(sampleChromosome);
where sampleChromosome is
IChromosome sampleChromosome = new Chromosome(gaConf,
                  new IntegerGene(gaConf, 0, 89), chromeSize);

I want the program to add a solution chromosome to the population. I do it this way for genes with allele equal zero:

Gene[] genes = new Gene[chromeSize];                   
for (int i = 0; i < chromeSize; i++) {
    Gene gene = new IntegerGene(gaConf);
    Integer integerValue = new Integer(0);
    gene.setAllele(integerValue);
    genes[i] = gene;
}
genotype.getPopulation().addChromosome(new Chromosome(gaConf, genes));


Here is my problem:
-If I set the allele value for all genes in the chromosome to zero, I get in the method evaluate() in the input array sometimes a negative entry, namely -1 , although I have configured the value range (0,89) of the genes' alleles.



If I add a solution with gene alleles all different from zero, the problem doesn't appear, the evaluate method gets values only from 0 to 89.

It does not matter, whether I keep the population size constant or not.

Is the described problem a bug in JGAP? Did I implement or understand something wrong?

Thank you for your answer.

Best wishes,
Vladimir Neykov


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users
LightInTheBox - Buy quality products at wholesale price