double denominator = generationSize * (generationSize - 1);
for (ChromosomeMapIterator it = generationFitness.begin(); it != generationFitness.end(); it++) {
-// cout << "rank: " << rank << " denominator: " << denominator << " res: " << (rank-1)/denominator << "\n";
rankedGeneration.insert(std::make_pair(rank--/denominator, it->second));
}
random = (rand() % size) / (double)denominator;
for (ChromosomeMapIterator it = probabilities.begin(); it != probabilities.end(); it++) {
-// cout << "Random: " << random << " First: " << it->first << "\n";
if (random < it->first) {
found = true;
selected.push_back(it->second);