gemseo / problems / analytical

rastrigin module

The Rastrigin analytic problem

class gemseo.problems.analytical.rastrigin.Rastrigin[source]

Bases: gemseo.algos.opt_problem.OptimizationProblem

Rastrigin OptimizationProblem uses the Rastrigin objective function with the DesignSpace \([-0.1,0.1]^2\)


the Rastrigin function is a non-convex function used as a performance test problem for optimization algorithms. It is a typical example of non-linear multimodal function. It was first proposed by [Rastrigin] as a 2-dimensional function and has been generalized by [MuhlenbeinEtAl]. Finding the minimum of this function is a fairly difficult problem due to its large search space and its large number of local minima. It has a global minimum at \(x=0\) where \(f(x)=0\). It can be extended to \(n>2\) dimensions:

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

[Rastrigin] Rastrigin, L. A. “Systems of extremal control.” Mir, Moscow (1974).

[MuhlenbeinEtAl] H. Mühlenbein, D. Schomisch and J. Born. “The Parallel Genetic Algorithm as Function Optimizer “. Parallel Computing, 17, pages 619–632, 1991.

The constructor initializes the Rastrigin OptimizationProblem by defining the DesignSpace and the objective function.

static get_solution()[source]

Return theoretical optimal value of Rastrigin function.


design variables values of optimized values, function value at optimum

Return type

numpy array

static rastrigin(x_dv)[source]

This function computes the order n=2 Rastrigin function.


x_dv – design variable vector of size 2


result of Rastrigin function evaluation

static rastrigin_jac(x_dv)[source]

This function computes the analytical gradient of 2nd order Rastrigin function.


x_dv (numpy array) – design variable vector


analytical gradient vector of Rastrigin function

Return type

numpy array