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 & 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 -dimensional domain it is defined by:
 
where   and . There are many extrema:
 The global minimum is at  where .
 The maximum function value for  is located around :

Here are all the values at 0.5 interval listed for the 2D Rastrigin function with :

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.

See also 
Test functions for optimization

Notes

Mathematical optimization