[galib] Cast with Galib (compare genome with AnsiString)

Leonardo Zanforlin zanforlin at gmail.com
Tue Mar 8 08:40:31 EST 2005


Hello,
I´m trying to compare a GA1DBinaryStringGenome with an AnsiString.

My Objective Function is 

float Objective(GAGenome& g) {
  GA1DBinaryStringGenome & genome = (GA1DBinaryStringGenome &)g;

  float score=0.0;
  for (int i=0; i<genome.length(); i++)
    if (genome.gene(i)== Aval2->Individuo.Pos(i))
    score += 1.0;

return score;
}
    
and the result is the same each time and it´s wrong. I believe that
I´m do not making the cast.

What can I do without much work?

Thanks
Léo



More information about the galib mailing list