panobbgo.lib.classic.Rastrigin#

class panobbgo.lib.classic.Rastrigin[source]#
\[f(x) = \mathit{par}_1 \cdot n + \sum_i (x_i^2 - 10 \cos(2 \pi x_i) )\]
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__(dims: int, par1: float = 10, offset: float = 0, box: Sequence[Tuple[float, float]] | None = None, **kwargs: Any)[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__(dims[, par1, offset, box])

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.