Skip to content

Fix Egor bounds check and fail=2 termination - #507

Open
relf wants to merge 6 commits into
mdolab:mainfrom
relf:fix-egor-wrapper
Open

relf wants to merge 6 commits into
mdolab:mainfrom
relf:fix-egor-wrapper

Conversation

@relf

@relf relf commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Purpose

Fixes two Egor wrapper defects found while adding Egor to OpenMDAO's pyOptSparseDriver (OpenMDAO/OpenMDAO#3854). With these fixes, OpenMDAO needs no Egor-specific workaround.

  • Unbounded design variables: missing bounds are stored as ±1e20, which passed the np.isfinite check. They now raise a ValueError listing the unbounded variables.
  • User requested termination (fail = 2): Egor treated it as a failed point and went on. It now stops with inform 3, as SNOPT, IPOPT and Uno do. During the initial DOE, the initial point is returned with fStar = NaN.
  • Docs: finite bounds requirement, constraint handling, gp_config defaults, and the list of optimizers supporting fail = 2.
  • Testing dependency: egobox>=1.1.0, needed for interruption during the initial DOE. Otherwise the wrapper stays compatible with egobox 1.0.

Expected time until merged

Not urgent, about a week.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

New tests in tests/test_egor.py cover unbounded design variables, and fail = 2 and Ctrl+C during and after the initial DOE. Egor is added to test_user_termination.py::test_obj.

testflo tests/test_egor.py tests/test_user_termination.py

Checklist

  • I have run ruff check and ruff format to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@relf
relf requested review from a team, ewu63 and marcomangano as code owners November 20, 2026 08:54
@relf
relf requested review from sabakhshi and sanjan98 November 20, 2026 08:54
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.22%. Comparing base (c791384) to head (c856917).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #507   +/-   ##
=======================================
  Coverage   54.22%   54.22%           
=======================================
  Files           1        1           
  Lines         225      225           
=======================================
  Hits          122      122           
  Misses        103      103           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marcomangano marcomangano left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for the clear documentation and the added tests! I only have a question about them, see below.

Comment thread tests/test_egor.py Outdated
def test_egor_user_termination(self):
# Termination after the initial DOE: handled by Egor, the best point is returned
sol = self.run_terminated_xsinx(lambda: 2)
self.assertTrue(np.isfinite(sol.fStar))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are this and the following test just checking if sol.fstar is finite? Wouldn't it be stronger to pass the known solution value? I might be missing some details about how the DOE works here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! Now I check that fStar is the minimum of the objective values evaluated

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

Successfully merging this pull request may close these issues.

2 participants