Ackley Function
Mathematical Definition
\[f(\textbf{x}) = f(x_1, ..., x_n)= -a.exp(-b\sqrt{\frac{1}{n}\sum_{i=1}^{n}x_i^2})-exp(\frac{1}{n}\sum_{i=1}^{n}cos(cx_i))+ a + exp(1)\]In the above equation, the values $a$, $b$ and $c$ are constants and are usually chosen as $a=20$, $b=0.2$ and $c=2\pi$.
Plots
The contour of the function is as presented below:
Description and Features
- The function is continuous.
- The function is not convex.
- The function is defined on n-dimensional space.
- The function is multimodal.
Input Domain
The function can be defined on any input domain but it is usually evaluated on $x_i \in [-32, 32]$ for all $i = 1,…,n$.
Global Minima
The function has one global minimum at: $f(\textbf{x}^{\ast})=0$ at $\textbf{x}^{\ast} = (0, …, 0)$.
Implementation
Python
For Python, the function is implemented in the benchmarkfcns package and can be installed from command line with pip install benchmarkfcns
.
MATLAB
An implementation of the Ackley Function with MATLAB is provided below.
The function can be represented in Latex as follows:
Acknowledgement
The author would like to thank Prof. Ivo Welch for kindly contributing to the correctness of this document by pointing out some inconsistencies in the text.
See also:
References:
- http://www.sfu.ca/~ssurjano/ackley.html
- https://en.wikipedia.org/wiki/Test_functions_for_optimization
- http://www.cs.unm.edu/~neal.holts/dga/benchmarkFunction/ackley.html, This resource
contains an extensive collection of references for this function. The page also contains an implementation of the function in
Python
.