-
Notifications
You must be signed in to change notification settings - Fork 122
Add Egor optimizer wrapper #485
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
Open
relf
wants to merge
33
commits into
mdolab:main
Choose a base branch
from
relf:add-egobox-egor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 23 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
5ae2b59
Initial integration
relf c131d43
Add some tests
relf 5daa2cb
Adjust doc
relf 2952cff
Test on ackley instead of rosenbrock
relf 356e1ca
Improve documentation and exit status handling
relf 11f3321
More tests
relf d55deb0
Test warm_start
relf 8dd6b1b
Test Egor configuration
relf a0a1c20
Format
relf 7c814e4
Add test with constraints
relf e1b19eb
Fix doc
relf d916f19
Improve doc
relf 2c99a3f
Cleanup
relf e2607df
Do not import egobox for tests
relf 75b74eb
Fix import order
relf aa50911
Add egobox dependency
relf 95deaee
Remove print statements
relf 090bbfd
Try TREGO to improve convergence on ackley test
relf 109f7db
Add egobox in environment.yml
relf 05abbbb
Try Egor conf to make tests pass on windows
relf 27bf363
Add sphere test
relf 2014daf
Use TREGO to improve test convergence
relf db61aa7
Relax test tolerance
relf 7868382
Move egobox in testing deps and use a release range
relf c7f3163
Mention conda install
relf 2b26b21
Remove trailing space
relf d671ede
Move egobox in testing section
relf 45687fb
Use assert_solution_allclose
relf 96e34dd
Initialize callCounter
relf 01a078d
Suppress redondant default handling
relf 45d12e1
Cleanup egobox < 0.37.6 handling
relf 50dd5e9
Add docstrings
relf aea288e
Format
relf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ dependencies: | |
| - scipy >=1.7 | ||
| - sqlitedict >=1.6 | ||
| - cyipopt | ||
| - egobox >=0.37.6 | ||
| # testing | ||
| - parameterized | ||
| - testflo | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| .. _egor: | ||
|
|
||
| Egor | ||
| ==== | ||
|
|
||
| Egor is the surrogate-based Efficient Global Optimization (EGO) optimizer from the open-source | ||
| `EGObox <https://github.com/relf/EGObox>`_ library. | ||
|
|
||
| Egor uses `bayesian optimization <https://en.wikipedia.org/wiki/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. | ||
|
|
||
| The pyOptSparse wrapper is derivative-free and targets single-objective, bounded, | ||
| continuous design spaces. Constraint values are passed to Egor with the pyOptSparse | ||
| constraint convention transformed to :math:`c(x) \le 0`. | ||
|
|
||
| Installation | ||
| ------------ | ||
|
|
||
| Egor is made available through the `egobox <https://pypi.org/project/egobox/>`_ Python package. | ||
|
|
||
| .. prompt:: bash | ||
|
|
||
| pip install egobox | ||
|
relf marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
| Options | ||
| ------- | ||
|
|
||
| Please refer to the Egor help for a complete listing of options and their default values. | ||
|
|
||
| .. prompt:: bash | ||
|
|
||
| python | ||
| >>> import egobox as egx | ||
| >>> help(egx.Egor) | ||
| >>> help(egx.GpConfig) | ||
|
|
||
| pyoptSparse expects pickable objects while native Egor structures as GpConfig are not pickable. | ||
| To workaround this constraint, the pyOptSparse Egor wrapper uses dictionaries which are accepted by EGor | ||
| to update the default field values of Egor structures. | ||
| Names and default values of the fields are provided in the descriptions below. | ||
|
|
||
| .. optionstable:: pyoptsparse.pyEgor.pyEgor.Egor | ||
| :filename: Egor_options.yaml | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| gp_config: | ||
| desc: | | ||
| GpConfig as a dict used by Egor for surrogate model configuration. | ||
| Main defaults are: | ||
|
|
||
| - ``regr_spec``: 1 (Constant) | ||
| - ``corr_spec``: 2 (Squared Exponential) | ||
| - ``kpls_dim``: no PLS dimensionality reduction (otherwise int) | ||
| - ``n_clusters``: no clustering (otherwise int) | ||
| cstr_tol: | ||
| desc: | | ||
| Constraint tolerances list passed to Egor (size n_cstr plus n_fcstr) | ||
| Default is ``1e-4`` for all constraints. | ||
| n_start: | ||
| desc: Number of infill optimization runs (best run selected) | ||
| n_doe: | ||
| desc: Number of initial DOE samples (0 lets Egor choose automatically) | ||
| doe: | ||
| desc: | | ||
| Initial DOE array, either x-only or concatenated x and y | ||
| to be passed as list of lists of floats. If not provided, Egor will generate a DOE automatically. | ||
| infill_strategy: | ||
| desc: | | ||
| Infill criterion: | ||
|
|
||
| - 1 = ``EI``, | ||
| - 2 = ``WB2``, | ||
| - 3 = ``WB2S``, | ||
| - 4 = ``LOG_EI`` (default) | ||
| cstr_infill: | ||
| desc: Enable constrained infill criterion (aka CEI) | ||
| cstr_strategy: | ||
| desc: | | ||
| Constraint strategy enum for surrogate constraint handling: | ||
|
|
||
| - 1 = ``MeanConstraint`` (default) | ||
| - 2 = ``UpperConfidenceBound`` | ||
| qei_config: | ||
| desc: | | ||
| QEiConfig for batch (qEI) point selection passed as a dict with main keys being: | ||
|
|
||
| - ``batch``: size of batch (int) | ||
| - ``strategy``: qEI strategy enum | ||
| infill_optimizer: | ||
| desc: | | ||
| Internal infill optimizer: | ||
|
|
||
| - 1 = ``COBYLA`` (default) | ||
| - 2 = ``SLSQP`` | ||
| trego: | ||
| desc: | | ||
| Enable TREGO (aka Trust Region EGO) algorithm configured with main parameters: | ||
|
|
||
| - ``n_gl_steps``: (nb of global search steps default 1, nb of local search steps default 4) | ||
| - ``beta``: trust region factor (default 0.9) | ||
|
|
||
| coego_n_coop: | ||
| desc: Number of cooperative groups for CoEGO algorithm | ||
| target: | ||
| desc: Known objective target used as stopping criterion | ||
| outdir: | ||
| desc: Output directory for Egor output files (configuration, does, history and warm start search) | ||
| warm_start: | ||
| desc: Load initial DOE from outdir when enabled | ||
| hot_start: | ||
| desc: | | ||
| Egor checkpoint restart parameter to be used in case of fallible environment | ||
| to continue with the same Egor parameterization till max iterations or timeout is reached. | ||
| failsafe_strategy: | ||
| desc: | | ||
| Failure handling enum | ||
|
|
||
| - 1 = ``REJECTION`` (default), | ||
| - 2 = ``IMPUTATION``, | ||
| - 3 = ``PROBA OF VIABILITY`` | ||
| seed: | ||
| desc: Seed for random number generator (default -1 for random seed) | ||
| verbose: | ||
| desc: | | ||
| Verbosity level for Egor logging | ||
|
|
||
| - 0 = ``error`` (default) | ||
| - 1 = ``warning`` | ||
| - 2 = ``info`` | ||
| - 3 = ``debug`` | ||
| max_iters: | ||
| desc: Egor iteration budget | ||
| run_info: | ||
| desc: Optional RunInfo used to pass additional information to Egor (e.g., for logging) | ||
| timeout: | ||
| desc: Optional timeout in seconds used as sttopping criterion for Egor minimize | ||
| fcstrs: | ||
| desc: | | ||
| Optional list of native Egobox function constraints passed directly as fcstrs | ||
| (instead of pyOptSparse constraints which are metamodelized) | ||
| fcstr_specs: | ||
| desc: | | ||
| Optional list of egobox.CstrSpec for function constraints passed as fcstrs |
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
Empty file.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.