Commit b8da7bbe authored by Farzad Sehat's avatar Farzad Sehat
Browse files

Bug selection par tournoi stochastique OK

parent 9a480ab6
......@@ -172,11 +172,15 @@ size_t MinTournament::selectNext(size_t populationSize){
if( rg->tossCoin(currentSelectionPressure) ){
if( population[i1]->getFitness() < population[i2]->getFitness() ){
bestIndex = i1;
} else {
bestIndex = i2;
}
}
else{
if( population[i1]->getFitness() < population[i2]->getFitness() ){
bestIndex = i2;
} else {
bestIndex = i1;
}
}
}
......@@ -226,11 +230,15 @@ size_t MaxTournament::selectNext(size_t populationSize){
if( rg->tossCoin(currentSelectionPressure) ){
if( population[i1]->getFitness() > population[i2]->getFitness() ){
bestIndex = i1;
} else {
bestIndex = i2;
}
}
else{
if( population[i1]->getFitness() > population[i2]->getFitness() ){
bestIndex = i2;
} else {
bestIndex = i1;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment