numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::opt::gaussian_process_optimizer< ObjectiveFunction > Class Template Reference

Class of Gaussian process optimization [30], [4]. More...

#include <num_collect/opt/gaussian_process_optimizer.h>

Inheritance diagram for num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >:
Collaboration diagram for num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >:

Public Types

using objective_function_type = ObjectiveFunction
 Type of the objective function.
using this_type = gaussian_process_optimizer<ObjectiveFunction>
 This class.
using value_type = typename objective_function_type::value_type
 Type of function values.
using variable_type = typename objective_function_type::variable_type
 Type of variables.

Public Member Functions

 gaussian_process_optimizer (const objective_function_type &obj_fun=objective_function_type())
 Constructor.
void change_objective_function (const objective_function_type &obj_fun)
 Change the objective function.
void configure_iteration_logger (logging::iterations::iteration_logger< this_type > &iteration_logger) const
 Configure an iteration logger.
auto evaluations () const noexcept -> index_type
 Get the number of function evaluations.
void init (const variable_type &lower, const variable_type &upper)
 Initialize the algorithm.
auto is_stop_criteria_satisfied () const -> bool
 Determine if stopping criteria of the algorithm are satisfied.
void iterate ()
 Iterate the algorithm once.
auto iterations () const noexcept -> index_type
 Get the number of iterations.
auto max_evaluations (index_type value) -> gaussian_process_optimizer &
 Set the maximum number of function evaluations.
auto max_lower_bound_evaluations (index_type value) -> gaussian_process_optimizer &
 Set the maximum number of evaluations of lower bounds.
auto opt_value () const -> const value_type &
 Get current optimal value.
auto opt_variable () const -> const variable_type &
 Get current optimal variable.
Public Member Functions inherited from num_collect::opt::optimizer_base< gaussian_process_optimizer< ObjectiveFunction > >
 optimizer_base (logging::log_tag_view tag)
 Constructor.
auto evaluations () const noexcept -> index_type
 Get the number of function evaluations.
auto iterations () const noexcept -> index_type
 Get the number of iterations.
auto opt_value () const
 Get current optimal value.
auto opt_variable () const
 Get current optimal variable.
Public Member Functions inherited from num_collect::base::iterative_solver_base< gaussian_process_optimizer< ObjectiveFunction > >
 iterative_solver_base (logging::log_tag_view tag)
 Constructor.
auto is_stop_criteria_satisfied () const -> bool
 Determine if stopping criteria of the algorithm are satisfied.
void iterate ()
 Iterate the algorithm once.
void solve ()
 Solve the problem.
Public Member Functions inherited from num_collect::logging::logging_mixin
 logging_mixin (log_tag_view tag)
 Constructor.
template<typename Child>
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.
auto logger () noexcept -> num_collect::logging::logger &
 Access to the logger.
Public Member Functions inherited from num_collect::logging::iterations::iteration_logger_mixin< gaussian_process_optimizer< ObjectiveFunction > >
 iteration_logger_mixin ()=default
 Constructor.
void configure_iteration_logger (num_collect::logging::iterations::iteration_logger< gaussian_process_optimizer< ObjectiveFunction > > &iteration_logger) const
 Configure an iteration logger.
auto initialize_iteration_logger () -> num_collect::logging::iterations::iteration_logger< gaussian_process_optimizer< ObjectiveFunction > > &
 Get the iteration logger.

Private Types

using interpolator_type
 Type of interpolator.

Private Member Functions

void evaluate_on (const variable_type &variable)
 Evaluate function value.
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.

Static Private Member Functions

static auto correct_value_if_needed (value_type value) noexcept -> value_type
 Correct function values if needed.

Private Attributes

index_type dim_ {0}
 Number of dimension.
index_type evaluations_ {0}
 Number of function evaluations.
interpolator_type interpolator_ {}
 Interpolator.
index_type iterations_ {0}
 Number of iterations.
variable_type lower_ {}
 Element-wise lower limit.
dividing_rectangles< any_objective_function< value_type(variable_type)> > lower_bound_optimizer_ {}
 Optimizer of lower bounds.
index_type max_evaluations_ {default_max_evaluations}
 Maximum number of function evaluations.
objective_function_type obj_fun_
 Objective function.
value_type opt_value_ {}
 Current optimal value.
variable_type opt_variable_ {}
 Current optimal variable.
variable_type upper_ {}
 Element-wise upper limit.
Eigen::VectorX< value_typevalues_ {}
 Function values of sample points.
std::vector< variable_typevariables_ {}
 Variables of sample points.

Static Private Attributes

static constexpr index_type default_max_evaluations = 20
 Default value of the maximum number of function evaluations.
static constexpr index_type default_max_lower_bound_evaluations = 100
 Default value of the maximum number of evaluations of lower bounds.

Additional Inherited Members

Protected Member Functions inherited from num_collect::base::iterative_solver_base< gaussian_process_optimizer< ObjectiveFunction > >
auto derived () noexcept -> gaussian_process_optimizer< ObjectiveFunction > &
 Access derived object.

