Rastrigin

Mathematical Definition
Latex
f(x, y)=10n + \sum_{i=1}^{n}(x_i^2 - 10cos(2\pi x_i))
Description and Features
  • The function is continuous.
  • The function is convex.
  • The function is defined on n-dimensional space.
  • The function is multimodal.
  • The function is differentiable.
  • The function is separable.
  • The function is .
Input Domain

The function can be defined on any input domain but it is usually evaluated on $x_i \in [-5.12, 5.12]$ for $i = 1, …, d$ .

Global Minima

The function has one global minimum $f(\textbf{x}^{\ast})=0$ at $\textbf{x}^{\ast} = (0, 0)$.

Implementation
Python Code

def function(x):
    x = np.array(x)
    return 10 * len(x) + (x ** 2 - 10 * np.cos(2 * np.pi * x)).sum()

                                
Solutions
References: