randomized initial population

Tamie Veith tveith at vt.edu
Thu Nov 1 13:21:08 EST 2001

I am using the GALib for nonpoint source pollution prediction. I am using the GA1DarrayAlleleGenome class with steady state, tournament selection. I create the first genome by sequentially adding allelesets for each gene to the allele array (this is the CreateGenomeTemplate function refered to below). I then initialize the population using the a baseline genome.   this all works fine but results in the initial population consisting of identical genomes (i.e., the baselione genome). 

I want the initial population to be random within the constraints of the allelesets. I can figure out how to do this.

Can anyone advise me?

here are my functions:
/* ----------------------------------------------------------------------------
BaselineInitializer function
  This initializer fills the values from the baseline into the genome template.
---------------------------------------------------------------------------- */
BaselineInitializer(GAGenome &g)
 GA1DArrayAlleleGenome<int> &genome=(GA1DArrayAlleleGenome<int> &)g;
 for(int i=0; i<genome.size(); i++)
  genome.gene(i, iBaseArray[i]);
 } //end for
/* end BaselineInitializer function----------------------------------------- */

/* ----------------------------------------------------------------------------
PopInitializer function
  // This function initializes the poplulation based on the first genome. This
  // is done so that the ga can run on the population and not the indivual.
---------------------------------------------------------------------------- */
PopInitializer(GAPopulation & p)
 for (int i = 0; i<p.size() ; i++)
 {  p.individual(i).initialize();
/* end PopInitializer function--------------------------------------------------- */

//and from the main function-----------------
 //Create genome template from Baseline, 
   GA1DArrayAlleleGenome<int> genome(CreateGenomeTemplate(), Objective);

//initialize GA using allele set
 //Assign the initialization operator.
 //Intialize first genome to match baseline scenario.
 //Keep inital genome, gBase, for future use.
   GA1DArrayAlleleGenome<int> gBase(genome);
 //Assign the mutation operator.
 //Assign the evaluation operator.

//create the population
   GAPopulation gaPop(genome,readPopSize);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20011101/efbcddce/attachment.htm

More information about the galib mailing list