Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. def selection(specimens: List[Specimen]) -> List[Specimen]:
  2. '''
  3. Randomly select 2 specimens based on the survival probability
  4. '''
  5. specimens_p = []
  6. for specimen in specimens:
  7. specimens_p.append(specimen.survival_p)
  8. chosen_specimens = choice(specimens, 2, p=specimens_p)
  9. return chosen_specimens
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement