Rastrigin

struct pagmo::rastrigin

The Rastrigin problem.

../../_images/rastrigin.png

This is a scalable box-constrained continuous single-objective problem. The objective function is the generalised n-dimensional Rastrigin function:

\[ F\left(x_1,\ldots,x_n\right) = 10 \cdot n + \sum_{i=1}^n x_i^2 - 10\cdot\cos\left( 2\pi \cdot x_i \right), \quad x_i \in \left[ -5.12,5.12 \right]. \]

Gradients (dense) are also provided as:

\[ G_i\left(x_1,\ldots,x_n\right) = 2 x_i + 10 \cdot 2\pi \cdot\sin\left( 2\pi \cdot x_i \right) \]
And Hessians (sparse as only the diagonal is non-zero) are:
\[ H_{ii}\left(x_1,\ldots,x_n\right) = 2 + 10 \cdot 4\pi^2 \cdot\cos\left( 2\pi \cdot x_i \right) \]
The global minimum is in the origin, where \( F\left( 0,\ldots,0 \right) = 0 \).

Public Functions

rastrigin(unsigned int dim = 1u)

Constructor from dimension.

vector_double fitness(const vector_double &x) const

Fitness.

std::pair<vector_double, vector_double> get_bounds() const

Problem bounds.

vector_double gradient(const vector_double &x) const

Gradients (dense)

std::vector<vector_double> hessians(const vector_double &x) const

Hessians (sparse) only the diagonal elements are non zero.

std::vector<sparsity_pattern> hessians_sparsity() const

Hessian sparsity.

std::string get_name() const

Problem name.

vector_double best_known() const

Optimal solution.

template <typename Archive>
void serialize(Archive &ar)

Serialization.

Public Members

unsigned int m_dim

Problem dimensions.