Skip to content

Commit 6fdd7aa

Browse files
committed
Fix #337
1 parent e048ad5 commit 6fdd7aa

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pygad/utils/engine.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,11 @@ def run(self):
572572
# Set 'call_on_parents=False' to avoid calling the callable 'on_parents' because this step is not part of the cycle.
573573
self.run_select_parents(call_on_parents=False)
574574

575+
# Update the elitism according to the 'last_generation_fitness' attribute.
576+
if self.keep_elitism > 0:
577+
self.last_generation_elitism, self.last_generation_elitism_indices = self.steady_state_selection(self.last_generation_fitness,
578+
num_parents=self.keep_elitism)
579+
575580
# Save the fitness value of the best solution.
576581
_, best_solution_fitness, _ = self.best_solution(
577582
pop_fitness=self.last_generation_fitness)

0 commit comments

Comments
 (0)