egobox 0.19.0

A toolbox for efficient global optimization


tests pytests linting DOI

Rust toolbox for Efficient Global Optimization algorithms inspired from SMT.

egobox 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

Thanks to the PyO3 project, which makes Rust well suited for building Python extensions. You can install the Python package using:

pip install egobox

See the tutorial notebooks for 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 docs sampling methods; contains LHS, FullFactorial, Random methods
gp docs gaussian process regression; contains Kriging, PLS dimension reduction and sparse methods
moe docs mixture of experts using GP models
ego docs efficient global optimization with constraints and mixed integer handling


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

egobox-doe = { version = "0.19" }
egobox-gp  = { version = "0.19" }
egobox-moe = { version = "0.19" }
egobox-ego = { version = "0.19" }


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

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

(*) required for mixed-variable gaussian process


When selected, the serialization with serde crate is enabled.


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


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


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


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

cd doe && cargo run --example samplings --release
cd gp && cargo run --example kriging --release
cd moe && cargo run --example clustering --release
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:

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

or you could run the gp example as follows:

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



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

  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 = {}, 
  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.