Package Info | Status | Support |
---|---|---|
This package contains Python implementations for a variety of multi-fidelity benchmark functions typically used in numerical optimization research.
A multi-fidelity function usually reprensents an objective which should be optimized. The term 'multi-fidelity' refers to the fact that multiple versions of the objective function exist, which differ in the accuracy to describe the real objective. A typical real-world example would be the aerodynamic efficiency of an airfoil, e.g., its drag value for a given lift value. The different fidelity levels are given by the accuracy of the evaluation method used to estimate the efficiency. Lower-fidelity versions of the objective function refer to less accurate, but simpler approximations of the objective, such as computational fluid dynamic simulations on rather coarse meshes, whereas higher fidelity levels refer to more accurate but also much more demanding evaluations such as prototype tests in wind tunnels. The hope of multi-fildelity optimization approaches is that many of the not-so-accurate but simple low-fidelity evaluations can be used to achieve improved results on the realistic high-fidelity version of the objective where only very few evaluations can be performed.
The only dependency of the mf2 package is the numpy
package.
Documentation is available at mf2.readthedocs.io
The recommended way to install mf2
is with Python's pip
:
python3 -m pip install --user mf2
or alternatively using conda
:
conda install -c conda-forge mf2
For the latest version, you can install directly from source:
python3 -m pip install --user https://github.com/sjvrijn/mf2/archive/master.zip
To work in your own version locally, it is best to clone the repository first, and additionally install the dev-requirements:
git clone https://github.com/sjvrijn/mf2.git
cd mf2
python3 -m pip install --user -e .[dev]
import mf2
import numpy as np
# set numpy random seed for reproducibility
np.random.seed(42)
# generate 5 random samples in 2D as matrix
X = np.random.random((5, 2))
# print high fidelity function values
print(mf2.branin.high(X))
# Out: array([36.78994906 34.3332972 50.48149005 43.0569396 35.5268224 ])
# print low fidelity function values
print(mf2.branin.low(X))
# Out: array([-5.8762639 -6.66852889 3.84944507 -1.56314141 -6.23242223])
For more usage examples, please refer to the full documentation on readthedocs.
Contributions to this project are more than welcome!
If you've found a problem of some sort, please open an issue on GitHub.
To add new functions to this package, you can roughly follow the following steps:
- Implement the function in a new file in the appropriate (sub)folder
- Add it to the tests:
- Add the function in the
tests/property_test.py
andtests/regression_test.py
files - Run the tests:
pytest tests
. It will fail the first time while thepytest-regressions
package automatically creates the new output files. - Run the tests again to confirm that all tests now pass.
- Add the function in the
- Make sure to commit all new and updated files to git (Travis-CI will complain otherwise ;)
- Create a pull-request!
If you need any help with this process, please get in touch as outlined under Contact.
The Gitter channel is the preferred way to get in touch for any other questions, comments or discussions about this package.