diff --git a/evolopy/GA.py b/evolopy/GA.py index 3a6b8c7..32b58de 100644 --- a/evolopy/GA.py +++ b/evolopy/GA.py @@ -181,14 +181,14 @@ def rouletteWheelSelectionId(scores, popSize): """ ##reverse score because minimum value should have more chance of selection - reverse = max(scores) + min(scores) + reverse = max(scores) reverseScores = reverse - scores.copy() sumScores = sum(reverseScores) pick = random.uniform(0, sumScores) current = 0 for individualId in range(popSize): current += reverseScores[individualId] - if current > pick: + if current >= pick: return individualId