gpmp.misc.testfunctions module

The gpmp.misc.testfunctions module provides deterministic benchmark functions used by examples and diagnostics. Inputs are NumPy arrays with shape (n, d) except for one-dimensional functions that also accept shape (n,). Outputs are one-dimensional arrays with shape (n,).

Common choices are twobumps for one-dimensional interpolation, braninhoo for two-dimensional optimization examples, hartmann4 and hartmann6 for unit-hypercube tests, and ishigami for sensitivity and screening examples.

Collection of test functions used in examples and diagnostics.

gpmp.misc.testfunctions.borehole(x)[source]

Compute the water flow rate through a borehole.

The Borehole function models water flow through a borehole. Its simplicity and quick evaluation makes it a commonly used function for testing a wide variety of methods in computer experiments.

Parameters:

x (numpy.ndarray of shape (n_samples, 8)) –

The input variables and their usual input ranges:

  • rw : radius of borehole in meters, range [0.05, 0.15]

  • r : radius of influence in meters, range [100, 50000]

  • Tu : transmissivity of upper aquifer in m^2/yr, range [63070, 115600]

  • Hu : potentiometric head of upper aquifer in meters, range [990, 1110]

  • Tl : transmissivity of lower aquifer in m^2/yr, range [63.1, 116]

  • Hl : potentiometric head of lower aquifer in meters, range [700, 820]

  • L : length of borehole in meters, range [1120, 1680]

  • Kw : hydraulic conductivity of borehole in m/yr, range [9855, 12045]

Returns:

The water flow rate in m^3/yr.

Return type:

numpy.ndarray of shape (n_samples,)

Notes

The distributions of the input random variables are:

  • rw ~ N(0.10, 0.0161812)

  • r ~ Lognormal(7.71, 1.0056)

  • Tu ~ Uniform[63070, 115600]

  • Hu ~ Uniform[990, 1110]

  • Tl ~ Uniform[63.1, 116]

  • Hl ~ Uniform[700, 820]

  • L ~ Uniform[1120, 1680]

  • Kw ~ Uniform[9855, 12045]

Above, N(µ, s^2) is the Normal distribution with mean µ and variance s^2. Lognormal(µ, s) is the Lognormal distribution of a variable, such that the natural logarithm of the variable has a N(µ, s^2) distribution.

References

  • Harper, W. V., & Gupta, S. K. (1983). Sensitivity/uncertainty analysis of a borehole scenario comparing Latin Hypercube Sampling and deterministic sensitivity approaches (No. BMI/ONWI-516). Battelle Memorial Inst., Columbus, OH (USA). Office of Nuclear Waste Isolation.

Authors: Sonja Surjanovic and Derek Bingham, Simon Fraser University

Original copyright notice: Copyright 2013. Derek Bingham, Simon Fraser University.

gpmp.misc.testfunctions.braninhoo(x)[source]

The Branin-Hoo function is a classical test function for global optimization algorithms, which belongs to the well-known Dixon-Szego test set. It is usually minimized over [-5; 10] x [0; 15].

Parameters:

x (numpy.array) – 2D array of shape (n, 2) where each row represents a point in the 2D space to evaluate the function.

Returns:

A 1D array of shape (n,) containing the Branin-Hoo function values evaluated at the input points.

Return type:

numpy.array

References

  • Branin, F. H. and Hoo, S. K. (1972), A Method for Finding Multiple Extrema of a Function of n Variables, in Numerical methods of Nonlinear Optimization (F. A. Lootsma, editor, Academic Press, London), 231-237.

  • Dixon L.C.W., Szego G.P., Towards Global Optimization 2, North- Holland, Amsterdam, The Netherlands (1978).

  • Surjanovic, S. and Bingham D. (2013), Branin Function, https://www.sfu.ca/~ssurjano/Code/braninm.html

gpmp.misc.testfunctions.detpep8d(x)[source]

Dette & Pepelyshev (2010) 8-Dimensional Function

This function is used for the comparison of computer experiment designs. It is highly curved in some variables and less in others.

Input Domain:

The function is evaluated on the hypercube \(x_i \in [0, 1], i = 1, \ldots, 8\).

Parameters:

x (numpy.ndarray) – 2D array of shape (n, 8) containing n samples with 8 variables each

Returns:

1D array of shape (n,) containing the function values for each input sample

Return type:

numpy.ndarray

References

  • Dette, H., & Pepelyshev, A. (2010). Generalized Latin hypercube design for computer experiments. Technometrics, 52(4).

Based on https://www.sfu.ca/~ssurjano/detpep108d.html

Authors: Sonja Surjanovic and Derek Bingham, Simon Fraser University

