Commit b8da7bbe authored by Farzad Sehat's avatar Farzad Sehat

Bug selection par tournoi stochastique OK

parent 9a480ab6
......@@ -172,12 +172,16 @@ 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;
}
}
}
else{
......@@ -226,12 +230,16 @@ 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;
}
}
}
else{
......
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