panobbgo.lib.Problem#

class panobbgo.lib.Problem(box: List[Tuple[float, float]] | Sequence[Tuple[float, float]] | Tuple[Tuple[float, float], ...], dx: ndarray | List[float] | Tuple[float, ...] | None = None)[source]#

this is used to store the objective function, information about the problem, etc.

Parameters:
  • box (list) – list of tuples for the bounding box with length n, e.g.: \(\left[ (-1,1), (-100, 0), (0, 0.01) \right]\).

  • dx (list) – translation of the whole problem, an n-dimensional vector (default: None). The search box becomes box + dx and the objective is evaluated at x - dx, i.e. the problem seen by the optimiser is \(g(x) = f(x - dx)\) and a minimiser \(x^*\) of \(f\) moves to \(x^* + dx\). Every point the objective sees lies in the original box.

__init__(box: List[Tuple[float, float]] | Sequence[Tuple[float, float]] | Tuple[Tuple[float, float], ...], dx: ndarray | List[float] | Tuple[float, ...] | None = None) → None[source]#
Parameters:
  • box (list) – list of tuples for the bounding box with length n, e.g.: \(\left[ (-1,1), (-100, 0), (0, 0.01) \right]\).

  • dx (list) – translation of the whole problem, an n-dimensional vector (default: None). The search box becomes box + dx and the objective is evaluated at x - dx, i.e. the problem seen by the optimiser is \(g(x) = f(x - dx)\) and a minimiser \(x^*\) of \(f\) moves to \(x^* + dx\). Every point the objective sees lies in the original box.

Methods

__init__(box[, dx])

eval(x)

This is called to evaluate the given black-box function.

eval_constraints(x)

This method is optionally overwritten by the problem to calculate the constraint violations.

project(point)

projects given point into the search box.

random_point([distribution, rng])

Generates a random point inside the given search box.

Attributes

box

The bounding box for this problem, a \((\mathit{dim},2)\)-array.

center

center of the box

dim

The number of dimensions.

ranges

The ranges along each dimension, a numpy.ndarray.