trieste.objectives.single_objectives#

This module contains toy objective functions, useful for experimentation. A number of them have been taken from this Virtual Library of Simulation Experiments <https://web.archive.org/web/20211015101644/https://www.sfu.ca/~ssurjano/> (:cite:`ssurjano2021)`_.

Module Contents#

ObjectiveTestFunction[source]#

A synthetic test function

class ObjectiveTestProblem[source]#

Bases: Generic[trieste.space.SearchSpaceType]

Convenience container class for synthetic objective test functions.

name: str[source]#

The test function name

objective: ObjectiveTestFunction[source]#

The synthetic test function

search_space: trieste.space.SearchSpaceType[source]#

The (continuous) search space of the test function

property dim: int[source]#

The input dimensionality of the test function

property bounds: list[list[float]][source]#

The input space bounds of the test function

class SingleObjectiveTestProblem[source]#

Bases: ObjectiveTestProblem[trieste.space.SearchSpaceType]

Convenience container class for synthetic single-objective test functions, including the global minimizers and minimum.

minimizers: trieste.types.TensorType[source]#

The global minimizers of the test function.

minimum: trieste.types.TensorType[source]#

The global minimum of the test function.

check_objective_shapes(d: int) Callable[[ObjectiveTestFunction], ObjectiveTestFunction][source]#

Returns a decorator for checking the shape of single objective test functions.

branin(x: trieste.types.TensorType) trieste.types.TensorType[source]#

The Branin-Hoo function over \([0, 1]^2\). See [PWG13] for details.

Parameters:

x – The points at which to evaluate the function, with shape […, 2].

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

scaled_branin(x: trieste.types.TensorType) trieste.types.TensorType[source]#

The Branin-Hoo function, rescaled to have zero mean and unit variance over \([0, 1]^2\). See [PWG13] for details.

Parameters:

x – The points at which to evaluate the function, with shape […, 2].

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

Branin[source]#

The Branin-Hoo function over \([0, 1]^2\). See [PWG13] for details.

ScaledBranin[source]#

The Branin-Hoo function, rescaled to have zero mean and unit variance over \([0, 1]^2\). See [PWG13] for details.

ConstrainedScaledBranin[source]#

The rescaled Branin-Hoo function with a combination of linear and nonlinear constraints on the search space.

simple_quadratic(x: trieste.types.TensorType) trieste.types.TensorType[source]#

A trivial quadratic function over \([0, 1]^2\). Useful for quick testing.

Parameters:

x – The points at which to evaluate the function, with shape […, 2].

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

SimpleQuadratic[source]#

A trivial quadratic function over \([0, 1]^2\). Useful for quick testing.

gramacy_lee(x: trieste.types.TensorType) trieste.types.TensorType[source]#

The Gramacy & Lee function, typically evaluated over \([0.5, 2.5]\). See [GL12] for details.

Parameters:

x – Where to evaluate the function, with shape […, 1].

Returns:

The function values, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

GramacyLee[source]#

The Gramacy & Lee function, typically evaluated over \([0.5, 2.5]\). See [GL12] for details.

logarithmic_goldstein_price(x: trieste.types.TensorType) trieste.types.TensorType[source]#

A logarithmic form of the Goldstein-Price function, with zero mean and unit variance over \([0, 1]^2\). See [PWG13] for details.

Parameters:

x – The points at which to evaluate the function, with shape […, 2].

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

LogarithmicGoldsteinPrice[source]#

A logarithmic form of the Goldstein-Price function, with zero mean and unit variance over \([0, 1]^2\). See [PWG13] for details.

hartmann_3(x: trieste.types.TensorType) trieste.types.TensorType[source]#

The Hartmann 3 test function over \([0, 1]^3\). This function has 3 local and one global minima. See https://www.sfu.ca/~ssurjano/hart3.html for details.

Parameters:

x – The points at which to evaluate the function, with shape […, 3].

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

Hartmann3[source]#

The Hartmann 3 test function over \([0, 1]^3\). This function has 3 local and one global minima. See https://www.sfu.ca/~ssurjano/hart3.html for details.

shekel_4(x: trieste.types.TensorType) trieste.types.TensorType[source]#

The Shekel test function over \([0, 1]^4\). This function has ten local minima and a single global minimum. See https://www.sfu.ca/~ssurjano/shekel.html for details. Note that we rescale the original problem, which is typically defined over [0, 10]^4.

Parameters:

x – The points at which to evaluate the function, with shape […, 4].

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

Shekel4[source]#

The Shekel test function over \([0, 1]^4\). This function has ten local minima and a single global minimum. See https://www.sfu.ca/~ssurjano/shekel.html for details. Note that we rescale the original problem, which is typically defined over [0, 10]^4.

levy(x: trieste.types.TensorType, d: int) trieste.types.TensorType[source]#

The Levy test function over \([0, 1]^d\). This function has many local minima and a single global minimum. See https://www.sfu.ca/~ssurjano/levy.html for details. Note that we rescale the original problem, which is typically defined over [-10, 10]^d, to be defined over a unit hypercube \([0, 1]^d\).

Parameters:
  • x – The points at which to evaluate the function, with shape […, d].

  • d – The dimension of the function.

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