Detailed Description

template<concepts::objective_function ObjectiveFunction>
class num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >

Class of Gaussian process optimization [30], [4].

Template Parameters
ObjectiveFunctionType of the objective function.

Definition at line 60 of file gaussian_process_optimizer.h.

Member Typedef Documentation

◆ interpolator_type

template<concepts::objective_function ObjectiveFunction>
using num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::interpolator_type
private
Initial value:
typename objective_function_type::value_type value_type
Type of function values.
typename objective_function_type::variable_type variable_type
Type of variables.
Class to interpolate using Gaussian process.

Type of interpolator.

Definition at line 231 of file gaussian_process_optimizer.h.

◆ objective_function_type

template<concepts::objective_function ObjectiveFunction>
using num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::objective_function_type = ObjectiveFunction

Type of the objective function.

Definition at line 67 of file gaussian_process_optimizer.h.

◆ this_type

template<concepts::objective_function ObjectiveFunction>
using num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::this_type = gaussian_process_optimizer<ObjectiveFunction>

This class.

Definition at line 64 of file gaussian_process_optimizer.h.

◆ value_type

template<concepts::objective_function ObjectiveFunction>
using num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::value_type = typename objective_function_type::value_type

Type of function values.

Definition at line 73 of file gaussian_process_optimizer.h.

◆ variable_type

template<concepts::objective_function ObjectiveFunction>
using num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::variable_type = typename objective_function_type::variable_type

Type of variables.

Definition at line 70 of file gaussian_process_optimizer.h.

Constructor & Destructor Documentation

◆ gaussian_process_optimizer()

template<concepts::objective_function ObjectiveFunction>
num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::gaussian_process_optimizer ( const objective_function_type & obj_fun = objective_function_type())
inlineexplicit

Constructor.

Parameters
[in]obj_funObjective function.

Definition at line 80 of file gaussian_process_optimizer.h.

Member Function Documentation

◆ change_objective_function()

template<concepts::objective_function ObjectiveFunction>
void num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::change_objective_function ( const objective_function_type & obj_fun)
inline

Change the objective function.

Parameters
[in]obj_funObjective function.

Definition at line 97 of file gaussian_process_optimizer.h.

◆ configure_iteration_logger()

template<concepts::objective_function ObjectiveFunction>
void num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::configure_iteration_logger ( logging::iterations::iteration_logger< this_type > & iteration_logger) const
inline

Configure an iteration logger.

Parameters
[in]iteration_loggerIteration logger.

Definition at line 159 of file gaussian_process_optimizer.h.

◆ correct_value_if_needed()

template<concepts::objective_function ObjectiveFunction>
auto num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::correct_value_if_needed ( value_type value) -> value_type
inlinestaticnodiscardprivatenoexcept

Correct function values if needed.

Parameters
[in]valueFunction value.
Returns
Corrected value.

Definition at line 258 of file gaussian_process_optimizer.h.

◆ evaluate_on()

template<concepts::objective_function ObjectiveFunction>
void num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::evaluate_on ( const variable_type & variable)
inlineprivate

Evaluate function value.

Parameters
[in]variableVariable.

Definition at line 239 of file gaussian_process_optimizer.h.

◆ evaluations()

template<concepts::objective_function ObjectiveFunction>
auto num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::evaluations ( ) const -> index_type
inlinenodiscardnoexcept

Get the number of function evaluations.

Returns
Number of function evaluations.

Definition at line 194 of file gaussian_process_optimizer.h.

◆ init()

template<concepts::objective_function ObjectiveFunction>
void num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::init ( const variable_type & lower,
const variable_type & upper )
inline

Initialize the algorithm.

Parameters
[in]lowerLower limit.
[in]upperUpper limit.

Definition at line 107 of file gaussian_process_optimizer.h.

◆ is_stop_criteria_satisfied()

template<concepts::objective_function ObjectiveFunction>
auto num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::is_stop_criteria_satisfied ( ) const -> bool
inlinenodiscard

Determine if stopping criteria of the algorithm are satisfied.

Returns
If stopping criteria of the algorithm are satisfied.

Definition at line 152 of file gaussian_process_optimizer.h.

◆ iterate()

template<concepts::objective_function ObjectiveFunction>
void num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::iterate ( )
inline

Iterate the algorithm once.

Warning
Any required initializations (with init functions) are assumed to have been done.

Definition at line 136 of file gaussian_process_optimizer.h.

◆ iterations()

template<concepts::objective_function ObjectiveFunction>
auto num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::iterations ( ) const -> index_type
inlinenodiscardnoexcept

Get the number of iterations.

Returns
Number of iterations.

Definition at line 187 of file gaussian_process_optimizer.h.

◆ max_evaluations()

template<concepts::objective_function ObjectiveFunction>
auto num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::max_evaluations ( index_type value) -> gaussian_process_optimizer&
inline

