Other case where the GA doesn't work

agna@brawijaya.ac.id agna at brawijaya.ac.id
Tue Mar 4 00:46:32 EST 2003


Dear Sir,
> You are initialising all your genomes to "1,1,1,1,1,1" then just swapping
> them about with the SwapMutator. There is nothing happening to change these
> 1's into 2's, 3's etc.

Ok, thank you very much. The program has run well.
I would like to ask your help again.
I want to create a genome with GA1DArrayAlleleGenome<int> in which
its allele set of each gene is different. The snippet of trial program looks 
like this: 

 int a0[10]={0,1,2,3,4,5,6,7,8,9};
 int a1[5]={2,3,4,5,6};
 int a2[7]={7,8,9,10,11,12,13};
 int a3[11]={50,51,52,53,54,55,56,57,58,59,60}; 

 // Create multiple allele set or allele set array
 GAAlleleSetArray<int> AlleleSetArray;
 AlleleSetArray.add(len,a0);
 AlleleSetArray.add(len,a1);
 AlleleSetArray.add(len,a2);
 AlleleSetArray.add(len,a3); 

 //Create Target
 GA1DArrayAlleleGenome<int> target(AlleleSetArray);
 target.initialize();
 /* each gene is assigned according to min and max value of
   the corresponding allele set. */
 target.gene(len,GARandomInt(0,9));
 target.gene(len,GARandomInt(2,6));
 target.gene(len,GARandomInt(7,13));
 target.gene(len,GARandomInt(50,60)); 

 // Create genome object
 GA1DArrayAlleleGenome<int> genome(AlleleSetArray,Objective,(void 
*)&target); 

The program is able to run, but it produces bad genome in which  there is 
message: 

" GAAllele::allele(unsigned int) : this method has not been defined" 

in advance. 

There are two things I guess about the program (but I am not sure):
 - I am wrong in arranging multiple allele set in
       GAAlleleSetArray<int> AlleleSetArray;
        .
        .
 - Or that different allele set CAN NOT BE APPLIED for each gene. 

Is it correct ? If the answer is "yes", must I create my own modification 
like GARealGenome.h and GARealGenome.C in order to able to apply different 
allele set for each gene ? 

Thank you very much for your great help. 

With best wishes.
Naba 



More information about the galib mailing list