botorch.test_functions
Abstract Test Function API
Base class for test functions for optimization benchmarks.
- botorch.test_functions.base.validate_parameter_indices(dim, bounds, continuous_inds, discrete_inds, categorical_inds)[source]
Check that the parameter indices are valid.
- Parameters:
dim (int) – Number of search space dimensions.
bounds (Tensor) – A
2 x d-dim tensor of lower and upper bounds.continuous_inds (list[int]) – List of unique integers corresponding to continuous parameters.
discrete_inds (list[int]) – List of unique integers corresponding to discrete parameters.
categorical_inds (list[int]) – List of unique integers corresponding to categorical parameters.
- Raises:
ValueError – If the parameter indices are invalid.
- Return type:
None
- botorch.test_functions.base.validate_inputs(X, dim, bounds, discrete_inds, categorical_inds)[source]
Check that the inputs are valid.
This method checks that the input tensor
Xhas the correct shape, is within the bounds, and that the discrete and categorical parameters are integer-valued.- Parameters:
X (Tensor) – A
(batch_shape) x n x d-dim tensor of point(s) at which to evaluatedim (int) – Number of search space dimensions.
bounds (Tensor) – A
2 x d-dim tensor of lower and upper bounds.discrete_inds (list[int]) – List of unique integers corresponding to discrete parameters.
categorical_inds (list[int]) – List of unique integers corresponding to categorical parameters.
- Raises:
ValueError – If the parameter indices are invalid.
- Return type:
None
- class botorch.test_functions.base.BaseTestProblem(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
Module,ABCBase class for test functions.
Base constructor for test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int
- continuous_inds: list[int] = []
- discrete_inds: list[int] = []
- categorical_inds: list[int] = []
- forward(X, noise=True)[source]
Evaluate the function on a set of points.
- Parameters:
X (Tensor) – A
(batch_shape) x d-dim tensor of point(s) at which to evaluate the function.noise (bool) – If
True, add observation noise as specified bynoise_std.
- Returns:
A
batch_shape-dim tensor of function evaluations.- Return type:
Tensor
- evaluate_true(X)[source]
Evaluate the function (w/o observation noise) on a set of points.
- Parameters:
X (Tensor) – A
(batch_shape) x d-dim tensor of point(s) at which to evaluate.- Returns:
A
batch_shape-dim tensor.- Return type:
Tensor
- property is_minimization_problem: bool
Whether the problem is a minimization problem, after accounting for the
negateoption.
- class botorch.test_functions.base.ConstrainedBaseTestProblem(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
BaseTestProblem,ABCBase class for test functions with constraints.
In addition to one or more objectives, a problem may have a number of outcome constraints of the form
c_i(x) >= 0fori=1, ..., n_c.This base class provides common functionality for such problems.
Base constructor for test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- num_constraints: int
- constraint_noise_std: None | float | list[float] = None
- evaluate_slack(X, noise=True)[source]
Evaluate the constraint slack on a set of points.
Constraints
iis assumed to be feasible atxif the associated slackc_i(x)is positive. Zero slack means that the constraint is active. Negative slack means that the constraint is violated.- Parameters:
X (Tensor) – A
batch_shape x d-dim tensor of point(s) at which to evaluate the constraint slacks:c_1(X), ...., c_{n_c}(X).noise (bool) – If
True, add observation noise to the slack as specified bynoise_std.
- Returns:
- A
batch_shape x n_c-dim tensor of constraint slack (where positive slack corresponds to the constraint being feasible).
- A
- Return type:
Tensor
- is_feasible(X, noise=True)[source]
Evaluate whether the constraints are feasible on a set of points.
- Parameters:
X (Tensor) – A
batch_shape x d-dim tensor of point(s) at which to evaluate the constraints.noise (bool) – If
True, add observation noise as specified bynoise_std.
- Returns:
- A
batch_shape-dim boolean tensor that isTrueiff all constraint slacks (potentially including observation noise) are positive.
- A
- Return type:
Tensor
- evaluate_slack_true(X)[source]
Evaluate the constraint slack (w/o observation noise) on a set of points.
- Parameters:
X (Tensor) – A
batch_shape x d-dim tensor of point(s) at which to evaluate the constraint slacks:c_1(X), ...., c_{n_c}(X).- Returns:
- A
batch_shape x n_c-dim tensor of constraint slack (where positive slack corresponds to the constraint being feasible).
- A
- Return type:
Tensor
- property worst_feasible_value: float
The worst feasible value of the objective function. This is useful when evaluating the performance of different optimization methods as this value can be assigned to all infeasible trials. This has the desirable property that any feasible trial has better performance than an infeasible trial.
- class botorch.test_functions.base.MultiObjectiveTestProblem(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
BaseTestProblem,ABCBase class for multi-objective test functions.
TODO: add a pareto distance function that returns the distance between a provided point and the closest point on the true pareto front.
Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- num_objectives: int
- property max_hv: float
- gen_pareto_front(n)[source]
Generate
npareto optimal points.- Parameters:
n (int)
- Return type:
Tensor
- property is_minimization_problem: bool
Whether the problem is a minimization problem, after accounting for the
negateoption.
- class botorch.test_functions.base.SeedingMixin[source]
Bases:
ABC- property has_seeds: bool
- property seed: int | None
- botorch.test_functions.base.constant_outlier_generator(problem, X, bounds, constant)[source]
Generates outliers that are all the same constant. To be used in conjunction with
partialto fix the constant value and conform to theOutlierGeneratorprotocol.Example
>>> generator = partial(constant_outlier_generator, constant=1.0)
- Parameters:
problem (Any) – Not used.
X (Tensor) – The
batch_shape x n x d-dim inputs. Also determines the number, dtype, and device of the returned tensor.bounds (Any) – Not used.
constant (float) – The constant value of the outliers.
- Returns:
Tensor of shape
batch_shape x n(1d if unbatched).- Return type:
Tensor
- class botorch.test_functions.base.CorruptedTestProblem(base_test_problem, outlier_generator, outlier_fraction, bounds=None, seeds=None)[source]
Bases:
BaseTestProblem,SeedingMixinA problem with outliers.
NOTE: Both noise_std and negate will be taken from the base test problem.
- Parameters:
base_test_problem (BaseTestProblem) – The base function to be corrupted.
outlier_generator (OutlierGenerator) – A function that generates outliers. It will be called with arguments
f,Xandbounds, wherefis thebase_test_problem,Xis the argument passed to theforwardmethod, andboundsare as here, and it returns the values of outliers.outlier_fraction (float) – The fraction of outliers.
bounds (list[tuple[float, float]] | None) – The bounds of the function.
seeds (Iterable[int] | None) – The seeds to use for the outlier generator. If seeds are provided, the problem will iterate through the list of seeds, changing the seed with a call to
next(seeds)with everyforwardcall. If a list is provided, it will first be converted to an iterator.
- dim: int
Synthetic Test Functions
Synthetic functions for optimization benchmarks.
Most test functions (if not indicated otherwise) are taken from [Bingham2013virtual].
References:
D. Bingham, S. Surjanovic. Virtual Library of Simulation Experiments. https://www.sfu.ca/~ssurjano/optimization.html
C. A. Coello Coello and E. Mezura Montes. Constraint-handling in genetic algorithms through the use of dominance-based tournament selection. Advanced Engineering Informatics, 16(3):193–203, 2002.
R. Gramacy, G. Gray, S. Le Digabel, H. Lee, P. Ranjan, G. Wells & S. Wild. Modeling an Augmented Lagrangian for Blackbox Constrained Optimization, Technometrics, 2016.
A.-R. Hedar and M. Fukushima. Derivative-free filter simulated annealing method for constrained continuous global optimization. Journal of Global Optimization, 35(4):521–549, 2006.
A. C. C. Lemonge, H. J. C. Barbosa, C. C. H. Borges, and F. B. dos Santos Silva. Constrained optimization problems in mechanical engineering design using a real-coded steady-state genetic algorithm. Mecánica Computacional, XXIX:9287–9303, 2010.
B. Letham, B. Karrer, G. Ottoni, and E. Bakshy. Constrained Bayesian Optimization with Noisy Experiments. Bayesian Analysis, Bayesian Anal. 14(2), 495-519, 2019.
S. K. Mishra. Minimization of Keane’s Bump Function by the Repulsive Particle Swarm and the Differential Evolution Methods (May 1, 2007). Available at SSRN: https://ssrn.com/abstract=983836.
T. Packebusch, S. Mertens. Low autocorrelation binary sequences. Journal of Physics A: Mathematical and Theoretical 49.16 (2016).
- class botorch.test_functions.synthetic.SyntheticTestFunction(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
BaseTestProblem,ABCBase class for synthetic test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- num_objectives: int = 1
- property optimal_value: float
The global optimum of the function.
This can be either the minimum or maximum depending the value of
self.is_minimization_problem.
- class botorch.test_functions.synthetic.Ackley(dim=2, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionAckley 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)withf(z_1) = 0.- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype)
- class botorch.test_functions.synthetic.Beale(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunction- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.synthetic.Branin(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionBranin 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,randtare constants whereb = 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 atz_1 = (-pi, 12.275),z_2 = (pi, 2.275),z_3 = (9.42478, 2.475)withB(z_i) = 0.397887.- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.synthetic.Bukin(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunction- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.synthetic.Cosine8(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionCosine 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)withf(z_1) = 0.8- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 8
- continuous_inds: list[int] = [0, 1, 2, 3, 4, 5, 6, 7]
- class botorch.test_functions.synthetic.DropWave(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunction- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.synthetic.DixonPrice(dim=2, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunction- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
bounds (list[tuple[float, float]] | None)
- class botorch.test_functions.synthetic.EggHolder(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionEggholder 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)|).- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.synthetic.Griewank(dim=2, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionGriewank synthetic test function.
The Griewank function is defined for any
d, is typically evaluated on[-600, 600]^d, and given by:G(x) = sum_{i=1}^d x_i**2 / 4000 - prod_{i=1}^d cos(x_i / sqrt(i)) + 1
G has many widespread local minima, which are regularly distributed. The global minimum is at
z = (0, ..., 0)withG(z) = 0.- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.synthetic.Hartmann(dim=6, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionHartmann 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.- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- property optimizers: Tensor
- class botorch.test_functions.synthetic.HolderTable(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionHolder 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.2085atz_1 = ( 8.05502, 9.66459) z_2 = (-8.05502, -9.66459) z_3 = (-8.05502, 9.66459) z_4 = ( 8.05502, -9.66459)
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.synthetic.Levy(dim=2, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionLevy 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) / 4for alli.f has one minimizer for its global minimum at
z_1 = (1, 1, ..., 1)withf(z_1) = 0.- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.synthetic.Michalewicz(dim=2, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionMichalewicz 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)
- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype)
- property optimizers: Tensor
- class botorch.test_functions.synthetic.Powell(dim=4, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionPowell synthetic test function.
d-dim function (usually evaluated on the hypercube[-4, 5]^d):P(x) = sum_{i=1}^d/4 ( (x_{4i-3} + 10 x_{4i-2})**2 + 5 (x_{4i-1} - x_{4i})**2 + (x_{4i-2} - 2 x_{4i-1})**4 + 10 (x_{4i-3} - x_{4i})**4 )
P has a global minimizer at
z = (0, ..., 0)withP(z) = 0.- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.synthetic.Rastrigin(dim=2, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunction- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.synthetic.Rosenbrock(dim=2, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionRosenbrock 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)withf(z_i) = 0.0.- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.synthetic.Shekel(m=10, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionShekel synthetic 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)withf(z_1) = -10.5363.- Parameters:
m (int) – Defaults to 10.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 4
- continuous_inds: list[int] = [0, 1, 2, 3]
- class botorch.test_functions.synthetic.SixHumpCamel(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunction- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.synthetic.StyblinskiTang(dim=2, noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionStyblinski-Tang synthetic 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 minimum
H(z) = -39.166166 * datz = [-2.903534]^d- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.synthetic.ThreeHumpCamel(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunction- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.synthetic.AckleyMixed(dim=53, noise_std=None, negate=False, randomize_optimum=False, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionMixed search space version of the Ackley problem.
This problem has dim-3 binary parameters and 3 continuous parameters in the range [0, 1]. This means dim > 3 is required. To make the problem a bit more interesting, the optimal value is not at the origin, but rather at
x_optwhich is a randomly generated point.The goal is to minimize f(x) = Ackley(x - x_opt).
- Parameters:
dim (int) – The (input) dimension. Must be > 3.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
randomize_optimum (bool) – If True, the optimum is a random point in the domain.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.synthetic.Labs(dim=30, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionLow Auto-correlation Binary Sequences (LABS) problem.
This input space is binary and the goal is to maximize the Merit factor. [Packebusch2016] provides optimal values and optimizers attained through brute-force for dim <= 66. We include these for dim = 10, 20, 30, 40, 50, 60.
- Parameters:
dim (int) – The (input) dimension.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
bounds – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.synthetic.TrajectoryPlanning(dim=30, use_smooth_interp=True, max_step_size=None, negate=False, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionTrajectory optimization benchmark for navigating through obstacle fields.
This test function optimizes a trajectory from a fixed start point to a goal point while minimizing the cost integrated over the trajectory.
- Problem Setup:
Domain: [0, 1]^dim hypercube (dim must be even)
Start: (0.05, 0.05)
Goal: (0.95, 0.95)
Obstacles: Grid of axis-aligned squares centered at regular intervals
- Parameterization:
Parameters specify perturbations to goal-directed steps. This biases the search toward trajectories that make progress toward the goal while allowing deviations to avoid obstacles.
- Interpolation Modes:
Cubic spline (use_smooth_interp=True, default): Smooth C2 trajectories
Piecewise linear (use_smooth_interp=False): Straight-line segments
- Cost Function:
The cost is computed by integrating the arc length of the trajectory that passes through obstacles:
cost = integral over trajectory of (20 if in_obstacle else 0) ds
Example
>>> problem = TrajectoryPlanning(dim=20) >>> x = torch.rand(problem.dim) # Random trajectory parameters >>> cost = problem(x) # Evaluate obstacle cost
Initialize the trajectory planning problem.
- Parameters:
dim (int) – Dimensionality of the optimization problem. Must be even since each waypoint has 2 coordinates.
use_smooth_interp (bool) – If True, use cubic spline interpolation for smooth trajectories. If False, use piecewise linear interpolation.
max_step_size (float | None) – Maximum allowed step size. If None, automatically computed.
negate (bool) – If True, negate the cost (for maximization problems).
dtype (torch.dtype) – Data type for tensors.
- Raises:
ValueError – If dim is not even.
- class botorch.test_functions.synthetic.ConstrainedSyntheticTestFunction(noise_std=None, constraint_noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
ConstrainedBaseTestProblem,SyntheticTestFunction,ABCBase class for constrained synthetic test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
constraint_noise_std (None | float | list[float]) – Standard deviation of the constraint noise. If a list is provided, specifies separate noise standard deviations for each constraint.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.synthetic.ConstrainedGramacy(noise_std=None, constraint_noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
ConstrainedSyntheticTestFunctionConstrained Gramacy test function.
This problem comes from [Gramacy2016]. The problem is defined over the unit cube and the goal is to minimize x1+x2 subject to 1.5 - x1 - 2 * x2 - 0.5 * sin(2*pi*(x1^2 - 2 * x2)) <= 0 and x1^2 + x2^2 - 1.5 <= 0.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
constraint_noise_std (None | float | list[float]) – Standard deviation of the constraint noise. If a list is provided, specifies separate noise standard deviations for each constraint.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- num_objectives: int = 1
- num_constraints: int = 2
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.synthetic.ConstrainedHartmann(dim=6, noise_std=None, constraint_noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
Hartmann,ConstrainedSyntheticTestFunctionConstrained Hartmann test function.
This is a constrained version of the standard Hartmann test function that uses
||x||_2 <= 1as the constraint. This problem comes from [Letham2019].- Parameters:
dim (int) – The (input) dimension.
noise_std (None | float) – Standard deviation of the observation noise.
constraint_noise_std (None | float | list[float]) – Standard deviation of the constraint noise. If a list is provided, specifies separate noise standard deviations for each constraint.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- num_constraints: int = 1
- class botorch.test_functions.synthetic.ConstrainedHartmannSmooth(dim=6, noise_std=None, constraint_noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
Hartmann,ConstrainedSyntheticTestFunctionSmooth constrained Hartmann test function.
This is a constrained version of the standard Hartmann test function that uses
||x||_2^2 <= 1as the constraint to obtain smoother constraint slack.- Parameters:
dim (int) – The (input) dimension.
noise_std (None | float) – Standard deviation of the observation noise.
constraint_noise_std (None | float | list[float]) – Standard deviation of the constraint noise. If a list is provided, specifies separate noise standard deviations for each constraint.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- num_constraints: int = 1
- class botorch.test_functions.synthetic.PressureVessel(noise_std=None, constraint_noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
ConstrainedSyntheticTestFunctionPressure vessel design problem with constraints.
The four-dimensional pressure vessel design problem with four black-box constraints from [CoelloCoello2002constraint].
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
constraint_noise_std (None | float | list[float]) – Standard deviation of the constraint noise. If a list is provided, specifies separate noise standard deviations for each constraint.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 4
- continuous_inds: list[int] = [0, 1, 2, 3]
- num_constraints: int = 4
- class botorch.test_functions.synthetic.WeldedBeamSO(noise_std=None, constraint_noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
ConstrainedSyntheticTestFunctionWelded beam design problem with constraints (single-outcome).
The four-dimensional welded beam design problem with six black-box constraints from [CoelloCoello2002constraint].
For a (somewhat modified) multi-objective version, see
botorch.test_functions.multi_objective.WeldedBeam.- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
constraint_noise_std (None | float | list[float]) – Standard deviation of the constraint noise. If a list is provided, specifies separate noise standard deviations for each constraint.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 4
- continuous_inds: list[int] = [0, 1, 2, 3]
- num_constraints: int = 6
- class botorch.test_functions.synthetic.TensionCompressionString(noise_std=None, constraint_noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
ConstrainedSyntheticTestFunctionTension compression string optimization problem with constraints.
The three-dimensional tension compression string optimization problem with four black-box constraints from [Hedar2006derivfree].
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
constraint_noise_std (None | float | list[float]) – Standard deviation of the constraint noise. If a list is provided, specifies separate noise standard deviations for each constraint.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 3
- continuous_inds: list[int] = [0, 1, 2]
- num_constraints: int = 4
- class botorch.test_functions.synthetic.SpeedReducer(noise_std=None, constraint_noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
ConstrainedSyntheticTestFunctionSpeed Reducer design problem with constraints.
The seven-dimensional speed reducer design problem with eleven black-box constraints from [Lemonge2010constrained].
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
constraint_noise_std (None | float | list[float]) – Standard deviation of the constraint noise. If a list is provided, specifies separate noise standard deviations for each constraint.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 7
- continuous_inds: list[int] = [0, 1, 2, 3, 4, 5, 6]
- num_constraints: int = 11
- class botorch.test_functions.synthetic.KeaneBumpFunction(dim, noise_std=None, constraint_noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
ConstrainedSyntheticTestFunctionKeane Bump Function problem with constraints.
This is a challenging d-dimensional minimization problem with two constraints that is evaluated on the domain [0, 10]^d.
There is no known global optimum for this problem, but the approximate global optimal value for a few different dimensionalities can be found in [Mishra2007].
- Parameters:
dim (int) – The (input) dimension.
noise_std (None | float) – Standard deviation of the observation noise.
constraint_noise_std (None | float | list[float]) – Standard deviation of the constraint noise. If a list is provided, specifies separate noise standard deviations for each constraint.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- num_constraints: int = 2
Multi-Fidelity Synthetic Test Functions
Synthetic functions for multi-fidelity optimization benchmarks.
References:
- class botorch.test_functions.multi_fidelity.AugmentedBranin(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionAugmented 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,randtare constants whereb = 5.1 / (4 * math.pi ** 2)c = 5 / math.pi,r = 6,t = 1 / (8 * math.pi). B has infinitely many minimizers withx_1 = -pi, pi, 3piandB_min = 0.397887- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 3
- continuous_inds: list[int] = [0, 1, 2]
- class botorch.test_functions.multi_fidelity.AugmentedHartmann(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionAugmented 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- Parameters:
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 7
- continuous_inds: list[int] = [0, 1, 2, 3, 4, 5, 6]
- class botorch.test_functions.multi_fidelity.AugmentedRosenbrock(dim=3, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionAugmented 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)withf(z_i) = 0.0.- Parameters:
dim (int) – The (input) dimension. Must be at least 3.
noise_std (float | None) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_fidelity.WingWeightMultiFidelity(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionWing Weight Design Problem from [Chen2024].
- Design variables (physical units):
s_w in [150, 200] (wing area)
w_fw in [220, 300] (fuel weight)
A in [6, 10] (aspect ratio)
Lambda_deg in [-10, 10] (sweep angle, degrees)
q in [16, 45] (dynamic pressure)
lam in [0.5, 1.0] (taper ratio)
t_c in [0.08, 0.18] (thickness-to-chord)
N_z in [2.5, 6.0] (ultimate load factor)
w_dg in [1700, 2500] (design gross weight)
w_pp in [0.025, 0.08] (weight per unit area)
- Fidelity parameter (stored as the 11th input):
0: High fidelity (HF) 1: Low fidelity 1 (LF1) 2: Low fidelity 2 (LF2) 3: Low fidelity 3 (LF3)
LF models use slightly altered exponents and additive biases.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 11
- continuous_inds: list[int] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- fidelities = [0, 1, 2, 3]
- class botorch.test_functions.multi_fidelity.BoreholeMultiFidelity(noise_std=None, negate=False, bounds=None, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionBorehole Problem from [Chen2024].
- This problem models water flow through a borehole with 8 design variables:
r_w in [0.05, 0.15] (borehole radius)
r in [100, 50000] (radius of influence)
T_u in [63070, 115600] (transmissivity of upper aquifer)
T_l in [63.1, 116] (transmissivity of lower aquifer)
H_u in [990, 1110] (potentiometric head of upper aquifer)
H_l in [700, 820] (potentiometric head of lower aquifer)
L in [1120, 1680] (length of borehole)
K_w in [9855, 12045] (hydraulic conductivity)
- The fidelity index (9th input) is categorical:
0: High fidelity (HF) 1: Low fidelity 1 (LF1) 2: Low fidelity 2 (LF2) 3: Low fidelity 3 (LF3) 4: Low fidelity 4 (LF4)
The low-fidelity models modify exponents and add a bias.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective in a multiobjective problem.
negate (bool) – If True, negate the function.
bounds (list[tuple[float, float]] | None) – Custom bounds for the function specified as (lower, upper) pairs.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 9
- continuous_inds: list[int] = [0, 1, 2, 3, 4, 5, 6, 7, 8]
- fidelities = [0, 1, 2, 3, 4]
Multi-Objective Synthetic Test Functions
Multi-objective optimization benchmark problems.
References
S. Daulton, S. Cakmak, M. Balandat, M. A. Osborne, E. Zhou, and E. Bakshy. Robust Multi-Objective Bayesian Optimization Under Input Noise. Proceedings of the 39th International Conference on Machine Learning, 2022.
K. Deb, L. Thiele, M. Laumanns, E. Zitzler, A. Abraham, L. Jain, and R. Goldberg. Scalable test problems for evolutionary multi-objective optimization. Evolutionary Multiobjective Optimization, Springer-Verlag, pp. 105-145, 2005.
K. Deb and H. Gupta. Searching for Robust Pareto-Optimal Solutions in Multi-objective Optimization. Evolutionary Multi-Criterion Optimization, Springer-Berlin, pp. 150-164, 2005.
L. Frohlich, E. Klenske, J. Vinogradska, C. Daniel, and M. Zeilinger. Noisy-Input Entropy Search for Efficient Robust Bayesian Optimization. Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, PMLR 108:2262-2272, 2020.
E. C. Garrido-Merch ́an and D. Hern ́andez-Lobato. Parallel Predictive Entropy Search for Multi-objective Bayesian Optimization with Constraints. arXiv e-prints, arXiv:2004.00601, Apr. 2020.
Michael A. Gelbart, Jasper Snoek, and Ryan P. Adams. 2014. Bayesian optimization with unknown constraints. In Proceedings of the Thirtieth Conference on Uncertainty in Artificial Intelligence (UAI’14). AUAI Press, Arlington, Virginia, USA, 250–259.
Q. Liang and L. Lai, Scalable Bayesian Optimization Accelerates Process Optimization of Penicillin Production. NeurIPS 2021 AI for Science Workshop, 2021.
Z. Ma and Y. Wang. Evolutionary Constrained Multiobjective Optimization: Test Suite Construction and Performance Comparisons. IEEE Transactions on Evolutionary Computation, 23(6):972–986, December 2019.
A. Osyczka and S. Kundu. A new method to solve generalized multicriteria optimization problems using the simple genetic algorithm. In Structural Optimization 10. 94–99, 1995.
Ryoji Tanabe and Hisao Ishibuchi. An easy-to-use real-world multi-objective optimization problem suite, Applied Soft Computing,Volume 89, 2020.
K. Yang, M. Emmerich, A. Deutz, and T. Bäck. Multi-Objective Bayesian Global Optimization using expected hypervolume improvement gradient. Swarm and evolutionary computation 44, pp. 945–956, 2019.
E. Zitzler, K. Deb, and L. Thiele. Comparison of multiobjective evolutionary algorithms: Empirical results. Evolutionary Computation, vol. 8, no. 2,pp. 173–195, 2000.
- class botorch.test_functions.multi_objective.BraninCurrin(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemTwo objective problem composed of the Branin and Currin functions.
Branin (rescaled):
f(x) = ( 15*x_1 - 5.1 * (15 * x_0 - 5) ** 2 / (4 * pi ** 2) + 5 * (15 * x_0 - 5) / pi - 5 ) ** 2 + (10 - 10 / (8 * pi)) * cos(15 * x_0 - 5))
Currin:
f(x) = (1 - exp(-1 / (2 * x_1))) * ( 2300 * x_0 ** 3 + 1900 * x_0 ** 2 + 2092 * x_0 + 60 ) / 100 * x_0 ** 3 + 500 * x_0 ** 2 + 4 * x_0 + 20
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- num_objectives: int = 2
- class botorch.test_functions.multi_objective.DH(dim, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblem,ABCBase class for DH problems for robust multi-objective optimization.
In their paper, [Deb2005robust] consider these problems under a mean-robustness setting, and use uniformly distributed input perturbations from the box with edge lengths
delta_0 = delta,delta_i = 2 * delta, i > 0, withdeltaranging up to0.01for DH1 and DH2, anddelta = 0.03for DH3 and DH4.These are d-dimensional problems with two objectives:
f_0(x) = x_0 f_1(x) = h(x) + g(x) * S(x) for DH1 and DH2 f_1(x) = h(x) * (g(x) + S(x)) for DH3 and DH4
The goal is to minimize both objectives. See [Deb2005robust] for more details on DH. The reference points were set using
infer_reference_point.- Parameters:
dim (int) – The (input) dimension.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- num_objectives: int = 2
- class botorch.test_functions.multi_objective.DH1(dim, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DHDH1 test problem.
d-dimensional problem evaluated on
[0, 1] x [-1, 1]^{d-1}:f_0(x) = x_0 f_1(x) = h(x_0) + g(x) * S(x_0) h(x_0) = 1 - x_0^2 g(x) = sum_{i=1}^{d-1} (10 + x_i^2 - 10 * cos(4 * pi * x_i)) S(x_0) = alpha / (0.2 + x_0) + beta * x_0^2
where alpha = 1 and beta = 1.
The Pareto front corresponds to the equation
f_1 = 1 - f_0^2, and it is found atx_i = 0fori > 0and any value ofx_0in(0, 1].- Parameters:
dim (int) – The (input) dimension.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- alpha = 1.0
- beta = 1.0
- class botorch.test_functions.multi_objective.DH2(dim, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DH1DH2 test problem.
This is identical to DH1 except for having
beta = 10.0.- Parameters:
dim (int) – The (input) dimension.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- beta = 10.0
- class botorch.test_functions.multi_objective.DH3(dim, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DHDH3 test problem.
d-dimensional problem evaluated on
[0, 1]^2 x [-1, 1]^{d-2}:f_0(x) = x_0 f_1(x) = h(x_1) * (g(x) + S(x_0)) h(x_1) = 2 - 0.8 * exp(-((x_1 - 0.35) / 0.25)^2) - exp(-((x_1 - 0.85) / 0.03)^2) g(x) = sum_{i=2}^{d-1} (50 * x_i^2) S(x_0) = 1 - sqrt(x_0)
The Pareto front is found at
x_i = 0fori > 1. There’s a local and a global Pareto front, which are found atx_1 = 0.35andx_1 = 0.85, respectively. The approximate relationships between the objectives at local and global Pareto fronts are given byf_1 = 1.2 (1 - sqrt(f_0))andf_1 = 1 - f_0, respectively. The specific values on the Pareto fronts can be found by varyingx_0.- Parameters:
dim (int) – The (input) dimension.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.DH4(dim, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DH3DH4 test problem.
This is similar to DH3 except that it is evaluated on
[0, 1] x [-0.15, 1] x [-1, 1]^{d-2}and:h(x_0, x_1) = 2 - x_0 - 0.8 * exp(-((x_0 + x_1 - 0.35) / 0.25)^2) - exp(-((x_0 + x_1 - 0.85) / 0.03)^2)
The Pareto front is found at
x_i = 0fori > 2, with the local one being nearx_0 + x_1 = 0.35and the global one nearx_0 + x_1 = 0.85.- Parameters:
dim (int) – The (input) dimension.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.DTLZ(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemBase class for DTLZ problems.
See [Deb2005dtlz] for more details on DTLZ.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Must be less than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.DTLZ1(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DTLZDTLZ1 test problem.
d-dimensional problem evaluated on
[0, 1]^d:f_0(x) = 0.5 * x_0 * (1 + g(x)) f_1(x) = 0.5 * (1 - x_0) * (1 + g(x)) g(x) = 100 * sum_{i=m}^{d-1} ( k + (x_i - 0.5)^2 - cos(20 * pi * (x_i - 0.5)) )
where k = d - m + 1.
The pareto front is given by the line (or hyperplane) sum_i f_i(x) = 0.5. The goal is to minimize both objectives. The reference point comes from [Yang2019].
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Must be less than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.DTLZ2(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DTLZDTLZ2 test problem.
d-dimensional problem evaluated on
[0, 1]^d:f_0(x) = (1 + g(x)) * cos(x_0 * pi / 2) f_1(x) = (1 + g(x)) * sin(x_0 * pi / 2) g(x) = sum_{i=m}^{d-1} (x_i - 0.5)^2
The pareto front is given by the unit hypersphere sum{i} f_i^2 = 1. Note: the pareto front is completely concave. The goal is to minimize both objectives.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Must be less than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.DTLZ3(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DTLZ2DTLZ3 test problem.
d-dimensional problem evaluated on
[0, 1]^d:f_0(x) = (1 + g(x)) * cos(x_0 * pi / 2) f_1(x) = (1 + g(x)) * sin(x_0 * pi / 2) g(x) = 100 * [k + sum_{i=m}^{n-1} (x_i - 0.5)^2 - cos(20 * pi * (x_i - 0.5))]
g(x)introduces (3k−1) local Pareto fronts that are parallel to the one global Pareto-optimal front.The global Pareto-optimal front corresponds to x_i = 0.5 for x_i in X_m.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Must be less than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.DTLZ4(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DTLZ2DTLZ4 test problem.
This is the same as DTLZ2, but with alpha=100 as the exponent, resulting in dense solutions near the f_M-f_1 plane.
The global Pareto-optimal front corresponds to x_i = 0.5 for x_i in X_m.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Must be less than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.DTLZ5(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DTLZDTLZ5 test problem.
d-dimensional problem evaluated on
[0, 1]^d:f_0(x) = (1 + g(x)) * cos(theta_0 * pi / 2) f_1(x) = (1 + g(x)) * sin(theta_0 * pi / 2) theta_i = pi / (4 * (1 + g(X_m)) * (1 + 2 * g(X_m) * x_i)) for i = 1, … , M-2 g(x) = sum_{i=m}^{d-1} (x_i - 0.5)^2
The global Pareto-optimal front corresponds to x_i = 0.5 for x_i in X_m.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Must be less than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.DTLZ7(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DTLZDTLZ7 test problem.
- d-dimensional problem evaluated on
[0, 1]^d: f_0(x) = x_0 f_1(x) = x_1 … f_{M-1}(x) = (1 + g(X_m)) * h(f_0, f_1, …, f_{M-2}, g, x) h(f_0, f_1, …, f_{M-2}, g, x) = M - sum_{i=0}^{M-2} f_i(x)/(1+g(x)) * (1 + sin(3 * pi * f_i(x)))
This test problem has 2M-1 disconnected Pareto-optimal regions in the search space.
The pareto frontier corresponds to X_m = 0.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Must be less than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- d-dimensional problem evaluated on
- class botorch.test_functions.multi_objective.GMM(noise_std=None, negate=False, num_objectives=2, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemA test problem where each objective is a Gaussian mixture model.
This implementation is adapted from the single objective version (proposed by [Frohlich2020]) at https://github.com/boschresearch/NoisyInputEntropySearch/blob/master/ core/util/objectives.py.
See [Daulton2022] for details on this multi-objective problem.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the objectives.
num_objectives (int) – The number of objectives.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- class botorch.test_functions.multi_objective.Penicillin(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemA penicillin production simulator from [Liang2021].
This implementation is adapted from https://github.com/HarryQL/TuRBO-Penicillin.
The goal is to maximize the penicillin yield while minimizing time to ferment and the CO2 byproduct.
The function is defined for minimization of all objectives.
The reference point was set using the
infer_reference_pointheuristic on the Pareto frontier obtained via NSGA-II.Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 7
- continuous_inds: list[int] = [0, 1, 2, 3, 4, 5, 6]
- num_objectives: int = 3
- Y_xs = 0.45
- Y_ps = 0.9
- K_1 = 1e-10
- K_2 = 7.000000000000001e-05
- m_X = 0.014
- alpha_1 = 0.143
- alpha_2 = 4e-07
- alpha_3 = 0.0001
- mu_X = 0.092
- K_X = 0.15
- mu_p = 0.005
- K_p = 0.0002
- K_I = 0.1
- K = 0.04
- k_g = 7000.0
- E_g = 5100.0
- k_d = 1e+33
- E_d = 50000.0
- lambd = 0.00025
- T_v = 273.0
- T_o = 373.0
- R = 1.9872
- V_max = 180.0
- classmethod penicillin_vectorized(X_input)[source]
Penicillin simulator, simplified and vectorized.
The 7 input parameters are (in order): culture volume, biomass concentration, temperature, glucose concentration, substrate feed rate, substrate feed concentration, and H+ concentration.
- Parameters:
X_input (Tensor) – A
n x 7-dim tensor of inputs.- Returns:
An
n x 3-dim tensor of (negative) penicillin yield, CO2 and time.- Return type:
Tensor
- class botorch.test_functions.multi_objective.ToyRobust(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemA 1D problem where the Pareto frontier is sensitive to input noise.
Specifically, the pareto frontier over the nominal objectives is sensitive to input noise. The first objective is a mixture of a linear function and a sinusoidal function, and the second objective is a modified Levy function, where the second parameter is fixed.
This function comes from [Daulton2022].
The reference point was set using the
infer_reference_pointheuristic on the Pareto frontier over a large discrete set of random designs.Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 1
- continuous_inds: list[int] = [0]
- num_objectives: int = 2
- levy = Levy()
- forward(X, noise=True)[source]
Evaluate the function on a set of points.
- Parameters:
X (Tensor) – A
(batch_shape) x d-dim tensor of point(s) at which to evaluate the function.noise (bool) – If
True, add observation noise as specified bynoise_std.
- Returns:
A
batch_shape-dim tensor of function evaluations.- Return type:
Tensor
- class botorch.test_functions.multi_objective.VehicleSafety(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemOptimize Vehicle crash-worthiness.
See [Tanabe2020] for details.
The reference point is 1.1 * the nadir point from approximate front provided by [Tanabe2020].
The maximum hypervolume is computed using the approximate pareto front from [Tanabe2020].
Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 5
- continuous_inds: list[int] = [0, 1, 2, 3, 4]
- num_objectives: int = 3
- class botorch.test_functions.multi_objective.ZDT(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemBase class for ZDT problems.
See [Zitzler2000] for more details on ZDT.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Number of objectives. Must not be larger than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.ZDT1(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
ZDTZDT1 test problem.
d-dimensional problem evaluated on
[0, 1]^d:f_0(x) = x_0 f_1(x) = g(x) * (1 - sqrt(x_0 / g(x)) g(x) = 1 + 9 / (d - 1) * sum_{i=1}^{d-1} x_i
The reference point comes from [Yang2019a].
The pareto front is convex.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Number of objectives. Must not be larger than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.ZDT2(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
ZDTZDT2 test problem.
d-dimensional problem evaluated on
[0, 1]^d:f_0(x) = x_0 f_1(x) = g(x) * (1 - (x_0 / g(x))^2) g(x) = 1 + 9 / (d - 1) * sum_{i=1}^{d-1} x_i
The reference point comes from [Yang2019a].
The pareto front is concave.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Number of objectives. Must not be larger than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.ZDT3(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
ZDTZDT3 test problem.
d-dimensional problem evaluated on
[0, 1]^d:f_0(x) = x_0 f_1(x) = 1 - sqrt(x_0 / g(x)) - x_0 / g * sin(10 * pi * x_0) g(x) = 1 + 9 / (d - 1) * sum_{i=1}^{d-1} x_i
The reference point comes from [Yang2019a].
The pareto front consists of several discontinuous convex parts.
- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Number of objectives. Must not be larger than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.multi_objective.CarSideImpact(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemCar side impact problem.
See [Tanabe2020] for details.
The reference point is
nadir + 0.1 * (ideal - nadir)where the ideal and nadir points come from the approximate Pareto frontier from [Tanabe2020]. The max_hv was computed based on the approximate Pareto frontier from [Tanabe2020].Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- num_objectives: int = 4
- dim: int = 7
- continuous_inds: list[int] = [0, 1, 2, 3, 4, 5, 6]
- class botorch.test_functions.multi_objective.BNH(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblem,ConstrainedBaseTestProblemThe constrained BNH problem.
See [GarridoMerchan2020] for more details on this problem. Note that this is a minimization problem.
Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- num_objectives: int = 2
- num_constraints: int = 2
- class botorch.test_functions.multi_objective.CONSTR(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblem,ConstrainedBaseTestProblemThe constrained CONSTR problem.
See [GarridoMerchan2020] for more details on this problem. Note that this is a minimization problem.
Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- num_objectives: int = 2
- num_constraints: int = 2
- class botorch.test_functions.multi_objective.ConstrainedBraninCurrin(noise_std=None, constraint_noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
BraninCurrin,ConstrainedBaseTestProblemConstrained Branin Currin Function.
This uses the disk constraint from [Gelbart2014].
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise of the objectives.
constraint_noise_std (None | float | list[float]) – Standard deviation of the observation noise of the constraint.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- num_objectives: int = 2
- num_constraints: int = 1
- class botorch.test_functions.multi_objective.C2DTLZ2(dim, num_objectives=2, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
DTLZ2,ConstrainedBaseTestProblem- Parameters:
dim (int) – The (input) dimension of the function.
num_objectives (int) – Must be less than dim.
noise_std (None | float | list[float]) – Standard deviation of the observation noise.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- num_constraints: int = 1
- class botorch.test_functions.multi_objective.DiscBrake(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblem,ConstrainedBaseTestProblemThe Disc Brake problem.
There are 2 objectives and 4 constraints.
Both objectives should be minimized.
See [Tanabe2020] for details.
The reference point was set using the
infer_reference_pointheuristic on the Pareto frontier over a large discrete set of random designs.Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 4
- continuous_inds: list[int] = [0, 1, 2, 3]
- num_objectives: int = 2
- num_constraints: int = 4
- class botorch.test_functions.multi_objective.MW7(dim, noise_std=None, constraint_noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblem,ConstrainedBaseTestProblemThe MW7 problem.
This problem has 2 objectives, 2 constraints, and a disconnected Pareto frontier. It supports arbitrary input dimension > 1. See [Ma2019] for details.
This implementation is adapted from: https://github.com/anyoptimization/pymoo/blob/master/pymoo/problems/multi/mw.py
- Parameters:
dim (int) – The (input) dimension of the function. Must be at least 2.
noise_std (None | float | list[float]) – Standard deviation of the observation noise of the objectives.
constraint_noise_std (None | float | list[float]) – Standard deviation of the observation noise of the constraints.
negate (bool) – If True, negate the function.
dtype (torch.dtype) – The dtype that is used for the bounds of the function.
- num_constraints: int = 2
- num_objectives: int = 2
- class botorch.test_functions.multi_objective.OSY(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblem,ConstrainedBaseTestProblemThe OSY test problem from [Oszycka1995]. Implementation from https://github.com/msu-coinlab/pymoo/blob/master/pymoo/problems/multi/osy.py Note that this implementation assumes minimization, so please choose negate=True.
Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 6
- continuous_inds: list[int] = [0, 1, 2, 3, 4, 5]
- num_constraints: int = 6
- num_objectives: int = 2
- class botorch.test_functions.multi_objective.SRN(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblem,ConstrainedBaseTestProblemThe constrained SRN problem.
See [GarridoMerchan2020] for more details on this problem. Note that this is a minimization problem.
Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 2
- continuous_inds: list[int] = [0, 1]
- num_objectives: int = 2
- num_constraints: int = 2
- class botorch.test_functions.multi_objective.WeldedBeam(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblem,ConstrainedBaseTestProblemThe Welded Beam multi-objective test problem. Similar to
WeldedBeamSOinbotorch.test_function.synthetic, but with an additional output, somewhat modified constraints, and a different domain.Implementation from https://github.com/msu-coinlab/pymoo/blob/master/pymoo/problems/multi/welded_beam.py Note that this implementation assumes minimization, so please choose negate=True.
Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 4
- continuous_inds: list[int] = [0, 1, 2, 3]
- num_constraints: int = 4
- num_objectives: int = 2
Multi-Objective Multi-Fidelity Synthetic Test Functions
Multi-objective multi-fidelity optimization benchmark problems.
References
- class botorch.test_functions.multi_objective_multi_fidelity.MOMFBraninCurrin(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemBranin-Currin problem for multi-objective-multi-fidelity optimization.
(2+1)-dimensional function with domain
[0,1]^3where the last dimension is the fidelity parameters. Both functions assume minimization. See [Irshad2021] for more details.Modified Branin function:
B(x,s) = 21-(( 15*x_2 - b(s) * (15 * x_1 - 5) ** 2 + c(s) * (15 * x_1 - 5) - 6 ) ** 2 + 10 * (1 - t(s)) * cos(15 * x_1 - 5)+10)/22
Here
b,c,randtare constants andsis the fidelity parameter, where:b = 5.1 / (4 * math.pi ** 2) - 0.01(1-s)c = 5 / math.pi - 0.1*(1 - s)r = 6t = 1 / (8 * math.pi) + 0.05*(1-s)
Modified Currin function:
C(x) = 14-((1 - 0.1(1-s)exp(-1 / (2 * x_2))) * ( 2300 * x_1 ** 3 + 1900 * x_1 ** 2 + 2092 * x_1 + 60 ) / 100 * x_1 ** 3 + 500 * x_1 ** 2 + 4 * x_2 + 20)/15
Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 3
- continuous_inds: list[int] = [0, 1, 2]
- num_objectives: int = 2
- class botorch.test_functions.multi_objective_multi_fidelity.MOMFPark(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
MultiObjectiveTestProblemModified Park test functions for multi-objective multi-fidelity optimization.
(4+1)-dimensional function with domain
[0,1]^5where the last dimension is the fidelity parameters. See [Irshad2021] for more details.The first modified Park function is
P1(x, s)=A*(T1(x,s)+T2(x,s)-B)/22-0.8
The second modified Park function is
P2(x,s)=A*(5-2/3*exp(x1+x2)-x4*sin(x3)*A+x3-B)/4 - 0.7
Here
T_1(x,s) = (x1+0.001*(1-s))/2*sqrt(1+(x2+x3**2)*x4/(x1**2))
T_2(x, s) = (x1+3*x4)*exp(1+sin(x3))
and
A(s)=(0.9+0.1*s),B(s)=0.1*(1-s).Base constructor for multi-objective test functions.
- Parameters:
noise_std (None | float | list[float]) – Standard deviation of the observation noise. If a list is provided, specifies separate noise standard deviations for each objective.
negate (bool) – If True, negate the objectives.
dtype (torch.dtype)
- dim: int = 5
- continuous_inds: list[int] = [0, 1, 2, 3, 4]
- num_objectives: int = 2
Sensitivity Analysis Test Functions
- class botorch.test_functions.sensitivity_analysis.Ishigami(b=0.1, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionIshigami test function.
three-dimensional function (usually evaluated on
[-pi, pi]^3):f(x) = sin(x_1) + a sin(x_2)^2 + b x_3^4 sin(x_1)
Here
aandbare constants where a=7 and b=0.1 or b=0.05 Proposed to test sensitivity analysis methods because it exhibits strong nonlinearity and nonmonotonicity and a peculiar dependence on x_3.- Parameters:
b (float) – the b constant, should be 0.1 or 0.05.
noise_std (float | None) – Standard deviation of the observation noise.
negative – If True, negative the objective.
dtype (dtype) – The dtype that is used for the bounds of the function.
negate (bool)
- compute_dgsm(X)[source]
Compute derivative global sensitivity measures.
This function can be called separately to estimate the dgsm measure The exact global integrals of these values are already added under as attributes dgsm_gradient, dgsm_gradient_abs, and dgsm_gradient_square.
- Parameters:
X (Tensor) – Set of points at which to compute derivative measures.
- Return type:
tuple[list[float], list[float], list[float]]
Returns: The average gradient, absolute gradient, and square gradients.
- class botorch.test_functions.sensitivity_analysis.Gsobol(dim, a=None, noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionGsobol test function.
d-dimensional function (usually evaluated on
[0, 1]^d):f(x) = Prod_{i=1}^{d} ((|4x_i-2|+a_i)/(1+a_i)), a_i >=0
common combinations of dimension and a vector:
dim=8, a= [0, 1, 4.5, 9, 99, 99, 99, 99] dim=6, a=[0, 0.5, 3, 9, 99, 99] dim = 15, a= [1, 2, 5, 10, 20, 50, 100, 500, 1000, …, 1000]
Proposed to test sensitivity analysis methods First order Sobol indices have closed form expression S_i=V_i/V with :
V_i= 1/(3(1+a_i)^2) V= Prod_{i=1}^{d} (1+V_i) - 1
- Parameters:
dim (int) – Dimensionality of the problem. If 6, 8, or 15, will use standard a.
a (list) – a parameter, unless dim is 6, 8, or 15.
noise_std (float | None) – Standard deviation of observation noise.
negate (bool) – Return negative of function.
dtype (dtype) – The dtype that is used for the bounds of the function.
- class botorch.test_functions.sensitivity_analysis.Morris(noise_std=None, negate=False, dtype=torch.float64)[source]
Bases:
SyntheticTestFunctionMorris test function.
20-dimensional function (usually evaluated on
[0, 1]^20):f(x) = sum_{i=1}^20 beta_i w_i + sum_{i<j}^20 beta_ij w_i w_j + sum_{i<j<l}^20 beta_ijl w_i w_j w_l + 5w_1 w_2 w_3 w_4
Proposed to test sensitivity analysis methods
- Parameters:
noise_std (float | None) – Standard deviation of observation noise.
negate (bool) – Return negative of function.
dtype (dtype) – The dtype that is used for the bounds of the function.
Utilities For Test Functions
- botorch.test_functions.utils.round_nearest(X, increment, bounds)[source]
Rounds the input tensor to the nearest multiple of
increment.- Parameters:
X (Tensor) – The input to be rounded.
increment (float) – The increment to round to.
bounds (tuple[float, float] | None) – An optional tuple of two floats representing the lower and upper bounds on
X. If provided, this will round to the nearest multiple ofincrementthat lies within the bounds.
- Returns:
The rounded input.
- Return type:
Tensor