cbx.objectives.Ackley#

class cbx.objectives.Ackley(A=20.0, b=0.2, c=6.283185307179586, minimum=None)[source]#

Bases: cbx_objective

Ackley’s function

Ackley’s function is a multimodal function with a global minima at \((0,0)\). The function is originally defined on \(\mathbb{R}^2\) as

\[f(x,y) = -20 \exp \left( -b \sqrt{\frac{1}{2} (x^2 + y^2)} \right) - \exp \left( \frac{1}{2} (\cos(c x) + \cos(c y)) \right) + a + e\]

See Ackley’s function.

Parameters:
  • a (float, optional) – The default is 20.0.

  • b (float, optional) – The default is 0.2.

  • c (float, optional) – The default is 2*np.pi.

Examples

>>> import numpy as np
>>> from cbx.objectives import Ackley
>>> x = np.array([[1,2], [3,4], [5,6]])
>>> f = Ackley()
>>> f(x)
array([  68.,  148., 1556.])

Visualization#

(Source code)