numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class of golden section search method. More...
#include <num_collect/opt/golden_section_search.h>
Public Types | |
using | objective_function_type = ObjectiveFunction |
Type of the objective function. | |
using | this_type = golden_section_search<ObjectiveFunction> |
This type. | |
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 | |
golden_section_search (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 (variable_type end1, variable_type end2) |
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 | opt_value () const -> const value_type & |
Get current optimal value. | |
auto | opt_variable () const -> const variable_type & |
Get current optimal variable. | |
auto | section_len () const -> variable_type |
Get length of section between end points. | |
auto | tol_section_len (variable_type value) -> golden_section_search & |
Set the tolerance of length of section between end points. | |
Public Member Functions inherited from num_collect::opt::optimizer_base< golden_section_search< 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< golden_section_search< ObjectiveFunction > > | |
iterative_solver_base (logging::log_tag_view tag) | |
Constructor. | |
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. | |
auto | is_stop_criteria_satisfied () const -> bool |
Determine if stopping criteria of the algorithm are satisfied. | |
void | iterate () |
Iterate the algorithm once. | |
void | iterate () |
Iterate the algorithm once. | |
void | solve () |
Solve the problem. | |
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< golden_section_search< ObjectiveFunction > > | |
iteration_logger_mixin ()=default | |
Constructor. | |
void | configure_iteration_logger (num_collect::logging::iterations::iteration_logger< golden_section_search< ObjectiveFunction > > &iteration_logger) const |
Configure an iteration logger. | |
auto | initialize_iteration_logger () -> num_collect::logging::iterations::iteration_logger< golden_section_search< ObjectiveFunction > > & |
Get the iteration logger. | |
Static Public Attributes | |
static const auto | default_tol_section_len |
Default tolerance of length of section between end points. | |
static const auto | mid_point_ratio |
Ratio of middle point. | |
Private Attributes | |
variable_type | end1_ {} |
An end point. | |
variable_type | end2_ {} |
Another end point. | |
index_type | iterations_ {0} |
Number of iterations. | |
variable_type | mid1_ {} |
Middle point near to end1_. | |
objective_function_type | obj_fun_ |
Objective function. | |
variable_type | tol_section_len_ {default_tol_section_len} |
Tolerance of length of section between end points. | |
value_type | value1_ {} |
Function value on end1_. | |
Additional Inherited Members | |
Protected Member Functions inherited from num_collect::base::iterative_solver_base< golden_section_search< ObjectiveFunction > > | |
auto | derived () const noexcept -> const golden_section_search< ObjectiveFunction > & |
Access derived object. | |
auto | derived () const noexcept -> const golden_section_search< ObjectiveFunction > & |
Access derived object. | |
auto | derived () noexcept -> golden_section_search< ObjectiveFunction > & |
Access derived object. | |
auto | derived () noexcept -> golden_section_search< ObjectiveFunction > & |
Access derived object. | |
Class of golden section search method.
ObjectiveFunction | Type of the objective function. |
Definition at line 42 of file golden_section_search.h.
using num_collect::opt::golden_section_search< ObjectiveFunction >::objective_function_type = ObjectiveFunction |
Type of the objective function.
Definition at line 49 of file golden_section_search.h.
using num_collect::opt::golden_section_search< ObjectiveFunction >::this_type = golden_section_search<ObjectiveFunction> |
This type.
Definition at line 46 of file golden_section_search.h.
using num_collect::opt::golden_section_search< ObjectiveFunction >::value_type = typename objective_function_type::value_type |
Type of function values.
Definition at line 55 of file golden_section_search.h.
using num_collect::opt::golden_section_search< ObjectiveFunction >::variable_type = typename objective_function_type::variable_type |
Type of variables.
Definition at line 52 of file golden_section_search.h.
|
inlineexplicit |
Constructor.
[in] | obj_fun | Objective function. |
Definition at line 62 of file golden_section_search.h.
|
inline |
Change the objective function.
[in] | obj_fun | Objective function. |
Definition at line 73 of file golden_section_search.h.
|
inline |
Configure an iteration logger.
[in] | iteration_logger | Iteration logger. |
Definition at line 135 of file golden_section_search.h.
|
inlinenodiscardnoexcept |
Get the number of function evaluations.
Definition at line 170 of file golden_section_search.h.
|
inline |
Initialize the algorithm.
[in] | end1 | An end point. |
[in] | end2 | Another end point. |
Definition at line 83 of file golden_section_search.h.
|
inlinenodiscard |
Determine if stopping criteria of the algorithm are satisfied.
Definition at line 128 of file golden_section_search.h.
|
inline |
Iterate the algorithm once.
init
functions) are assumed to have been done. Definition at line 108 of file golden_section_search.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 163 of file golden_section_search.h.
|
inlinenodiscard |
Get current optimal value.
Definition at line 156 of file golden_section_search.h.
|
inlinenodiscard |
Get current optimal variable.
Definition at line 149 of file golden_section_search.h.
|
inlinenodiscard |
Get length of section between end points.
Definition at line 179 of file golden_section_search.h.
|
inline |
Set the tolerance of length of section between end points.
[in] | value | Tolerance of length of section between end points. |
Definition at line 100 of file golden_section_search.h.
|
inlinestatic |
Default tolerance of length of section between end points.
Definition at line 189 of file golden_section_search.h.
|
private |
An end point.
Definition at line 197 of file golden_section_search.h.
|
private |
Another end point.
Definition at line 200 of file golden_section_search.h.
|
private |
Number of iterations.
Definition at line 209 of file golden_section_search.h.
|
private |
Middle point near to end1_.
Definition at line 203 of file golden_section_search.h.
|
inlinestatic |
|
private |
Objective function.
Definition at line 194 of file golden_section_search.h.
|
private |
Tolerance of length of section between end points.
Definition at line 212 of file golden_section_search.h.
|
private |
Function value on end1_.
Definition at line 206 of file golden_section_search.h.