Function argmin_testfunctions::rastrigin

source ยท
pub fn rastrigin<T>(param: &[T]) -> T
where T: Float + FromPrimitive + Sum,
Expand description

Rastrigin test function

Defined as

f(x_1, x_2, ..., x_n) = a * n + \sum_{i=1}^{n} \left[ x_i^2 - a * cos(2 * pi * x_i) \right]

where x_i \in [-5.12, 5.12] and a = 10

The global minimum is at f(x_1, x_2, ..., x_n) = f(0, 0, ..., 0) = 0.