53 constexpr double two = 2.0;
65 constexpr double two = 2.0;
74 [[nodiscard]]
auto value() const noexcept -> const
double& {
83 [[nodiscard]]
auto gradient() const noexcept -> const
Eigen::VectorXd& {
92 [[nodiscard]]
auto hessian() const noexcept -> const
Eigen::MatrixXd& {
102 -> const
Eigen::VectorXd& {
162 Eigen::VectorXd optimal_variable;
164 std::generate(optimal_variable.begin(), optimal_variable.end(),
165 [
this] { return optimal_variable_dist_(generator_); });
167 Eigen::VectorXd coefficients;
169 std::generate(coefficients.begin(), coefficients.end(),
170 [
this] { return coeff_dist_(generator_); });
173 std::move(optimal_variable), std::move(coefficients)};
Class to generate random random_multi_quadratic_function objects.
std::mt19937 generator_
Random number generator.
static constexpr double min_variable
Minimum optimal variable.
random_multi_quadratic_function_generator(num_collect::index_type num_variables)
Constructor.
auto operator()() noexcept -> random_multi_quadratic_function
Generate a random quadratic function.
num_collect::index_type num_variables_
Number of variables.
std::uniform_real_distribution< double > optimal_variable_dist_
Distribution of optimal variables.
static constexpr double max_variable
Maximum optimal variable.
std::uniform_real_distribution< double > coeff_dist_
Distribution of coefficients.
Class of multi-variate quadratic functions with random coefficients and optimal variables.
Eigen::VectorXd variable_type
Type of variables.
random_multi_quadratic_function(Eigen::VectorXd optimal_variable, Eigen::VectorXd coefficients)
Constructor.
auto optimal_variable() const noexcept -> const Eigen::VectorXd &
Get the optimal variable.
Eigen::MatrixXd hessian_
Hessian.
double value_
Function value.
Eigen::VectorXd grad_
Gradient.
auto coefficients() const noexcept -> const Eigen::VectorXd &
Get the coefficients.
Eigen::VectorXd diff_
Buffer of difference.
auto gradient() const noexcept -> const Eigen::VectorXd &
Get gradient.
auto value() const noexcept -> const double &
Get function value.
void evaluate_on(const Eigen::VectorXd &variable) noexcept
Evaluate function value on variable.
Eigen::VectorXd coefficients_
Coefficients.
Eigen::MatrixXd hessian_type
Type of Hessian.
Eigen::VectorXd optimal_variable_
Optimal variable.
auto hessian() const noexcept -> const Eigen::MatrixXd &
Get Hessian.
double value_type
Type of function values.
Definition of index_type type.
Namespace of Eigen library.
std::ptrdiff_t index_type
Type of indices in this library.
Namespace of optimization problems.