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

Invalid state for DE unless num_ask - num_tell <= popsize #1461

Open
Game4Move78 opened this issue Jul 11, 2022 · 4 comments
Open

Invalid state for DE unless num_ask - num_tell <= popsize #1461

Game4Move78 opened this issue Jul 11, 2022 · 4 comments

Comments

@Game4Move78
Copy link
Contributor

Game4Move78 commented Jul 11, 2022

Calling ask more than popsize times will result in an invalid state for DE. In particular it will cause the _uid_queue to wrap around, and produce two asked points with the same parent which adds the uid twice to _uid_queue on calls to tell. Then a tell-not-ask with better loss has the potential to kick the parent from the population, but leave its uid in the _uid_queue, resulting in a KeyError on one of the subsequent calls to ask.

If this is for performance reasons, the documentation could stress that calling ask no more than popsize times should be manually enforced as it can break some optimizers.

@Game4Move78 Game4Move78 changed the title Invalid state for DE unless num_ask - num_tell < popsize Invalid state for DE unless num_ask - num_tell <= popsize Jul 11, 2022
@bottler
Copy link
Contributor

bottler commented Jul 11, 2022

When the user creates an optimizer object and specifies num_workers, they are promising that they will never have more than the given number of untold asks. Nevergrad optimizers are not designed to handle this promise being broken.

@Game4Move78
Copy link
Contributor Author

Game4Move78 commented Jul 11, 2022

Perhaps this could be mentioned in the docs as a promise rather than as typical usage.

#263 is an example where a user other than myself thought they could ignore impossible-to-evaluate points without a tell.

The answer to #1028 had given me the impression that it's not absolutely crucial to set popsize larger than num_workers, and that its just a good rule-of-thumb.

@bottler
Copy link
Contributor

bottler commented Jul 11, 2022

It seems like it would be good to add some more error checking for these cases.

Game4Move78 added a commit to Game4Move78/nevergrad that referenced this issue Jul 11, 2022
@Game4Move78
Copy link
Contributor Author

This might be a safe way to do it. I don't know if this invariant matters for other optimizers.

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

No branches or pull requests

2 participants