Set the maximum number of function evaluations.

Parameters
[in]valueValue.
Returns
This object.

Definition at line 204 of file gaussian_process_optimizer.h.

◆ max_lower_bound_evaluations()

template<concepts::objective_function ObjectiveFunction>
auto num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::max_lower_bound_evaluations ( index_type value) -> gaussian_process_optimizer&
inline

Set the maximum number of evaluations of lower bounds.

Parameters
[in]valueValue.
Returns
This object.

Definition at line 218 of file gaussian_process_optimizer.h.

◆ opt_value()

template<concepts::objective_function ObjectiveFunction>
auto num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::opt_value ( ) const -> const value_type&
inlinenodiscard

Get current optimal value.

Returns
Current optimal value.

Definition at line 180 of file gaussian_process_optimizer.h.

◆ opt_variable()

template<concepts::objective_function ObjectiveFunction>
auto num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::opt_variable ( ) const -> const variable_type&
inlinenodiscard

Get current optimal variable.

Returns
Current optimal variable.

Definition at line 173 of file gaussian_process_optimizer.h.

◆ try_find_and_evaluate_using_lower_bound()

template<concepts::objective_function ObjectiveFunction>
auto num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::try_find_and_evaluate_using_lower_bound ( ) -> bool
inlinenodiscardprivate

Try to find a sample point using lower bounds and evaluate a function value for the sample point.

Returns
Whether evaluation was performed.

Definition at line 274 of file gaussian_process_optimizer.h.

Member Data Documentation

◆ default_max_evaluations

template<concepts::objective_function ObjectiveFunction>
index_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::default_max_evaluations = 20
staticconstexprprivate

Default value of the maximum number of function evaluations.

Definition at line 343 of file gaussian_process_optimizer.h.

◆ default_max_lower_bound_evaluations

template<concepts::objective_function ObjectiveFunction>
index_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::default_max_lower_bound_evaluations = 100
staticconstexprprivate

Default value of the maximum number of evaluations of lower bounds.

Definition at line 349 of file gaussian_process_optimizer.h.

◆ dim_

template<concepts::objective_function ObjectiveFunction>
index_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::dim_ {0}
private

Number of dimension.

Definition at line 328 of file gaussian_process_optimizer.h.

◆ evaluations_

template<concepts::objective_function ObjectiveFunction>
index_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::evaluations_ {0}
private

Number of function evaluations.

Definition at line 340 of file gaussian_process_optimizer.h.

◆ interpolator_

template<concepts::objective_function ObjectiveFunction>
interpolator_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::interpolator_ {}
private

Interpolator.

Definition at line 313 of file gaussian_process_optimizer.h.

◆ iterations_

template<concepts::objective_function ObjectiveFunction>
index_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::iterations_ {0}
private

Number of iterations.

Definition at line 337 of file gaussian_process_optimizer.h.

◆ lower_

template<concepts::objective_function ObjectiveFunction>
variable_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::lower_ {}
private

Element-wise lower limit.

Definition at line 322 of file gaussian_process_optimizer.h.

◆ lower_bound_optimizer_

template<concepts::objective_function ObjectiveFunction>
dividing_rectangles<any_objective_function<value_type(variable_type)> > num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::lower_bound_optimizer_ {}
private

Optimizer of lower bounds.

Definition at line 307 of file gaussian_process_optimizer.h.

◆ max_evaluations_

template<concepts::objective_function ObjectiveFunction>
index_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::max_evaluations_ {default_max_evaluations}
private

Maximum number of function evaluations.

Definition at line 346 of file gaussian_process_optimizer.h.

◆ obj_fun_

template<concepts::objective_function ObjectiveFunction>
objective_function_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::obj_fun_
private

Objective function.

Definition at line 310 of file gaussian_process_optimizer.h.

◆ opt_value_

template<concepts::objective_function ObjectiveFunction>
value_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::opt_value_ {}
private

Current optimal value.

Definition at line 334 of file gaussian_process_optimizer.h.

◆ opt_variable_

template<concepts::objective_function ObjectiveFunction>
variable_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::opt_variable_ {}
private

Current optimal variable.

Definition at line 331 of file gaussian_process_optimizer.h.

◆ upper_

template<concepts::objective_function ObjectiveFunction>
variable_type num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::upper_ {}
private

Element-wise upper limit.

Definition at line 325 of file gaussian_process_optimizer.h.

◆ values_

template<concepts::objective_function ObjectiveFunction>
Eigen::VectorX<value_type> num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::values_ {}
private

Function values of sample points.

Definition at line 319 of file gaussian_process_optimizer.h.

◆ variables_

template<concepts::objective_function ObjectiveFunction>
std::vector<variable_type> num_collect::opt::gaussian_process_optimizer< ObjectiveFunction >::variables_ {}
private

Variables of sample points.

Definition at line 316 of file gaussian_process_optimizer.h.


The documentation for this class was generated from the following file: