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

Bug selection par tournoi stochastique OK

parent 9a480ab6
...@@ -172,12 +172,16 @@ size_t MinTournament::selectNext(size_t populationSize){ ...@@ -172,12 +172,16 @@ size_t MinTournament::selectNext(size_t populationSize){
if( rg->tossCoin(currentSelectionPressure) ){ if( rg->tossCoin(currentSelectionPressure) ){
if( population[i1]->getFitness() < population[i2]->getFitness() ){ if( population[i1]->getFitness() < population[i2]->getFitness() ){
bestIndex = i1; bestIndex = i1;
} } else {
bestIndex = i2;
}
} }
else{ else{
if( population[i1]->getFitness() < population[i2]->getFitness() ){ if( population[i1]->getFitness() < population[i2]->getFitness() ){
bestIndex = i2; bestIndex = i2;
} } else {
bestIndex = i1;
}
} }
} }
else{ else{
...@@ -226,12 +230,16 @@ size_t MaxTournament::selectNext(size_t populationSize){ ...@@ -226,12 +230,16 @@ size_t MaxTournament::selectNext(size_t populationSize){
if( rg->tossCoin(currentSelectionPressure) ){ if( rg->tossCoin(currentSelectionPressure) ){
if( population[i1]->getFitness() > population[i2]->getFitness() ){ if( population[i1]->getFitness() > population[i2]->getFitness() ){
bestIndex = i1; bestIndex = i1;
} } else {
bestIndex = i2;
}
} }
else{ else{
if( population[i1]->getFitness() > population[i2]->getFitness() ){ if( population[i1]->getFitness() > population[i2]->getFitness() ){
bestIndex = i2; bestIndex = i2;
} } else {
bestIndex = i1;
}
} }
} }
else{ 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