Repository navigation
Fix COBYLA Invalid RHOEND warning with recent scipy - #1722
Open
Thanatos9404 wants to merge 1 commit into
Open
Thanatos9404 wants to merge 1 commit into
Thanatos9404 wants to merge 1 commit into
Conversation
COBYLA uses tol as its final trust region radius (rhoend). Since scipy 1.16 (PRIMA) it rejects tol=0: it warns "Invalid RHOEND" and uses 1e-6 instead. NonObjectOptimizer passes tol=0 to every scipy method, so Cobyla, and NGOpt or Shiwa when they select it at low budgets, emitted this warning (facebookresearch#1702). Pass tol=1e-6 for COBYLA, the value scipy 1.16+ was already using, so on those versions the optimization is unchanged and the warning is gone. The other scipy methods still get tol=0. On older scipy, long runs may now restart at rhoend 1e-6 instead of shrinking further.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of changes
Motivation and Context / Related issue
Part of #1702
Since scipy 1.16, COBYLA uses PRIMA, which treats
tolas the final trust region radius and requires it to be positive.NonObjectOptimizeralways passestol=0, so every COBYLA run and restart warnsCOBYLA: Invalid RHOEND. NGOpt and Shiwa hit this at low budgets, plainCobylaat any budget.This passes
tol=1e-6for COBYLA only. That is the value scipy 1.16+ already falls back to, so the optimization doesn't change there. On scipy 1.15 and older a run now stops at 1e-6 and restarts, as it already does on 1.16+; final losses were the same or within 1e-9 in my runs.A separate "Invalid MAXFUN" warning near the end of the budget is not addressed here.
How Has This Been Tested (if it applies)
Added
test_cobyla_no_rhoend_warningtotest_optimizerlib.pyforCobyla,NGOptandShiwa. All three cases fail on main with scipy 1.17.1 and pass with this change.Checklist