Original copyright notice: Copyright 2013. Derek Bingham, Simon Fraser University.

gpmp.misc.testfunctions.hartmann4(x)[source]

Hartmann 4-dimensional function.

The 4-dimensional Hartmann function is a multimodal function defined on the unit hypercube (i.e., xi in (0, 1), for all i = 1, …, 4). It is commonly used as a test problem in global optimization.

Parameters:

x (numpy.ndarray) – An array of shape (n_samples, 4) containing the input points.

Returns:

An array of shape (n_samples,) containing the function values at the input points.

Return type:

numpy.ndarray

Notes

The Hartmann 4-dimensional function has 6 local minima and one global minimum. The global minimum is located at x* = [0.20169, 0.15001, 0.47687, 0.27533] and has a function value of f(x*) = -3.86278. The function is generally considered to be difficult to optimize.

References

  • Dixon, L. C. W., & Szego, G. P. (1978). The global optimization problem: an introduction. Towards global optimization, 2, 1-15.

  • Picheny, V., Wagner, T., & Ginsbourger, D. (2012). A benchmark of kriging-based infill criteria for noisy optimization. Based on https://www.sfu.ca/~ssurjano/hart6.html

Authors: Sonja Surjanovic and Derek Bingham, Simon Fraser University

Original copyright notice: Copyright 2013. Derek Bingham, Simon Fraser University.

gpmp.misc.testfunctions.hartmann6(x)[source]

Hartmann 6-dimensional function.

The 6-dimensional Hartmann function has 6 local minima and a a global minimum f(x*) = -3.32237.

\[f(x) = - \sum_{i=1}^4 \alpha_i \exp \bigl(-\sum_{j=1}^6 A_{ij}(x_j - P_{ij})^2 \bigr)\]

where \(x_i \in (0, 1)\) for all \(i = 1, \ldots, 6\).

Parameters:

x (numpy.ndarray) – An array of shape (n, 6) containing the input values.

Returns:

An array of shape (n,) containing the function values.

Return type:

numpy.ndarray

Notes

References

  • Dixon, L. C. W., & Szego, G. P. (1978). The global optimization problem: an introduction. Towards global optimization, 2, 1-15.

  • Picheny, V., Wagner, T., & Ginsbourger, D. (2012). A benchmark of kriging-based infill criteria for noisy optimization. Based on https://www.sfu.ca/~ssurjano/hart6.html

Authors: Sonja Surjanovic and Derek Bingham, Simon Fraser University

Original copyright notice: Copyright 2013. Derek Bingham, Simon Fraser University.

gpmp.misc.testfunctions.ishigami(x)[source]

Ishigami function.

The Ishigami function is a 3-dimensional benchmark function commonly used for testing uncertainty quantification and sensitivity analysis methods. It is defined as:

\[f(x) = \sin(x_1) + 5 \sin^2(x_2) + 0.1 x_3^4 \sin(x_1)\]
Parameters:

x (numpy.ndarray) – 2D array of shape (n, 3) containing n samples with 3 variables each. Each variable should be in the range [-π, π].

Returns:

1D array of shape (n,) containing the function values.

Return type:

numpy.ndarray

Notes

This function has useful properties: - It is moderately nonlinear with multimodal behavior - Suitable for global optimization and sensitivity analysis testing - Standard parameters: a = 5, b = 0.1

References

Ishigami, T., & Homma, T. (1990). An importance quantification technique in uncertainty analysis for computer models. IEEE Transactions on Reliability, 39(3), 352-360.

gpmp.misc.testfunctions.twobumps(x)[source]

Computes the response Z of the TwoBumps function at X.

The TwoBumps function is defined as:

TwoBumps(x) = - (0.7x + sin(5x + 1) + 0.1 sin(10x))

Parameters:

x (numpy.ndarray) – Input array of shape (n,)

Returns:

Output array of shape (n,)

Return type:

numpy.ndarray

gpmp.misc.testfunctions.wave(x)[source]

Computes the Wave function.

The Wave function is a popular test function used in optimization problems. It has multiple local minima and a single global minimum. It is defined as follows:

\[f(x) = e^{1.8(x_1 + x_2)} + 3x_1 + 6x_2^2 + 3\sin(4\pi x_1)\]

where x is a 2-dimensional numpy array in the range [-1, 1] x [-1, 1].

Parameters:

x (numpy.ndarray) – A 2-dimensional numpy array containing the input values of the function. The shape of the array should be (n, 2), where n is the number of input points.

Returns:

A 1-dimensional numpy array containing the output values of the function. The shape of the array is (n,).

Return type:

numpy.ndarray