Skip to content

Commit

Permalink
Make sure parent1 and parent2 are different.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmdis1999 committed Jan 12, 2024
1 parent d2c78c9 commit 0edbc0d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ykrt/pass_finder/try_passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ def genetic_algorithm(glogf, is_prelink, population_size, mutation_rate, generat
for _ in range(population_size // 2):
parent1 = random.choices(population, weights=wt, k=1)[0]
parent2 = random.choices(population, weights=wt, k=1)[0]
while parent2 == parent1:
parent2 = random.choices(population, weights=wt, k=1)[0]
parents.append((parent1, parent2))

# Perform crossover and mutation to create a new generation
Expand Down

0 comments on commit 0edbc0d

Please sign in to comment.