egobox, a Rust toolbox for efficient global optimization

egobox, a Rust toolbox for efficient global optimization - Published in JOSS (2022)

https://github.com/relf/egobox

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 21 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: arxiv.org, researchgate.net, springer.com, joss.theoj.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

gaussian-processes global-optimization latin-hypercube-sampling mixture-of-experts surrogate-models

Keywords from Contributors

blackhole gravitational-lenses meshes pypi annotations simulations hydrology stellar exoplanets pde

Scientific Fields

Economics Social Sciences - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

Efficient global optimization toolbox in Rust: bayesian optimization, mixture of gaussian processes, sampling methods

Basic Info
Statistics
  • Stars: 133
  • Watchers: 3
  • Forks: 9
  • Open Issues: 14
  • Releases: 48
Topics
gaussian-processes global-optimization latin-hypercube-sampling mixture-of-experts surrogate-models
Created over 5 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License

README.md

Efficient Global Optimization toolbox in Rust

EGObox - Efficient Global Optimization toolbox

tests pytests linting DOI

Rust toolbox for Efficient Global Optimization method (arguably the most well-known bayesian optimization algorithm) which adresses the gradient-free optimization of expensive objective functions.

The egobox package is twofold:

  1. for end-users: a Python module, the Python binding of the optimizer named Egor and the surrogate model Gpx, mixture of Gaussian processes, written in Rust.
  2. for developers: a set of Rust libraries useful to implement bayesian optimization (EGO-like) algorithms,

The Python module

Installation

bash pip install egobox

Egor optimizer

```python import numpy as np import egobox as egx

Objective function

def f_obj(x: np.ndarray) -> np.ndarray: return (x - 3.5) * np.sin((x - 3.5) / (np.pi))

Minimize f_opt in [0, 25]

res = egx.Egor([[0.0, 25.0]], seed=42).minimize(fobj, maxiters=20) print(f"Optimization f={res.yopt} at {res.xopt}") # Optimization f=[-15.12510323] at [18.93525454] ```

See also this example written in Rust

Gpx surrogate model

```python import numpy as np import matplotlib.pyplot as plt import egobox as egx

Training

xtrain = np.array([0.0, 1.0, 2.0, 3.0, 4.0]) ytrain = np.array([0.0, 1.0, 1.5, 0.9, 1.0]) gpx = egx.Gpx.builder().fit(xtrain, ytrain)

Prediction

xtest = np.linspace(0, 4, 100).reshape((-1, 1)) ytest = gpx.predict(xtest)

Plot

plt.plot(xtest, ytest) plt.plot(xtrain, ytrain, "o") plt.show() ```

See also this example written in Rust

See the tutorial notebooks and examples folder for more information on the usage of the optimizer and mixture of Gaussian processes surrogate model.

The Rust libraries

egobox Rust libraries consists of the following sub-packages.

| Name | Version | Documentation | Description | | :---------------------------------------------------- | :---------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------- | | doe | crates.io | docs | sampling methods; contains LHS, FullFactorial, Random methods | | gp | crates.io | docs | gaussian process regression; contains Kriging, PLS dimension reduction and sparse methods | | moe | crates.io | docs | mixture of experts using GP models | | ego | crates.io | docs | efficient global optimization with constraints and mixed integer handling |

Usage

Depending on the sub-packages you want to use, you have to add following declarations to your Cargo.toml

text [dependencies] egobox-doe = { version = "0.32" } egobox-gp = { version = "0.32" } egobox-moe = { version = "0.32" } egobox-ego = { version = "0.32" }

Features

The table below presents the various features available depending on the subcrate

| Name | doe | gp | moe | ego | | :----------- | :--- | :--- | :--- | :--- | | serializable | ✔️ | ✔️ | ✔️ | | | persistent | | | ✔️ | ✔️(*) | | blas | | ✔️ | ✔️ | ✔️ | | nlopt | | ✔️ | | ✔️ |

(*) for persistent mixture of gaussian processes with discrete variable available in ego

serializable

When selected, the serialization with serde crate is enabled.

persistent

When selected, the save and load as a json file with serde_json crate is enabled.

blas

When selected, the usage of BLAS/LAPACK backend is possible, see below for more information.

nlopt

When selected, the nlopt crate is used to provide optimizer implementations (ie Cobyla, Slsqp)

Examples

Examples (in examples/ sub-packages folder) are run as follows:

bash cd doe && cargo run --example samplings --release

bash cd gp && cargo run --example kriging --release

bash cd moe && cargo run --example clustering --release

