pymoo
Latest Version: pymoo==0.4.1

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. The function poses a risk for optimization algorithms, particularly hillclimbing algorithms, to be trapped in one of its many local minima.

Definition

\begin{align} \begin{split} f(x) &=& \,-a \exp{ \Bigg[ -b \, \sqrt{ \frac{1}{n} \sum_{i=1}^{n}{x_i}^2 } \Bigg]} - \exp{ \Bigg[ \frac{1}{n}\sum_{i=1}^{n}{cos(c x_i)} \Bigg] } + a + e, \\[2mm] && a = \;20, \quad b = \; \frac{1}{5}, \quad c = \;2 \pi \\[2mm] &&-32.768 \leq x_i \leq 32.768, \quad i=1 \ldots,n \\[4mm] \end{split} \end{align}

Optimum

\[f(x^*) = 0 \; \text{at} \; x^* = (0,\ldots,0)\]

Contour

[1]:
import numpy as np
from pymoo.factory import get_problem, get_visualization

problem = get_problem("ackley", n_var=2, a=20, b=1/5, c=2 * np.pi)
get_visualization("fitness-landscape", problem, angle=(45, 45), _type="surface").show()
get_visualization("fitness-landscape", problem, _type="contour", colorbar=True).show()
../../_images/problems_single_ackley_7_0.png
../../_images/problems_single_ackley_7_1.png
[ ]: