MINLP Rastrigin#
-
struct minlp_rastrigin#
A MINLP version of the Rastrigin problem.
This is a scalable, box-constrained, mixed integer nonlinear programmng (MINLP) 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) \]where we constraint the last \(m\) components of the decision vector to be integers. The variables are box bounded as follows: \(\quad x_i \in [-5.12,5.12], \forall i = 1 .. n-m\), \(\quad x_i \in [-10,-5], \forall i = m+1 .. n\)
Gradients (dense) are also provided (also for the integer part) 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) \]Public Functions
-
minlp_rastrigin(unsigned dim_c = 1u, unsigned dim_i = 1u)#
Constructor from continuous and integer dimension.
Constructs a MINLP Rastrigin problem.
- Parameters
dim_c – the problem continuous dimension.
dim_i – the problem continuous dimension.
- Throws
std::invalid_argument – if
dim_c+
dim_i
is < 1
-
vector_double fitness(const vector_double&) const#
Fitness computation.
Computes the fitness for this UDP.
- Parameters
x – the decision vector.
- Returns
the fitness of
x
.
-
std::pair<vector_double, vector_double> get_bounds() const#
Box-bounds.
It returns the box-bounds for this UDP.
- Returns
the lower and upper bounds for each of the decision vector components
-
inline vector_double::size_type get_nix() const#
Integer dimension.
It returns the integer dimension of the problem.
- Returns
the integer dimension of the problem.
-
vector_double gradient(const vector_double&) const#
Gradients.
It returns the fitness gradient for this UDP.
The gradient is represented in a sparse form as required by problem::gradient().
- Parameters
x – the decision vector.
- Returns
the gradient of the fitness function
-
std::vector<vector_double> hessians(const vector_double&) const#
Hessians.
It returns the hessians for this UDP.
The hessians are represented in a sparse form as required by problem::hessians().
- Parameters
x – the decision vector.
- Returns
the hessians of the fitness function
-
std::vector<sparsity_pattern> hessians_sparsity() const#
Hessians sparsity (only the diagonal elements are non zero)
It returns the hessian sparisty structure for this UDP.
The hessian sparisty is represented in the form required by problem::hessians_sparsity().
- Returns
the hessians of the fitness function
-
inline std::string get_name() const#
Problem name.
- Returns
a string containing the problem name
-
std::string get_extra_info() const#
Extra info.
- Returns
a string containing extra info on the problem
-
minlp_rastrigin(unsigned dim_c = 1u, unsigned dim_i = 1u)#