Skip to content

Commit

Permalink
Lexicase only works for MultiObjective
Browse files Browse the repository at this point in the history
  • Loading branch information
alcides committed Feb 27, 2024
1 parent cf2c54b commit e0f49ae
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions geneticengine/algorithms/gp/operators/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,10 @@ def iterate(
winners = []
minimize: list[bool]

if n_cases == 1 and isinstance(problem.minimize, bool):
n_cases = len(candidates[0].get_fitness(problem).fitness_components)
minimize = [problem.minimize for _ in range(n_cases)]
else:
assert isinstance(problem.minimize, list)
minimize = problem.minimize

assert n_cases == len(candidates[0].get_fitness(problem).fitness_components)
assert isinstance(problem.minimize, list)
minimize = problem.minimize
assert isinstance(minimize, list)
n_cases = len(candidates[0].get_fitness(problem).fitness_components)

for _ in range(target_size):
candidates_to_check = candidates.copy()
Expand Down

0 comments on commit e0f49ae

Please sign in to comment.