Skip to content

Conversation

@Mach-2
Copy link

@Mach-2 Mach-2 commented Mar 10, 2023

I noticed that selRoulette was causing a major bottleneck when I tried to scale up to larger populations. This update uses the np.random.choice function in place of random.random, which removes the need to sort the input list of individuals and the nested for loops.

@fmder
Copy link
Member

fmder commented Mar 10, 2023

Could this be done with the new random.choices?

@Mach-2
Copy link
Author

Mach-2 commented Mar 10, 2023

Yes, random.choices looks like it does the same thing. This shaved off a bit of runtime again, too! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants