Skip to content

Rastrigin

Iannick Gagnon edited this page May 22, 2025 · 5 revisions

Description

The Rastrigin function is a widely used benchmark for testing optimization algorithms due to its high dimensionality and large number of local minima. It is defined mathematically as:

$$ \LARGE f(\vec{x}) = A d + \sum_{i=1}^{d} \left[x_i^2 - A \cos(2\pi x_i)\right] $$

The default $A$ is 10, with $d$ representing the dimensionality of the input vector $\vec{x}$. The default dimensionality (Rastrigin.ndim) is 2.

Visualization

Here is a link to an interactive Desmos version: https://www.desmos.com/3d/btojwoqonz

Rastrigin().visualize()

Features

  1. Multimodality: The function has a large number of local minima, making it challenging for optimization algorithms to find the global minimum.
  2. Global minimum: The global minimum is located at $f(x^*=<0,...,0>) = 0$.
  3. Search space: Typically, the function is evaluated over the bounded region $[-5.12, 5.12]$ for each dimension, which is also the default value.
  4. Periodic nature: The cosine term introduces a periodic aspect to the function, contributing to its complexity and numerous local minima.

Discussion

The Rastrigin function is useful for evaluating the performance of optimization algorithms in terms of their ability to handle high-dimensional, multimodal search spaces with periodicity. Its landscape presents a significant challenge for many optimization techniques, especially those that rely on local search heuristics. Algorithms that can effectively navigate the Rastrigin function's terrain are likely to perform well on a variety of real-world optimization problems.

Sources

The Rastrigin function was introduced by L. A. Rastrigin in his paper titled Systems of extremal control, published in 1974. His work has since been widely referenced in the field of optimization and has become a standard benchmark for testing optimization algorithms.

An accessible reference is simply its Wikipedia page : https://en.wikipedia.org/wiki/Rastrigin_function

Clone this wiki locally