Skip to main content

A collection of analytical benchmark functions in multiple fidelities

Project description

Multi-Fidelity-Functions

Package Info Status Support
PyPI version Build Status Documentation Status
Conda Coverage Status Gitter
PyPI - Python Version Codacy Badge
License: GPL v3 Project Status: Active – The project has reached a stable, usable state and is being actively developed.
status

Introduction

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

Installation

The recommended way to install mf2 is with Python's pip:

python3 -m pip install --user mf2

or alternatively using conda:

conda install -c sjvrijn 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 .
python3 -m pip install -r requirements-dev.txt

Example Usage

import mf2
import numpy as np

# create multi-fildelity Forrester function object in two dimensions
forrester = mf2.Forrester(ndim=2)

# 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(forrester.high(X))
# Out: array([ 6.20598519, -2.90702413, -0.96082789,  0.78490341, -2.56183228])

# print low fidelity function values
print(forrester.low(X))
# Out: array([6.47672047, 1.89322581, 7.95952025, 5.77115291, 2.17314591])

For more usage examples, please refer to the full documentation on readthedocs.

Contributing

Contributions to this project are more than welcome!

Bugs

If you've found a problem of some sort, please open an issue on GitHub.

Additions

To add new functions to this package, you can roughly follow the following steps:

  1. Implement the function in a new file in the appropriate (sub)folder
  2. Add it to the tests:
    • add the function in the tests/property_test.py and tests/regression_test.py files
    • run python3 -m tests.create_regression_data to generate the new data files
    • run the tests
  3. Make sure to commit all new and updated files to git (Travis-CI will complain otherwise ;)
  4. Create a pull-request!

If you need any help with this process, please get in touch as outlined under Contact.

Contact

The Gitter channel is the preferred way to get in touch for any other questions, comments or discussions about this package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mf2-2020.4.1.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

mf2-2020.4.1-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file mf2-2020.4.1.tar.gz.

File metadata

  • Download URL: mf2-2020.4.1.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.3

File hashes

Hashes for mf2-2020.4.1.tar.gz
Algorithm Hash digest
SHA256 fb8c2dd0af95e45b2e324eb73c58e3805ef3b364c94dd404d2b737e8cfc45a25
MD5 96de5589cc687eaba2f313eab469b2be
BLAKE2b-256 bb3774d5d2c0cef18f2605e4c18fdd50ff70a9b3c5f6b5d0a3d950d6a858bde1

See more details on using hashes here.

File details

Details for the file mf2-2020.4.1-py3-none-any.whl.

File metadata

  • Download URL: mf2-2020.4.1-py3-none-any.whl
  • Upload date:
  • Size: 40.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.3

File hashes

Hashes for mf2-2020.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b25512ae2aa0960530c28f26d554f4832240aece875f7253b8028c6b203de219
MD5 3b40c821895dc5b5c05a362476473a2c
BLAKE2b-256 737ba062dced9f2ef0229423a0edf4aed5188c13c1efb02c7009cd31652aa408

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page