Skip to content

Commit

Permalink
refactor: optimize and fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
maiahi committed Apr 29, 2024
2 parents 1611858 + f41ee8c commit c72ebe8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/agents/geneticAlgAgentJon.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def paring_pop(self, pop_list: list[list[list[float], float]]) -> list[list[floa
if norm == 0:
norm = 1e-10 # or some small constant
new_pop[0] = [i / norm for i in new_pop[0]]
new_pop[0] = [i / norm for i in new_pop[0]]

# Mutate 5% of children pops
if random.randrange(0,1000)/1000 < 0.05:
Expand Down

0 comments on commit c72ebe8

Please sign in to comment.