Skip to content

Commit c27f588

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 1a0576f commit c27f588

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

genetic_algorithm/knapsack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def run_ga(
284284

285285
# Elitism
286286
sorted_indices = sorted(range(pop_size), key=lambda idx: fitnesses[idx])
287-
elite_indices = sorted_indices[::-1][:elitism] # reverse and take top indices
287+
elite_indices = sorted_indices[::-1][:elitism] # reverse and take top indices
288288
elites = [population[idx][:] for idx in elite_indices]
289289

290290
# New generation

0 commit comments

Comments
 (0)