paref.interfaces.moo_algorithms.blackbox_function#

Classes

BlackboxFunction()

Generic interface for blackbox functions used in Paref

class paref.interfaces.moo_algorithms.blackbox_function.BlackboxFunction[source]#

Bases: object

Generic interface for blackbox functions used in Paref

This class provides a generic interface for blackbox functions. In Paref, the evaluations of the blackbox function need to be stored and can then be accessed within the BlackboxFunction class. In addition, this class stores all the information about the blackbox function

\[f:S \to \mathbb{R}^d.\]

This consists of the following

The design space S: Of which dimension is S? How is S defined? Currently, this supports:

  • cubes (characterized be its bounds), i.e.

\[S=\prod_{i=1}^n[a_i,b_i] \subset \mathbb{R}^n\]

The target space: What is the dimension of the target space, i.e. what is d?

The assignment f: For a given x in S, what is the value f(x)?

Examples

Lets say the blackbox function has the following mathematical expression

\[f:[0,1]\times [0,1]\to \mathbb{R}^2,f(x)=(x_2^2,x_1-x_2)\]

Then, the pythonic blackbox function will be implemented as follows # TBA: example

Note

In most cases, the closed mathematical blackbox functions are not known. Instead, it can only be evaluated at a given input. In that case “evaluating” is implemented in the

__call__(self, x: np.ndarray) -> np.ndarray

method below.

Initialize storage for evaluations of the blackbox function

abstract __call__(x: ndarray) ndarray[source]#

Apply blackbox function to input and store the tuple (input,output) in self._evaluations

Warning

When blackbox function is called the list of input and output, i.e. [x,f(x)] must be appended to self._evaluations!

Parameters:

x (np.ndarray) – input to which the blackbox function is applied

Returns:

output of blackbox function applied to input

Return type:

np.ndarray

clear_evaluations() None[source]#

Clear all evaluations

I.e. set self._evaluations to empty list.

abstract property design_space: Bounds#

Characterization of design space

Currently, this supports:

  • cubes (characterized be its bounds), i.e.

\[S=\prod_{i=1}^n[a_i,b_i] \subset \mathbb{R}^n\]
Returns:

pythonic representation of design space

Return type:

Union[Bounds]

abstract property dimension_design_space: int#

returns: dimension of design space :rtype: int

abstract property dimension_target_space: int#

returns: dimension of target space :rtype: int

property evaluations: List#

returns: list of evaluations: each element of the form [input,value of blackbox function at input] :rtype: List

property pareto_front: ndarray#

Return Pareto front of evaluation

Returns:

Pareto front of evaluations

Return type:

np.ndarray

property x: ndarray#

Numpy array of inputs of all evaluations

Returns:

array of inputs of all evaluations

Return type:

np.ndarray

property y: ndarray#

Numpy array of outputs of all evaluations

Returns:

array of outputs of all evaluations

Return type:

np.ndarray