80 [[nodiscard]]
auto value() const noexcept -> const
double& {
90 -> const
Eigen::ArrayXXd& {
100 -> const
Eigen::ArrayXd& {
168 Eigen::ArrayXXd optimal_variables;
170 auto reshaped_optimal_variables = optimal_variables.reshaped();
171 std::generate(reshaped_optimal_variables.begin(),
172 reshaped_optimal_variables.end(),
173 [
this] { return optimal_variable_dist_(generator_); });
175 Eigen::ArrayXd optimal_values;
178 std::generate(optimal_values.begin() + 1, optimal_values.end(),
179 [
this] { return non_global_optimal_value_dist_(generator_); });
181 Eigen::ArrayXd coefficients;
183 coefficients[0] = 1.0;
184 std::generate(coefficients.begin() + 1, coefficients.end(),
185 [
this] { return coefficients_dist_(generator_); });
188 std::move(optimal_values), std::move(coefficients)};
260 Eigen::ArrayXXd optimal_variables;
262 auto reshaped_optimal_variables = optimal_variables.reshaped();
263 std::generate(reshaped_optimal_variables.begin(),
264 reshaped_optimal_variables.end(),
265 [
this] { return optimal_variable_dist_(generator_); });
267 Eigen::ArrayXd optimal_values;
270 std::generate(optimal_values.begin() + 1, optimal_values.end(),
271 [
this] { return non_global_optimal_value_dist_(generator_); });
273 Eigen::ArrayXd coefficients;
275 coefficients[0] = 10.0;
276 std::generate(coefficients.begin() + 1, coefficients.end(),
277 [
this] { return coefficients_dist_(generator_); });
280 std::move(optimal_values), std::move(coefficients)};
Class of functions of multi-variate optimization problems with multiple local optima.
auto optimal_values() const noexcept -> const Eigen::ArrayXd &
Get the optimal values.
Eigen::ArrayXXd optimal_variables_
Optimal variables.
multi_variate_multi_optima_function(Eigen::ArrayXXd optimal_variables, Eigen::ArrayXd optimal_values, Eigen::ArrayXd coefficients)
Constructor.
Eigen::ArrayXd coefficients_
Coefficients for optima.
auto optimal_variables() const noexcept -> const Eigen::ArrayXXd &
Get the optimal variables.
Eigen::ArrayXd optimal_values_
Optimal values.
void evaluate_on(const Eigen::VectorXd &variable) noexcept
Evaluate function value on variable.
auto value() const noexcept -> const double &
Get function value.
auto coefficients() const noexcept -> const Eigen::ArrayXd &
Get the coefficients for optima.
double value_
Function value.
double value_type
Type of function values.
Eigen::VectorXd variable_type
Type of variables.
Eigen::MatrixXd hessian_type
Type of Hessian.
auto operator()() noexcept -> multi_variate_multi_optima_function
Generate a random quadratic function.
static constexpr double max_variable
Maximum optimal variable.
num_collect::index_type num_variables_
Number of variables.
std::uniform_real_distribution< double > non_global_optimal_value_dist_
Distribution of non-global optimal values.
static constexpr double min_non_global_optimal_value
Minimum non-global optimal value.
std::uniform_real_distribution< double > coefficients_dist_
Distribution of coefficients.
std::mt19937 generator_
Random number generator.
static constexpr double max_non_global_optimal_value
Maximum non-global optimal value.
num_collect::index_type num_local_optima_
Number of local minima.
random_multi_variate_difficult_multi_optima_function_generator(num_collect::index_type num_variables, num_collect::index_type num_local_optima=default_num_local_optima)
Constructor.
static constexpr num_collect::index_type default_num_local_optima
Default value of the number of local optima.
static constexpr double min_variable
Minimum optimal variable.
std::uniform_real_distribution< double > optimal_variable_dist_
Distribution of optimal variables.
static constexpr double global_optimal_value
Global optimal value.
auto operator()() noexcept -> multi_variate_multi_optima_function
Generate a random quadratic function.
std::uniform_real_distribution< double > non_global_optimal_value_dist_
Distribution of non-global optimal values.
random_multi_variate_multi_optima_function_generator(num_collect::index_type num_variables, num_collect::index_type num_local_optima=default_num_local_optima)
Constructor.
num_collect::index_type num_local_optima_
Number of local minima.
static constexpr double min_non_global_optimal_value
Minimum non-global optimal value.
static constexpr double max_non_global_optimal_value
Maximum non-global optimal value.
static constexpr double max_variable
Maximum optimal variable.
std::mt19937 generator_
Random number generator.
static constexpr double global_optimal_value
Global optimal value.
std::uniform_real_distribution< double > coefficients_dist_
Distribution of coefficients.
std::uniform_real_distribution< double > optimal_variable_dist_
Distribution of optimal variables.
static constexpr num_collect::index_type default_num_local_optima
Default value of the number of local optima.
num_collect::index_type num_variables_
Number of variables.
static constexpr double min_variable
Minimum optimal variable.
Definition of exceptions.
Definition of index_type type.
Namespace of Eigen library.
std::ptrdiff_t index_type
Type of indices in this library.
Namespace of optimization problems.