Rastrigin function

In mathematical optimization, the Rastrigin function is a non-convex function used as a performance test problem for optimization algorithms. It is a typical example of non-linear multimodal function. It was first proposed in 1974 by Rastrigin as a 2-dimensional function and has been generalized by Rudolph. The generalized version was popularized by Hoffmeister &amp; Bäck and Mühlenbein et al. Finding the minimum of this function is a fairly difficult problem due to its large search space and its large number of local minima.

On an $$n$$-dimensional domain it is defined by:
 * $$f(\mathbf{x}) = A n + \sum_{i=1}^n \left[x_i^2 - A\cos(2 \pi x_i)\right]$$

where $$A=10$$ and $$x_i\in[-5.12,5.12] $$. There are many extrema:
 * The global minimum is at $$\mathbf{x} = \mathbf{0}$$ where $$f(\mathbf{x})=0$$.
 * The maximum function value for $$x_i\in[-5.12,5.12] $$ is located around $$x_i\in[\pm4.52299366..., ..., \pm4.52299366...]$$:

Here are all the values at 0.5 interval listed for the 2D Rastrigin function with $$x_i\in[-5.12,5.12] $$:

The abundance of local minima underlines the necessity of a global optimization algorithm when needing to find the global minimum. Local optimization algorithms are likely to get stuck in a local minimum.