Analytical Problems

class blackbox.base_classes.analytical_base_problem.SingleOutputAnalyticalProblem(num_inputs, negate)[source]

Bases: BaseProblem

Base class for all single output analytical problems

__call__(x)[source]

Evalaute the function for given input x

Parameters:

x (np.ndarray) – 1D/2D numpy array of shape (num_inputs,) or (n_samples,num_samples)

Returns:

y – 1D/2D numpy array of shape (1,) or (n_samples,1) containing the required output value for each input sample

Return type:

np.ndarray

set_bounds(bounds)[source]

Method to change the default bounds of the problem

Parameters:

bounds (tuple) – a tuple containing two 1D numpy array - first one is lower bound and second entry is upper bound

class blackbox.analytical_problems.single_output_problem.Ackley(num_inputs=10, negate=False)[source]

Bases: SingleOutputAnalyticalProblem

Class for defining the ackley function. More details about this problem can be found here: https://www.sfu.ca/~ssurjano/ackley.html

Default range of bounds for each design variable is [-32.768,32.768]

Parameters:
  • num_inputs (int) – number of input dimensions, default = 10

  • negate (bool) – negate the values before returning

_evaluate(x)[source]

Evaluate the Ackley function for given input x

Parameters:

x (np.ndarray) – input samples with shape (n_samples, num_inputs) or (num_inputs,)

Returns:

an array of shape (n_samples, 1) or (1,) containing ackley function values

Return type:

np.ndarray

class blackbox.analytical_problems.single_output_problem.Levy(num_inputs=10, negate=False)[source]

Bases: SingleOutputAnalyticalProblem

Class for defining the levy function. More details about this problem can be found here: https://www.sfu.ca/~ssurjano/levy.html

Default range of bounds for each design variable is [-10,10]

Parameters:
  • num_inputs (int) – number of input dimensions, default = 10

  • negate (bool) – negate the values before returning

_evaluate(x)[source]

Evaluate the Levy function for given input x

Parameters:

x (np.ndarray) – input samples with shape (n_samples, num_inputs) or (num_inputs,)

Returns:

an array of shape (n_samples, 1) or (1,) containing levy function values

Return type:

np.ndarray

class blackbox.analytical_problems.single_output_problem.Rastrigin(num_inputs=10, negate=False)[source]

Bases: SingleOutputAnalyticalProblem

Class for defining the rastrigin function. More details about this problem can be found here: https://www.sfu.ca/~ssurjano/rastrigin.html

Default range of bounds for each design variable is [-5.12,5.12]

Parameters:
  • num_inputs (int) – number of input dimensions, default = 10

  • negate (bool) – negate the values before returning

_evaluate(x)[source]

Evaluate the Rastrigin function for given input x

Parameters:

x (np.ndarray) – input samples with shape (n_samples, num_inputs) or (num_inputs,)

Returns:

an array of shape (n_samples, 1) or (1,) containing rastrigin function values

Return type:

np.ndarray

class blackbox.analytical_problems.single_output_problem.Hartmann(num_inputs=6, negate=False)[source]

Bases: SingleOutputAnalyticalProblem

Class for defining the hartmann function. More details about this problem can be found here:

Hartmann 3D - https://www.sfu.ca/~ssurjano/hart3.html

Hartmann 4D - https://www.sfu.ca/~ssurjano/hart4.html

Hartmann 6D - https://www.sfu.ca/~ssurjano/hart6.html

Default range of bounds for each design variable is [0,1]

Parameters:
  • num_inputs (int) – number of input dimensions, default = 6

  • negate (bool) – negate the values before returning

_evaluate(x)[source]

Evaluate the Hartmann function for given input x

Parameters:

x (np.ndarray) – input samples with shape (n_samples, num_inputs) or (num_inputs,)

Returns:

an array of shape (n_samples, 1) or (1,) containing hartmann function values

Return type:

np.ndarray

class blackbox.analytical_problems.single_output_problem.Branin(negate=False)[source]

Bases: SingleOutputAnalyticalProblem

Class for defining the branin function

There are only two variables in this problem. Default range of bounds for these variables are [-5,10] and [0,15]

Parameters:

negate (bool) – negate the values before returning

_evaluate(x)[source]

Evaluate the Branin function for given input x

Parameters:

x (np.ndarray) – input samples with shape (n_samples, num_inputs) or (num_inputs,)

Returns:

an array of shape (n_samples, 1) or (1,) containing branin function values

Return type:

np.ndarray

class blackbox.analytical_problems.single_output_problem.ModifiedBranin(negate=False)[source]

Bases: SingleOutputAnalyticalProblem

Class for defining the modified branin function

The number of design variables and their default bounds are same as the one used for standard Branin function

This function is obtained from Forrester’s surrogate modeling book

Parameters:

negate (bool) – negate the values before returning

_evaluate(x)[source]

Evaluate the modified branin function for given input x

Parameters:

x (np.ndarray) – input samples with shape (n_samples, num_inputs) or (num_inputs,)

Returns:

an array of shape (n_samples, 1) or (1,) containing modified branin function values

Return type:

np.ndarray