59template <concepts::
objective_function ObjectiveFunction>
61 :
public optimizer_base<gaussian_process_optimizer<ObjectiveFunction>> {
73 using value_type =
typename objective_function_type::value_type;
111 "Lower and upper limits must have the same size.");
162 iteration_logger.template append<index_type>(
164 iteration_logger.template append<index_type>(
166 iteration_logger.template append<value_type>(
206 "Maximum number of function evaluations must be a positive "
221 "Maximum number of evaluations of lower bounds must be a positive "
260 constexpr auto safe_limit =
261 std::numeric_limits<value_type>::max() * 1e-2;
262 if (!
isfinite(value) || value > safe_limit) {
275 const auto lower_bound_function =
282 const auto [mean, variance] =
284 const auto variance_coeff =
static_cast<value_type>(2) *
293 max(variance_coeff * variance,
static_cast<value_type>(0)));
Definition of any_objective_function class.
Definition of assertion macros.
#define NUM_COLLECT_ASSERT(CONDITION)
Macro to check whether a condition is satisfied.
Class to write logs of iterations.
Class of tags of logs without memory management.
void configure_child_algorithm_logger_if_exists(Child &child)
Configure a logger of a child algorithm if exists.
auto logger() const noexcept -> const num_collect::logging::logger &
Access to the logger.
Class to store any type of objects of objective functions.
Class of dividing rectangles (DIRECT) method jones1993 for optimization.
Class of Gaussian process optimization srinivas2010, brochu2010.
static constexpr index_type default_max_lower_bound_evaluations
Default value of the maximum number of evaluations of lower bounds.
index_type max_evaluations_
Maximum number of function evaluations.
auto evaluations() const noexcept -> index_type
Get the number of function evaluations.
void evaluate_on(const variable_type &variable)
Evaluate function value.
void configure_iteration_logger(logging::iterations::iteration_logger< this_type > &iteration_logger) const
Configure an iteration logger.
auto max_lower_bound_evaluations(index_type value) -> gaussian_process_optimizer &
Set the maximum number of evaluations of lower bounds.
auto opt_variable() const -> const variable_type &
Get current optimal variable.
Eigen::VectorX< value_type > values_
Function values of sample points.
auto is_stop_criteria_satisfied() const -> bool
Determine if stopping criteria of the algorithm are satisfied.
index_type dim_
Number of dimension.
value_type opt_value_
Current optimal value.
index_type evaluations_
Number of function evaluations.
void change_objective_function(const objective_function_type &obj_fun)
Change the objective function.
typename objective_function_type::value_type value_type
Type of function values.
typename objective_function_type::variable_type variable_type
Type of variables.
gaussian_process_optimizer(const objective_function_type &obj_fun=objective_function_type())
Constructor.
ObjectiveFunction objective_function_type
Type of the objective function.
void iterate()
Iterate the algorithm once.
void init(const variable_type &lower, const variable_type &upper)
Initialize the algorithm.
index_type iterations_
Number of iterations.
variable_type opt_variable_
Current optimal variable.
auto iterations() const noexcept -> index_type
Get the number of iterations.
interpolator_type interpolator_
Interpolator.
static constexpr index_type default_max_evaluations
Default value of the maximum number of function evaluations.
variable_type upper_
Element-wise upper limit.
variable_type lower_
Element-wise lower limit.
auto try_find_and_evaluate_using_lower_bound() -> bool
Try to find a sample point using lower bounds and evaluate a function value for the sample point.
auto opt_value() const -> const value_type &
Get current optimal value.
auto max_evaluations(index_type value) -> gaussian_process_optimizer &
Set the maximum number of function evaluations.
static auto correct_value_if_needed(value_type value) noexcept -> value_type
Correct function values if needed.
objective_function_type obj_fun_
Objective function.
std::vector< variable_type > variables_
Variables of sample points.
dividing_rectangles< any_objective_function< value_type(variable_type)> > lower_bound_optimizer_
Optimizer of lower bounds.
Base class of implementations of optimization algorithms.
auto evaluate_mean_and_variance_on(const variable_type &variable) const -> std::pair< function_value_type, function_value_type >
Evaluate mean and variance in the gaussian process for a variable.
void compute(const std::vector< variable_type > &variables, const function_value_vector_type &function_values)
Compute parameters for interpolation.
Definition of dividing_rectangles class.
Definition of exceptions.
Definition of gaussian_process_interpolator class.
Definition of get_size class.
Definition of index_type type.
Definition of is_eigen_vector class.
Definition of isfinite function.
Definition of iteration_logger class.
Definition of log_tag_view class.
Definition of macros for logging.
std::ptrdiff_t index_type
Type of indices in this library.
auto get_size(const Matrix &matrix) -> index_type
Get the size.
auto isfinite(const T &val) -> bool
Check whether a number is finite.
constexpr T pi
Value of pi, .
Namespace of optimization algorithms.
constexpr auto gaussian_process_optimizer_tag
Tag of gaussian_process_optimizer.
constexpr bool is_eigen_vector_v
Get whether a type is a Eigen's vector.
Definition of objective_function concept.
Definition of optimizer_base class.
Definition of NUM_COLLECT_PRECONDITION macro.
#define NUM_COLLECT_PRECONDITION(CONDITION,...)
Check whether a precondition is satisfied and throw an exception if not.