Skip to content

Add Egor optimizer wrapper#485

Open
relf wants to merge 23 commits into
mdolab:mainfrom
relf:add-egobox-egor
Open

Add Egor optimizer wrapper#485
relf wants to merge 23 commits into
mdolab:mainfrom
relf:add-egobox-egor

Conversation

@relf

@relf relf commented Jun 15, 2026

Copy link
Copy Markdown

Purpose

This PR integrates the surrogate-based optimizer Egor from the EGObox library.

Egor uses bayesian optimization techniques well-suited to find the global optimum of an expansive-to-evaluate black-box function.
Basically, it uses a surrogate model to approximate the objective function and an infill criterion (aka acquisition function) to guide the search for the optimum.

Resolves relf/EGObox#439

Expected time until merged

a few weeks

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

Egor tests have been added to the pyOptSparse test suite.

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

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.99%. Comparing base (20cfa02) to head (db61aa7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #485   +/-   ##
=======================================
  Coverage   82.99%   82.99%           
=======================================
  Files           1        1           
  Lines         147      147           
=======================================
  Hits          122      122           
  Misses         25       25           

☔ 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.

@relf relf marked this pull request as ready for review June 15, 2026 15:36
@relf relf requested a review from marcomangano as a code owner June 15, 2026 15:36

@ewu63 ewu63 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.

First things first, let's add egobox to the testing deps of pyproject.toml, so that the test you added may run instead of being skipped for optimizer not available.

Comment thread doc/optimizers/Egor.rst
Comment thread tests/test_egor.py Outdated
Comment thread tests/test_sphere.py Outdated
from pyoptsparse.testing import OptTest

ALL_OPTIMIZERS = sorted({e.name for e in Optimizers} - {"ParOpt", "NSGA2"})
ALL_OPTIMIZERS = sorted({e.name for e in Optimizers} - {"ParOpt", "NSGA2", "Egor"})

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.

Any reason not to test this case?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch! Initially I discarded this test as it used hot start and was failing on a nb of function calls. Finally I read the "hot start" feature documentation, I just had to seed Egor and also use TREGO to meet test tolerances.

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.

Integrate Egor in pyOptSparse

2 participants