# botorch.test_functions¶

Synthetic test functions for testing and benchmarking purposes.

class botorch.test_functions.Ackley(dim=2, noise_std=None, negate=False)[source]

Ackley test function.

d-dimensional function (usually evaluated on [-32.768, 32.768]^d):

f(x) = -A exp(-B sqrt(1/d sum_{i=1}^d x_i^2)) -

exp(1/d sum_{i=1}^d cos(c x_i)) + A + exp(1)

f has one minimizer for its global minimum at z_1 = (0, 0, …, 0) with f(z_1) = 0.

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.AugmentedBranin(noise_std=None, negate=False)[source]

Augmented Branin test function for multi-fidelity optimization.

3-dimensional function with domain [-5, 10] x [0, 15] * [0,1], where the last dimension of is the fidelity parameter:

B(x) = (x_2 - (b - 0.1 * (1 - x_3))x_1^2 + c x_1 - r)^2 +

10 (1-t) cos(x_1) + 10

Here b, c, r and t are constants where b = 5.1 / (4 * math.pi ** 2) c = 5 / math.pi, r = 6, t = 1 / (8 * math.pi). B has infinitely many minimizers with x_1 = -pi, pi, 3pi and B_min = 0.397887

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.AugmentedHartmann(noise_std=None, negate=False)[source]

Augmented Hartmann synthetic test function.

7-dimensional function (typically evaluated on [0, 1]^7), where the last dimension is the fidelity parameter.

H(x) = -(ALPHA_1 - 0.1 * (1-x_7)) * exp(- sum_{j=1}^6 A_1j (x_j - P_1j) ** 2) -

sum_{i=2}^4 ALPHA_i exp( - sum_{j=1}^6 A_ij (x_j - P_ij) ** 2)

H has a unique global minimizer x = [0.20169, 0.150011, 0.476874, 0.275332, 0.311652, 0.6573, 1.0]

with H_min = -3.32237

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.AugmentedRosenbrock(dim=3, noise_std=None, negate=False)[source]

Augmented Rosenbrock synthetic test function for multi-fidelity optimization.

d-dimensional function (usually evaluated on [-5, 10]^(d-2) * [0, 1]^2), where the last two dimensions are the fidelity parameters:

f(x) = sum_{i=1}^{d-1} (100 (x_{i+1} - x_i^2 + 0.1 * (1-x_{d-1}))^2 +

(x_i - 1 + 0.1 * (1 - x_d)^2)^2)

f has one minimizer for its global minimum at z_1 = (1, 1, …, 1) with f(z_i) = 0.0.

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Beale(noise_std=None, negate=False)[source]

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Branin(noise_std=None, negate=False)[source]

Branin test function.

Two-dimensional function (usually evaluated on [-5, 10] x [0, 15]):

B(x) = (x_2 - b x_1^2 + c x_1 - r)^2 + 10 (1-t) cos(x_1) + 10

Here b, c, r and t are constants where b = 5.1 / (4 * math.pi ** 2) c = 5 / math.pi, r = 6, t = 1 / (8 * math.pi) B has 3 minimizers for its global minimum at z_1 = (-pi, 12.275), z_2 = (pi, 2.275), z_3 = (9.42478, 2.475) with B(z_i) = 0.397887.

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Bukin(noise_std=None, negate=False)[source]

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Cosine8(noise_std=None, negate=False)[source]

Cosine Mixture test function.

8-dimensional function (usually evaluated on [-1, 1]^8):

f(x) = 0.1 sum_{i=1}^8 cos(5 pi x_i) - sum_{i=1}^8 x_i^2

f has one maximizer for its global maximum at z_1 = (0, 0, …, 0) with f(z_1) = 0.8

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.DixonPrice(dim=2, noise_std=None, negate=False)[source]

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.DropWave(noise_std=None, negate=False)[source]

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.EggHolder(noise_std=None, negate=False)[source]

Eggholder test function.

Two-dimensional function (usually evaluated on [-512, 512]^2):

E(x) = (x_2 + 47) sin(R1(x)) - x_1 * sin(R2(x))

where R1(x) = sqrt(|x_2 + x_1 / 2 + 47|), R2(x) = sqrt|x_1 - (x_2 + 47)|).

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Griewank(dim=2, noise_std=None, negate=False)[source]

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Hartmann(dim=6, noise_std=None, negate=False)[source]

