We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 18e863f commit 3c7ceb4Copy full SHA for 3c7ceb4
genetic_algorithm/knapsack.py
@@ -284,7 +284,7 @@ def run_ga(
284
285
# Elitism
286
sorted_indices = sorted(range(pop_size), key=lambda idx: fitnesses[idx])
287
- elite_indices = sorted_indices.reverse[:elitism]
+ elite_indices = sorted_indices.reverse()[:elitism]
288
elites = [population[idx][:] for idx in elite_indices]
289
290
# New generation
0 commit comments