Skip to content

Fix COBYLA Invalid RHOEND warning with recent scipy - #1722

Open
Thanatos9404 wants to merge 1 commit into
facebookresearch:mainfrom
Thanatos9404:fix/cobyla-rhoend-warning
Open

Thanatos9404 wants to merge 1 commit into
facebookresearch:mainfrom
Thanatos9404:fix/cobyla-rhoend-warning

Conversation

@Thanatos9404

@Thanatos9404 Thanatos9404 commented Oct 19, 2026 •

Copy link
Copy Markdown

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Motivation and Context / Related issue

Part of #1702

Since scipy 1.16, COBYLA uses PRIMA, which treats tol as the final trust region radius and requires it to be positive. NonObjectOptimizer always passes tol=0, so every COBYLA run and restart warns COBYLA: Invalid RHOEND. NGOpt and Shiwa hit this at low budgets, plain Cobyla at any budget.

This passes tol=1e-6 for 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_warning to test_optimizerlib.py for Cobyla, NGOpt and Shiwa. All three cases fail on main with scipy 1.17.1 and pass with this change.

Checklist

  • The documentation is up-to-date with the changes I made.
  • I have read the CONTRIBUTING document and completed the CLA (see CLA).
  • All tests passed, and additional code has been covered with new tests. (A new test is included. I haven't run the full suite on Linux.)

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.
@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Oct 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant