facebookresearch / nevergrad

A Python toolbox for performing gradient-free optimization
https://facebookresearch.github.io/nevergrad/
MIT License
3.92k stars 352 forks source link

Error checking for #1461 #1462

Open Game4Move78 opened 2 years ago

Game4Move78 commented 2 years ago

https://github.com/facebookresearch/nevergrad/issues/1461

Types of changes

Motivation and Context / Related issue

https://github.com/facebookresearch/nevergrad/issues/1461

How Has This Been Tested (if it applies)

Checklist

facebook-github-bot commented 2 years ago

Hi @Game4Move78!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

facebook-github-bot commented 2 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

facebook-github-bot commented 2 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

teytaud commented 2 years ago

A this line: https://github.com/Game4Move78/nevergrad/blob/7152ca66cc5f66c0427579d486075ba18dc003b7/nevergrad/optimization/differentialevolution.py#L104

We might add self.llambda = max(self.llambda, self.num_workers)

This should solve the issue, however it means that the user might specify "I want llambda to be 20 and Nevergrad decides to set llambda to 30".

teytaud commented 2 years ago

Your code looks good to me, the problem might be in MixDeterministicRL. I investigate. Thanks for your work.

Game4Move78 commented 1 year ago

@jrapin Any chance of getting this merged :smiley:? Line https://github.com/facebookresearch/nevergrad/blob/8403d6c9659f40fec2a3cf7f474b3d8610f0f2e4/nevergrad/optimization/utils.py#L340 also uses absence in UidQueue.asked to check for presence in told, and self._uid_queue.asked is configured directly on many lines in _DE already.

I believe this code enforces that for asked points with the same parent, the lineage will be added to the told queue only once in subsequent tells:

if uid in self._uid_queue.asked:  # if taken from queue in multiple asks, add back only once
            self._uid_queue.asked.discard(uid)
            self._uid_queue.tell(uid)