levy_8(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Convenience function for the 8-dimensional levy() function, with output normalised to unit interval

Parameters:

x – The points at which to evaluate the function, with shape […, 8].

Returns:

The function values at x, with shape […, 1].

Levy8[source]#

Convenience function for the 8-dimensional levy() function. Taken from https://www.sfu.ca/~ssurjano/levy.html

rosenbrock(x: trieste.types.TensorType, d: int) trieste.types.TensorType[source]#

The Rosenbrock function, also known as the Banana function, is a unimodal function, however the minima lies in a narrow valley. Even though this valley is easy to find, convergence to the minimum is difficult. See https://www.sfu.ca/~ssurjano/rosen.html for details. Inputs are rescaled to be defined over a unit hypercube \([0, 1]^d\).

Parameters:
  • x – The points at which to evaluate the function, with shape […, d].

  • d – The dimension of the function.

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

rosenbrock_4(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Convenience function for the 4-dimensional rosenbrock() function with steepness 10. It is rescaled to have zero mean and unit variance over \([0, 1]^4. See :cite:`Picheny2013\) for details.

Parameters:

x – The points at which to evaluate the function, with shape […, 4].

Returns:

The function values at x, with shape […, 1].

Rosenbrock4[source]#

The Rosenbrock function, rescaled to have zero mean and unit variance over \([0, 1]^4. See :cite:`Picheny2013\) for details. This function (also known as the Banana function) is unimodal, however the minima lies in a narrow valley.

ackley_5(x: trieste.types.TensorType) trieste.types.TensorType[source]#

The Ackley test function over \([0, 1]^5\). This function has many local minima and a global minima. See https://www.sfu.ca/~ssurjano/ackley.html for details. Note that we rescale the original problem, which is typically defined over [-32.768, 32.768].

Parameters:

x – The points at which to evaluate the function, with shape […, 5].

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

Ackley5[source]#

The Ackley test function over \([0, 1]^5\). This function has many local minima and a global minima. See https://www.sfu.ca/~ssurjano/ackley.html for details. Note that we rescale the original problem, which is typically defined over [-32.768, 32.768].

hartmann_6(x: trieste.types.TensorType) trieste.types.TensorType[source]#

The Hartmann 6 test function over \([0, 1]^6\). This function has 6 local and one global minima. See https://www.sfu.ca/~ssurjano/hart6.html for details.

Parameters:

x – The points at which to evaluate the function, with shape […, 6].

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

Hartmann6[source]#

The Hartmann 6 test function over \([0, 1]^6\). This function has 6 local and one global minima. See https://www.sfu.ca/~ssurjano/hart6.html for details.

michalewicz(x: trieste.types.TensorType, d: int = 2, m: int = 10) trieste.types.TensorType[source]#

The Michalewicz function over \([0, \pi]\) for all i=1,…,d. Dimensionality is determined by the parameter d and it features steep ridges and drops. It has \(d!\) local minima, and it is multimodal. The parameter m defines the steepness of they valleys and ridges; a larger m leads to a more difficult search. The recommended value of m is 10. See https://www.sfu.ca/~ssurjano/egg.html for details.

Parameters:
  • x – The points at which to evaluate the function, with shape […, d].

  • d – The dimension of the function.

  • m – The steepness of the valleys/ridges.

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

michalewicz_2(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Convenience function for the 2-dimensional michalewicz() function with steepness 10. :param x: The points at which to evaluate the function, with shape […, 2]. :return: The function values at x, with shape […, 1].

michalewicz_5(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Convenience function for the 5-dimensional michalewicz() function with steepness 10. :param x: The points at which to evaluate the function, with shape […, 5]. :return: The function values at x, with shape […, 1].

michalewicz_10(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Convenience function for the 10-dimensional michalewicz() function with steepness 10. :param x: The points at which to evaluate the function, with shape […, 10]. :return: The function values at x, with shape […, 1].

Michalewicz2[source]#

Convenience function for the 2-dimensional michalewicz() function with steepness 10. Taken from https://arxiv.org/abs/2003.09867

Michalewicz5[source]#

Convenience function for the 5-dimensional michalewicz() function with steepness 10. Taken from https://arxiv.org/abs/2003.09867

Michalewicz10[source]#

Convenience function for the 10-dimensional michalewicz() function with steepness 10. Taken from https://arxiv.org/abs/2003.09867

trid(x: trieste.types.TensorType, d: int = 10) trieste.types.TensorType[source]#

The Trid function over \([-d^2, d^2]\) for all i=1,…,d. Dimensionality is determined by the parameter d and it has a global minimum. This function has large variation in output which makes it challenging for Bayesian optimisation with vanilla Gaussian processes with non-stationary kernels. Models that can deal with non-stationarities, such as deep Gaussian processes, can be useful for modelling these functions. See [HBB+19] and https://www.sfu.ca/~ssurjano/trid.html for details.

Parameters:
  • x – The points at which to evaluate the function, with shape […, d].

  • d – Dimensionality.

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

trid_10(x: trieste.types.TensorType) trieste.types.TensorType[source]#

The Trid function with dimension 10.

Parameters:

x – The points at which to evaluate the function, with shape […, 10].

Returns:

The function values at x, with shape […, 1].

Raises:

ValueError (or InvalidArgumentError) – If x has an invalid shape.

Trid10[source]#

The Trid function with dimension 10.