Skip to content

Rosenbrock

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

Description [view source]

The Rosenbrock function is a widely used benchmark for testing optimization algorithms. It is defined mathematically as:

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

Where $d$ corresponds to the number of dimensions (Rosenbrock.ndim) with a default value of 2.

Visualization

Here is a link to an interactive Desmos version (note: it is scaled for better visibility): https://www.desmos.com/3d/siewparbrw

Rosenbrock().visualize()

Rosenbrock().visualize(plot_bounds=[(-3, 3), (-0.25, 1.25)])

Features

  1. Non-convexity: The function has a narrow, curved valley containing the global minimum. Finding the valley is trivial, but converging to the global minimum is challenging.
  2. Global minimum: The global minimum is $f(x^{*}=<1,...,1>)=0$.
  3. Search space: Typically, it is evaluated over $[-5, 10]$ for each dimension.
  4. Smoothness: The function is smooth and differentiable, which is advantageous for gradient-based optimization methods.

Discussion

The Rosenbrock function is often used to test the performance of optimization algorithms, especially in terms of their ability to handle non-convexity and narrow, curved valleys. Algorithms tend to find the valley rather easily, but then progress slowly or fail due to a weak gradient.

Finally, the position of it's global minimum (i.e., $<1,...,1>$) naturally diminishes the impact of the origin bias that some PSO-inspired algorithms tend to show.

Sources

It was introduced by Howard H. Rosenbrock (short biography) in his 1960 article titled An Automatic Method for finding the Greatest or Least Value of a Function. We make this article available here with the publisher's permission : Rosenbrock (1960).pdf

Another worthwhile reference is simply it's Wikipedia page : https://en.wikipedia.org/wiki/Rosenbrock_function

Clone this wiki locally