Skip to content

Commit 827a0d3

Browse files
committed
FIXED GA: Only applied neeeded assertions
1 parent f8f20ed commit 827a0d3

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

search/genetic_algorithm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,8 @@ def evaluate_population(evals_done, params, eval_cache):
204204
offspring.append(child)
205205
attempts += 1
206206
# A Brief Checking
207-
assert len(offspring) < max_offspring, "Number of Offsprings should not exceed the allowed maximum"
208-
assert len(offspring) <= len(all_params), f"Evolved {len(offspring)} Offsprings should not exceed the total population of {len(all_params)}"
209-
207+
assert len(offspring) <= max_offspring, f"Number of Offsprings {len(offspring)} should not exceed the allowed maximum of {max_offspring}"
208+
210209
# 3. Mutation
211210
# We get a list of mutated children from crossover offsprings
212211
mutated_offspring: List[Dict[str, Any]] = []

0 commit comments

Comments
 (0)