## 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**


```python
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()
```

be5e8236a5fbeb9660bc74b9e1374b3513193659
ipynb
Jupyter Notebook
source/problems/single/ackley.ipynb
SunTzunami/pymoo-doc
f82d8908fe60792d49a7684c4bfba4a6c1339daf
Apache-2.0
2021-09-11T06:43:49.000Z
2021-11-10T13:36:09.000Z
source/problems/single/ackley.ipynb
SunTzunami/pymoo-doc
f82d8908fe60792d49a7684c4bfba4a6c1339daf
Apache-2.0
2021-09-21T14:04:47.000Z
2022-03-07T13:46:09.000Z
source/problems/single/ackley.ipynb
SunTzunami/pymoo-doc
f82d8908fe60792d49a7684c4bfba4a6c1339daf
Apache-2.0
2021-10-09T02:47:26.000Z
2022-02-10T07:02:37.000Z
Qwen/Qwen-72B
1. YES
2. YES