ackley


The Ackley function is widely used for testing optimization algorithms. In its two-dimensional form, as shown in the plot above, it is characterized by a nearly flat outer region, and a large hole at the centre [1].

of = ackley(x)

Input variables

Name Description Type
x Current design variables of the i agent. List

Output variables

Name Description Type
of Objective function value of the i agent. Float

Problem

\[ f(\mathbf{x}) = -\alpha \exp \left( -b \sqrt{\frac{1}{d}\sum_{i=1}^{d} x_{i}^{2}} \right ) -\exp \left ( \frac{1}{d} \sum_{i=1}^{d} \cos (cx_{i}) \right ) + \alpha + exp(1) \]

(1)

\[ x_{i} \in [-32.768, 32.768], i=1, ... , d; \;...\; f(\mathbf{x}^*) = 0, \; \mathbf{x}^* = (0,...,0) \]

(2)

Example 1

Considering the design variable \(\mathbf{x} = [0,0]\), what value does the objective function expect?

# Data
x = [0, 0]

# Call function
of = ackley(x)

# Output details
print("of_best rastrigin: of = {:.4f}".format(of))
of_best ackley: of = 0.0000

Reference list