Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pymoo code to use Generators rather than setting global seeds. #469

Open
CompRhys opened this issue Aug 11, 2023 · 2 comments
Open
Assignees

Comments

@CompRhys
Copy link

# if a seed is set, then use it to call the random number generators
if seed is not None:
    import random
    random.seed(seed)
    np.random.seed(seed)

Currently pymoo sets global seeds that mean that it can interfere with intended functionality outside it's own scope. I would propose that we update pymoo to use the best practice of numpy Generators and then fork the seed into everywhere where a seed is used.

@blankjul blankjul self-assigned this Aug 13, 2023
@blankjul
Copy link
Collaborator

This is related to #413.

I would be happy to look at a PR. But I also know that this requires touching many places in the framework. Ideally, each algorithm has a RandomState object (or maybe even operators have their own). Additionally, the implementation should be thread-safe which it currently is not.

@jacktang
Copy link

@blankjul I'd like to fix it.

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

No branches or pull requests

3 participants