gemseo / problems / analytical

Show inherited members

rastrigin module

The Rastrigin analytic problem

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

Bases: 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.

  • design_space – The design space on which the functions are evaluated.

  • pb_type – The type of the optimization problem.

  • input_database – A database to initialize that of the optimization problem. If None, the optimization problem starts from an empty database.

  • differentiation_method – The default differentiation method to be applied to the functions of the optimization problem.

  • fd_step – The step to be used by the step-based differentiation methods.

  • parallel_differentiation – Whether to approximate the derivatives in

  • parallel.

  • use_standardized_objective – Whether to use standardized objective for logging and post-processing.

  • **parallel_differentiation_options – The options to approximate the derivatives in parallel.

static get_solution()[source]

Return theoretical optimal value of Rastrigin function.


The design variable and objective function at optimum.

static rastrigin(x_dv)[source]

Evaluate the 2nd order Rastrigin function.


x_dv – The design variables.


The Rastrigin function output.

Return type:


static rastrigin_jac(x_dv)[source]

Compute the analytical gradient of 2nd order Rastrigin function.


x_dv – The design variable vector.


The analytical gradient vector of Rastrigin function.

constraints: list[MDOFunction]

The constraints.

current_iter: int

The current iteration.

database: Database

The database to store the optimization problem data.

design_space: DesignSpace

The design space on which the optimization problem is solved.

eq_tolerance: float

The tolerance for the equality constraints.

fd_step: float

The finite differences step.

ineq_tolerance: float

The tolerance for the inequality constraints.

max_iter: int

The maximum iteration.

new_iter_observables: list[MDOFunction]

The observables to be called at each new iterate.

nonproc_constraints: list[MDOFunction]

The non-processed constraints.

nonproc_new_iter_observables: list[MDOFunction]

The non-processed observables to be called at each new iterate.

nonproc_objective: MDOFunction

The non-processed objective function.

nonproc_observables: list[MDOFunction]

The non-processed observables.

observables: list[MDOFunction]

The observables.

pb_type: ProblemType

The type of optimization problem.

preprocess_options: dict

The options to pre-process the functions.

solution: OptimizationResult

The solution of the optimization problem.

stop_if_nan: bool

Whether the optimization stops when a function returns NaN.

use_standardized_objective: bool

Whether to use standardized objective for logging and post-processing.

The standardized objective corresponds to the original one expressed as a cost function to minimize. A DriverLibrary works with this standardized objective and the Database stores its values. However, for convenience, it may be more relevant to log the expression and the values of the original objective.