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

F09(x)

Arguments

x

Numeric vector of input values.

Value

Numeric scalar representing the function value.

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

F09(c(0, 0))    # Returns 0 (global minimum)
#> [1] 0
F09(c(1, 1))    # Returns approximately 2
#> [1] 2
F09(rep(0, 10)) # Returns 0 in 10 dimensions
#> [1] 0