bash cd ego && cargo run --example ackley --release

BLAS/LAPACK backend (optional)

egobox relies on linfa project for methods like clustering and dimension reduction, but also try to adopt as far as possible the same coding structures.

As for linfa, the linear algebra routines used in gp, moe ad ego are provided by the pure-Rust linfa-linalg crate, the default linear algebra provider.

Otherwise, you can choose an external BLAS/LAPACK backend available through the ndarray-linalg crate. In this case, you have to specify the blas feature and a linfa BLAS/LAPACK backend feature (more information in linfa features).

Thus, for instance, to use gp with the Intel MKL BLAS/LAPACK backend, you could specify in your Cargo.toml the following features:

text [dependencies] egobox-gp = { version = "0.32", features = ["blas", "linfa/intel-mkl-static"] }

or you could run the gp example as follows:

bash cd gp && cargo run --example kriging --release --features blas,linfa/intel-mkl-static

Citation

DOI

If you find this project useful for your research, you may cite it as follows:

text @article{ Lafage2022, author = {Rémi Lafage}, title = {egobox, a Rust toolbox for efficient global optimization}, journal = {Journal of Open Source Software} year = {2022}, doi = {10.21105/joss.04737}, url = {https://doi.org/10.21105/joss.04737}, publisher = {The Open Journal}, volume = {7}, number = {78}, pages = {4737}, }

Additionally, you may consider adding a star to the repository. This positive feedback improves the visibility of the project.

References

Bartoli, N., Lefebvre, T., Dubreuil, S., Olivanti, R., Priem, R., Bons, N., Martins, J. R. R. A., & Morlier, J. (2019). Adaptive modeling strategy for constrained global optimization with application to aerodynamic wing design. Aerospace Science and Technology, 90, 85–102.

Bouhlel, M. A., Bartoli, N., Otsmane, A., & Morlier, J. (2016). Improving kriging surrogates of high-dimensional design models by partial least squares dimension reduction. Structural and Multidisciplinary Optimization, 53(5), 935–952.

Bouhlel, M. A., Hwang, J. T., Bartoli, N., Lafage, R., Morlier, J., & Martins, J. R. R. A. (2019). A python surrogate modeling framework with derivatives. Advances in Engineering Software, 102662.

Dubreuil, S., Bartoli, N., Gogu, C., & Lefebvre, T. (2020). Towards an efficient global multi-disciplinary design optimization algorithm Structural and Multidisciplinary Optimization, 62(4), 1739–1765.

Jones, D. R., Schonlau, M., & Welch, W. J. (1998). Efficient global optimization of expensive black-box functions. Journal of Global Optimization, 13(4), 455–492.

Diouane, Youssef, et al. TREGO: a trust-region framework for efficient global optimization. Journal of Global Optimization 86.1 (2023): 1-23.

Priem, Rémy, Nathalie Bartoli, and Youssef Diouane. On the use of upper trust bounds in constrained Bayesian optimization infill criteria. AIAA aviation 2019 forum. 2019.

Sasena M., Papalambros P., Goovaerts P., 2002. Global optimization of problems with disconnected feasible regions via surrogate modeling. AIAA Paper.

Ginsbourger, D., Le Riche, R., & Carraro, L. (2010). Kriging is well-suited to parallelize optimization

E.C. Garrido-Merchan and D. Hernandez-Lobato. Dealing with categorical and integer-valued variables in Bayesian Optimization with Gaussian processes.

Zhan, Dawei, et al. A cooperative approach to efficient global optimization. Journal of Global Optimization 88.2 (2024): 327-357

Lisa Pretsch et al. Bayesian optimization of cooperative components for multi-stage aero-structural compressor blade design. Struct Multidisc Optim 68, 84 (2025)

Appriou, T., Rullière, D. & Gaudrie, D, Combination of optimization-free kriging models for high-dimensional problems, Comput Stat 39, 3049–3071 (2024).

S Ament, S Daulton, D Eriksson, M Balandat, E Bakshy, Unexpected improvements to expected improvement for bayesian optimization, Advances in Neural Information Processing Systems, 2023

smtorg. (2018). Surrogate modeling toolbox. GitHub.

License

Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0

Owner

  • Name: Rémi Lafage
  • Login: relf
  • Kind: user
  • Location: Toulouse, France
  • Company: ONERA

Research engineer at ONERA, working on tools related to multi-disciplinary optimization for overall vehicle design.

JOSS Publication

egobox, a Rust toolbox for efficient global optimization
Published
October 09, 2022
Volume 7, Issue 78, Page 4737
Authors
Rémi Lafage ORCID
ONERA, Université de Toulouse, France
Editor
Arfon Smith ORCID
Tags
design of experiments gaussian process mixture of experts surrogate-based optimization

GitHub Events

Total
  • Create event: 63
  • Release event: 12
  • Issues event: 18
  • Watch event: 64
  • Delete event: 58
  • Issue comment event: 53
  • Push event: 232
  • Pull request review comment event: 9
  • Pull request review event: 10
  • Pull request event: 112
  • Fork event: 6
Last Year
  • Create event: 63
  • Release event: 12
  • Issues event: 18
  • Watch event: 64
  • Delete event: 58
  • Issue comment event: 53
  • Push event: 232
  • Pull request review comment event: 9
  • Pull request review event: 10
  • Pull request event: 112
  • Fork event: 6

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 582
  • Total Committers: 6
  • Avg Commits per committer: 97.0
  • Development Distribution Score (DDS): 0.017
Past Year
  • Commits: 94
  • Committers: 5
  • Avg Commits per committer: 18.8
  • Development Distribution Score (DDS): 0.043
Top Committers
Name Email Commits
relf r****e@o****r 572
dependabot[bot] 4****] 6
jomorlier j****r@i****r 1
Jusong Yu j****u@g****m 1
Jonas Pleyer 5****r 1
Arfon Smith a****n 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 31
  • Total pull requests: 369
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 4 days
  • Total issue authors: 14
  • Total pull request authors: 8
  • Average comments per issue: 2.55
  • Average comments per pull request: 0.16
  • Merged pull requests: 302
  • Bot issues: 2
  • Bot pull requests: 54
Past Year
  • Issues: 14
  • Pull requests: 149
  • Average time to close issues: 22 days
  • Average time to close pull requests: 4 days
  • Issue authors: 6
  • Pull request authors: 7
  • Average comments per issue: 2.64
  • Average comments per pull request: 0.26
  • Merged pull requests: 107
  • Bot issues: 1
  • Bot pull requests: 29
Top Authors
Issue Authors
  • relf (13)
  • unkcpz (4)
  • jonaspleyer (2)
  • dependabot[bot] (2)
  • YuhanLiin (1)
  • wangjiawen2013 (1)
  • Zcaic (1)
  • kyle-messier (1)
  • s4ksb (1)
  • quietlychris (1)
  • brurucy (1)
  • schliffen (1)
  • janroden (1)
  • bytesnake (1)
Pull Request Authors
  • relf (303)
  • dependabot[bot] (54)
  • unkcpz (3)
  • jomorlier (2)
  • zao111222333 (2)
  • Mayousk (2)
  • jonaspleyer (2)
  • arfon (1)
Top Labels
Issue Labels
enhancement (2) dependencies (2) rust (2) ego (1) bug (1) gp (1) doe (1)
Pull Request Labels
dependencies (54) rust (43) github_actions (2)

Packages

  • Total packages: 6
  • Total downloads:
    • cargo 218,376 total
    • pypi 7,213 last-month
  • Total dependent packages: 13
    (may contain duplicates)
  • Total dependent repositories: 5
    (may contain duplicates)
  • Total versions: 261
  • Total maintainers: 2
pypi.org: egobox
  • Versions: 49
  • Dependent Packages: 3
  • Dependent Repositories: 1
  • Downloads: 7,213 Last month
Rankings
Downloads: 6.7%
Dependent packages count: 10.1%
Stargazers count: 10.4%
Average: 14.3%
Dependent repos count: 21.5%
Forks count: 22.6%
Maintainers (1)
Last synced: 4 months ago
crates.io: egobox-doe

A library for design of experiments

  • Versions: 44
  • Dependent Packages: 4
  • Dependent Repositories: 1
  • Downloads: 48,597 Total
Rankings
Dependent packages count: 7.4%
Dependent repos count: 16.5%
Stargazers count: 18.6%
Average: 19.7%
Downloads: 25.0%
Forks count: 30.8%
Maintainers (1)
Last synced: 4 months ago
crates.io: egobox-gp

A library for gaussian process modeling

  • Versions: 44
  • Dependent Packages: 3
  • Dependent Repositories: 1
  • Downloads: 44,910 Total
Rankings
Dependent packages count: 9.2%
Dependent repos count: 16.5%
Stargazers count: 18.6%
Average: 20.4%
Downloads: 27.0%
Forks count: 30.8%
Maintainers (1)
Last synced: 4 months ago
crates.io: egobox-moe

A library for mixture of expert gaussian processes

  • Versions: 45
  • Dependent Packages: 2
  • Dependent Repositories: 1
  • Downloads: 44,913 Total
Rankings
Dependent packages count: 12.2%
Dependent repos count: 16.5%
Stargazers count: 18.6%
Average: 21.4%
Downloads: 29.0%
Forks count: 30.8%
Maintainers (1)
Last synced: 4 months ago
crates.io: egobox-ego

A library for efficient global optimization

  • Versions: 45
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 43,890 Total
Rankings
Dependent repos count: 16.5%
Dependent packages count: 18.2%
Stargazers count: 18.6%
Average: 23.4%
Forks count: 30.8%
Downloads: 32.7%
Maintainers (1)
Last synced: 4 months ago
crates.io: egobox

A python binding for egobox crates

  • Versions: 34
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 36,066 Total
Rankings
Stargazers count: 21.4%
Forks count: 24.8%
Dependent repos count: 29.3%
Dependent packages count: 33.8%
Average: 34.6%
Downloads: 63.9%
Maintainers (1)
Last synced: 4 months ago

Dependencies

Cargo.toml cargo
  • anyhow =1.0.48
  • egobox-doe 0.3.0
  • egobox-ego 0.3.0
  • egobox-gp 0.3.0
  • egobox-moe 0.3.0
  • env_logger 0.9
  • finitediff 0.1
  • libm 0.2
  • linfa 0.6.0
  • log 0.4
  • ndarray 0.15
  • ndarray-rand 0.14
  • numpy 0.15.0
  • pyo3 0.15.1
  • pyo3-log 0.5.0
  • rand_isaac 0.3
doe/Cargo.toml cargo
  • linfa 0.6.0
  • ndarray 0.15
  • ndarray-rand 0.14
  • ndarray-stats 0.5
  • num-traits 0.2
  • rand_isaac 0.3
ego/Cargo.toml cargo
  • egobox-doe 0.3.0
  • egobox-gp 0.3.0
  • egobox-moe 0.3.0
  • env_logger 0.9
  • finitediff 0.1
  • libm 0.2
  • linfa 0.6.0
  • linfa-linalg 0.1
  • linfa-pls 0.6.0
  • log 0.4
  • ndarray 0.15
  • ndarray-linalg 0.14
  • ndarray-npy 0.8
  • ndarray-rand 0.14
  • ndarray-stats 0.5
  • nlopt 0.5.3
  • rand_isaac 0.3
  • rawpointer 0.2
  • serde 1
  • serde_json 1
  • thiserror 1
  • typetag 0.1
gp/Cargo.toml cargo
  • cobyla 0.1.2
  • egobox-doe 0.3.0
  • linfa 0.6.0
  • linfa-linalg 0.1
  • linfa-pls 0.6.0
  • ndarray 0.15
  • ndarray-linalg 0.14
  • ndarray-npy 0.8
  • ndarray-rand 0.14
  • ndarray-stats 0.5
  • ndarray_einsum_beta 0.7
  • nlopt 0.5.3
  • num-traits 0.2
  • paste 1.0
  • rand_isaac 0.3
  • serde 1.0
  • thiserror 1
moe/Cargo.toml cargo
  • bitflags 1.3
  • egobox-doe 0.3.0
  • egobox-gp 0.3.0
  • env_logger 0.9
  • linfa 0.6.0
  • linfa-clustering 0.6.0
  • linfa-linalg 0.1
  • linfa-pls 0.6.0
  • log 0.4
  • ndarray 0.15
  • ndarray-linalg 0.14
  • ndarray-npy 0.8
  • ndarray-rand 0.14
  • ndarray-stats 0.5
  • paste 1.0
  • rand_isaac 0.3
  • serde 1
  • serde_json 1
  • thiserror 1
  • typetag 0.1
pyproject.toml pypi
  • pytest ^6.2 develop
  • numpy >=1.18
  • python >=3.7
.github/workflows/lint.yml actions
  • actions-rs/cargo v1 composite
  • actions-rs/toolchain v1 composite
  • actions/checkout v2 composite
.github/workflows/pytest.yml actions
  • KyleMayes/install-llvm-action v1 composite
  • actions-rs/toolchain v1 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/test.yml actions
  • KyleMayes/install-llvm-action v1 composite
  • actions-rs/cargo v1 composite
  • actions-rs/toolchain v1 composite
  • actions/checkout v2 composite
Dockerfile docker
  • maturin latest build