[galib] how to randomly generate a population of real alleles

Daiyue Weng dweng01 at qub.ac.uk
Wed Nov 20 13:17:27 EST 2013


Hi, all, I need to randomly generate a set of RealGenome (say 30) in order to use SimpleGA to do the evolution. Each genome contains 5 alleles, and the sum of the 5 allele values (each is in the interval (0,1)) need to be equal to 1. So I checked example 21 in the GAlib package, the code that is close to what I require is the following:


GARealAlleleSetArray alleles2a;

for(int i=0; i<length; i++)

alleles2a.add(0, 1, GAAllele::EXCLUSIVE, GAAllele::EXCLUSIVE);

GARealGenome genome2a(alleles2a, Objective2);


but it only created a RealGenome which contains alleles having bounded continuous values (0,1). Also, later in the code:


GAParameterList params;

GASteadyStateGA::registerDefaultParameters(params);

params.set(gaNpopulationSize, 110);

It just replicated the RealGenome 110 times, but not randomly generated 110 RealGenomes. So how can I achieve my goal, point me some directions.

cheers

Sent from Windows Mail

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


More information about the galib mailing list