Seeding a Population
John Schloman
schlomjf at muohio.edu
Tue Jun 27 09:45:38 EDT 2000
In the current project I'm working on, we wanted to be able to seed the population with a previous or artificial population from a file. The file was created using:
for(int i=0; i<ga.populationSize(); i++)//.size(); i++)
for(int j=0; j<num_param; j++)
{
genname<<((GABin2DecGenome&)(ga.population().individual(i))).phenotype(j);
genname << "\t";
}
where genname is the ofstream... pretty straight forward. The problem is when reopening the file and reseeding the population with this code:
for(int i=0; i<ga.populationSize(); i++)//.size(); i++)
{
for(int j=0; j<num_param; j++)
{ double temp;
genname>>temp;
((GABin2DecGenome&)(ga.population().individual(i))).phenotype(j,temp);
}
}
I get a whole monster amount of debug output of:
GACheckEncoding:
specified value cannot be exactly represented with these bits.
desired: -4.569390 actual: -4.569390 discretization: 0.000153 nbits: 16 min: -5.00000 max: 5.00000
Now I'm not doing this in an Initializer (which I probably should) but I didn't think that it was exactly necessary especially since filling the population this way wasn't going to be mandatory. Anyway. Any suggestions to cut out all of this extra output? And does this point to any detrimental effect that this may have?
Thanks for your time,
John Schloman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20000627/2f8dd237/attachment.htm
More information about the galib
mailing list