Learn R Programming

marinepredator (version 0.0.1)

F09: Rastrigin Function (F09)

Description

A highly multimodal test function with many local minima arranged in a regular lattice pattern. The global minimum is at the origin.

Usage

F09(x)

Value

Numeric scalar representing the function value.

Arguments

x

Numeric vector of input values.

Details

Formula: $$f(x) = 10n + \sum_{i=1}^{n} \left[x_i^2 - 10\cos(2\pi x_i)\right]$$

Global minimum: \(f(0, 0, ..., 0) = 0\)

Characteristics:

  • Type: Multimodal

  • Separable: Yes

  • Differentiable: Yes

  • Number of local minima: \(\approx 10^n\)

  • Default bounds: \([-5.12, 5.12]^n\)

  • Default dimensions: 50

The Rastrigin function is a typical example of non-linear multimodal function. The large number of local minima makes it difficult for optimization algorithms to find the global minimum.

See Also

test-functions for an overview of all test functions, get_function_details to retrieve function parameters.

Examples

Run this code
F09(c(0, 0))    # Returns 0 (global minimum)
F09(c(1, 1))    # Returns approximately 2
F09(rep(0, 10)) # Returns 0 in 10 dimensions

Run the code above in your browser using DataLab