Hartmann synthetic test function.

Most commonly used is the six-dimensional version (typically evaluated on [0, 1]^6):

H(x) = - sum_{i=1}^4 ALPHA_i exp( - sum_{j=1}^6 A_ij (x_j - P_ij)**2 )

H has a 6 local minima and a global minimum at

z = (0.20169, 0.150011, 0.476874, 0.275332, 0.311652, 0.6573)

with H(z) = -3.32237.

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

property optimal_value

The global minimum (maximum if negate=True) of the function.

Return type

float

class botorch.test_functions.HolderTable(noise_std=None, negate=False)[source]

Holder Table synthetic test function.

Two-dimensional function (typically evaluated on [0, 10] x [0, 10]):

H(x) = - | sin(x_1) * cos(x_2) * exp(| 1 - ||x|| / pi | ) |

H has 4 global minima with H(z_i) = -19.2085 at

z_1 = ( 8.05502, 9.66459) z_2 = (-8.05502, -9.66459) z_3 = (-8.05502, 9.66459) z_4 = ( 8.05502, -9.66459)

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Levy(dim=2, noise_std=None, negate=False)[source]

Levy synthetic test function.

d-dimensional function (usually evaluated on [-10, 10]^d):

f(x) = sin^2(pi w_1) +

sum_{i=1}^{d-1} (w_i-1)^2 (1 + 10 sin^2(pi w_i + 1)) + (w_d - 1)^2 (1 + sin^2(2 pi w_d))

where w_i = 1 + (x_i - 1) / 4 for all i.

f has one minimizer for its global minimum at z_1 = (1, 1, …, 1) with f(z_1) = 0.

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Michalewicz(dim=2, noise_std=None, negate=False)[source]

Michalewicz synthetic test function.

d-dim function (usually evaluated on hypercube [0, pi]^d):

M(x) = sum_{i=1}^d sin(x_i) (sin(i x_i^2 / pi)^20)

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Powell(dim=4, noise_std=None, negate=False)[source]

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Rastrigin(dim=2, noise_std=None, negate=False)[source]

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Rosenbrock(dim=2, noise_std=None, negate=False)[source]

Rosenbrock synthetic test function.

d-dimensional function (usually evaluated on [-5, 10]^d):

f(x) = sum_{i=1}^{d-1} (100 (x_{i+1} - x_i^2)^2 + (x_i - 1)^2)

f has one minimizer for its global minimum at z_1 = (1, 1, …, 1) with f(z_i) = 0.0.

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.Shekel(m=10, noise_std=None, negate=False)[source]

Shekel synthtetic test function.

4-dimensional function (usually evaluated on [0, 10]^4):

f(x) = -sum_{i=1}^10 (sum_{j=1}^4 (x_j - A_{ji})^2 + C_i)^{-1}

f has one minimizer for its global minimum at z_1 = (4, 4, 4, 4) with f(z_1) = -10.5363.

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.SixHumpCamel(noise_std=None, negate=False)[source]

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.StyblinskiTang(dim=2, noise_std=None, negate=False)[source]

Styblinski-Tang synthtetic test function.

d-dimensional function (usually evaluated on the hypercube [-5, 5]^d):

H(x) = 0.5 * sum_{i=1}^d (x_i^4 - 16 * x_i^2 + 5 * x_i)

H has a single global mininimum H(z) = -39.166166 * d at z = [-2.903534]^d

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

class botorch.test_functions.SyntheticTestFunction(noise_std=None, negate=False)[source]

Base class for synthetic test functions.

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

abstract evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor

forward(X, noise=True)[source]

Evaluate the function on a set of points.

Parameters
• X (Tensor) – The point(s) at which to evaluate the function.

• noise (bool) – If True, add observation noise as specified by noise_std.

Return type

Tensor

property optimal_value

The global minimum (maximum if negate=True) of the function.

Return type

float

class botorch.test_functions.ThreeHumpCamel(noise_std=None, negate=False)[source]

Base constructor for synthetic test functions.

Parameters
• noise_std (Optional[float]) – Standard deviation of the observation noise.

• negate (bool) – If True, negate the function.

evaluate_true(X)[source]

Evaluate the function (w/o observation noise) on a set of points.

Return type

Tensor