-
Notifications
You must be signed in to change notification settings - Fork 358
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
Dedicate half constraint budget to a suboptimizer #1047
Conversation
* returnpenalties * fix * removeprints * extract Co-authored-by: Jeremy Rapin <jrapin@fb.com>
The previous code was ok only if the optimization method is not limited by the budget.
nevergrad/optimization/base.py
Outdated
# the original candidate under the constraints. | ||
penalty = cand._constraint_penalties() | ||
if not penalty > 0: # constraints are satisfied | ||
return cand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't return this, since this candidate does not have any constraint anymore listed, it could create weird bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh my god thx.
* fix keras issue * Update test_mlfunctionlib.py * black * remove_useless_stuff * Update test_core.py * fix * Update core.py
* fix keras issue * Update test_mlfunctionlib.py * black * WIP morphing * fix * Update core.py * black * fix * fix * syntax_fix * fix * fix * fix * fix * fix * black * Update core.py * Update core.py
* MOO variants * Update experiments.py * better_alignment * better_doc * fix
nevergrad/optimization/base.py
Outdated
self._constraints_manager.max_trials // 2 | ||
if self.budget is None | ||
else (self.budget - self.num_ask), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why self.budget - self.num_ask
? right now this does not make sense to me, and this seems unexpected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the optimizer has a maximum budget, we want the budget we use to be smaller than the remaining budget before the optimizer crashes, hence self.budget - self.num_ask.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so you probably want to do some kind of mean between self._constraints_manager.max_trials and self.budget - self.num_ask
so that:
you don't go beyond max_trials, and you dont exhaust more than half the remaining budget of the optimizer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
min(self._constraints_manager.max_trials, self.budget - self.num_ask) could make sense.
Eventually all that stuff is going to be equipped with parameters for combining the auxiliary solver and the simple rejection of mutations.
Besides adding the famous constraint learning tool for expensive constraints that would be useful for some of our users... still a long way to go on the path to constraint management :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, requesting changes again to make sure this is not merge before I understand the budget
Thx @jrapin , you deserve more credit than me for this PR. |
Types of changes
Motivation and Context / Related issue
Camille posted a problem that was not solved by Nevergrad.
With the current PR the pb is solved.
How Has This Been Tested (if it applies)
Checklist