numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class of dividing rectangles (DIRECT) method [12] for optimization. More...
#include <num_collect/opt/dividing_rectangles.h>
Classes | |
struct | greater_rectangle |
Class to compare rectangles. More... | |
class | rectangle |
Class of hyper rectangle in DIRECT method. More... | |
Public Types | |
using | objective_function_type = ObjectiveFunction |
Type of the objective function. | |
using | this_type = dividing_rectangles<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 | |
dividing_rectangles (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) -> dividing_rectangles & |
Set the maximum number of function evaluations. | |
auto | min_rate_imp (value_type value) -> dividing_rectangles & |
Set the minimum rate of improvement in the function value required for potentially optimal rectangles. | |
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< dividing_rectangles< 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< dividing_rectangles< 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< dividing_rectangles< ObjectiveFunction > > | |
iteration_logger_mixin ()=default | |
Constructor. | |
void | configure_iteration_logger (num_collect::logging::iterations::iteration_logger< dividing_rectangles< ObjectiveFunction > > &iteration_logger) const |
Configure an iteration logger. | |
auto | initialize_iteration_logger () -> num_collect::logging::iterations::iteration_logger< dividing_rectangles< ObjectiveFunction > > & |
Get the iteration logger. | |
Private Member Functions | |
auto | determine_divided_dimension (const rectangle &rect) -> std::tuple< index_type, value_type, value_type > |
Determine the divided dimension of a rectangle. | |
auto | determine_rects () const -> std::vector< std::pair< std::size_t, value_type > > |
Search rectangles to divide. | |
void | divide_rect (std::size_t index) |
Divide a rectangle. | |
auto | evaluate_on (const variable_type &variable) -> value_type |
Evaluate function value. | |
Static Private Member Functions | |
static auto | calculate_slope (const rectangle &larger_rect, const rectangle &smaller_rect) -> value_type |
Calculate slope. | |
static auto | correct_value_if_needed (value_type value) noexcept -> value_type |
Correct function values if needed. | |
static auto | separate_section (value_type lowest, value_type highest) -> std::pair< value_type, value_type > |
Separate a section. | |
Private Attributes | |
index_type | dim_ {0} |
Number of dimension. | |
index_type | evaluations_ {0} |
Number of function evaluations. | |
index_type | iterations_ {0} |
Number of iterations. | |
variable_type | lower_ {} |
Element-wise lower limit. | |
index_type | max_evaluations_ {default_max_evaluations} |
Maximum number of function evaluations. | |
value_type | min_rate_imp_ {default_min_rate_imp} |
Minimum rate of improvement in the function value required for potentially optimal rectangles. | |
objective_function_type | obj_fun_ |
Objective function. | |
value_type | opt_value_ {} |
Current optimal value. | |
variable_type | opt_variable_ {} |
Current optimal variable. | |
std::vector< std::priority_queue< std::shared_ptr< rectangle >, std::vector< std::shared_ptr< rectangle > >, greater_rectangle > > | rects_ {} |
Rectangles. | |
variable_type | upper_ {} |
Element-wise upper limit. | |
variable_type | width_ {} |
Element-wise width. | |
Static Private Attributes | |
static constexpr index_type | default_max_evaluations = 10000 |
Default maximum number of function evaluations. | |
static const auto | default_min_rate_imp |
Default minimum rate of improvement in the function value required for potentially optimal rectangles. | |
Additional Inherited Members | |
Protected Member Functions inherited from num_collect::base::iterative_solver_base< dividing_rectangles< ObjectiveFunction > > | |
auto | derived () const noexcept -> const dividing_rectangles< ObjectiveFunction > & |
Access derived object. | |
auto | derived () const noexcept -> const dividing_rectangles< ObjectiveFunction > & |
Access derived object. | |
auto | derived () noexcept -> dividing_rectangles< ObjectiveFunction > & |
Access derived object. | |
auto | derived () noexcept -> dividing_rectangles< ObjectiveFunction > & |
Access derived object. | |
Class of dividing rectangles (DIRECT) method [12] for optimization.
ObjectiveFunction | Type of the objective function. |
Definition at line 61 of file dividing_rectangles.h.
using num_collect::opt::dividing_rectangles< ObjectiveFunction >::objective_function_type = ObjectiveFunction |
Type of the objective function.
Definition at line 68 of file dividing_rectangles.h.
using num_collect::opt::dividing_rectangles< ObjectiveFunction >::this_type = dividing_rectangles<ObjectiveFunction> |
This class.
Definition at line 65 of file dividing_rectangles.h.
using num_collect::opt::dividing_rectangles< ObjectiveFunction >::value_type = typename objective_function_type::value_type |
Type of function values.
Definition at line 74 of file dividing_rectangles.h.
using num_collect::opt::dividing_rectangles< ObjectiveFunction >::variable_type = typename objective_function_type::variable_type |
Type of variables.
Definition at line 71 of file dividing_rectangles.h.
|
inlineexplicit |
Constructor.
[in] | obj_fun | Objective function. |
Definition at line 81 of file dividing_rectangles.h.
|
inlinestaticnodiscardprivate |
Calculate slope.
[in] | larger_rect | Larger rectangle. |
[in] | smaller_rect | Smaller rectangle. |
Definition at line 456 of file dividing_rectangles.h.
|
inline |
Change the objective function.
[in] | obj_fun | Objective function. |
Definition at line 92 of file dividing_rectangles.h.
|
inline |
Configure an iteration logger.
[in] | iteration_logger | Iteration logger. |
Definition at line 157 of file dividing_rectangles.h.
|
inlinestaticnodiscardprivatenoexcept |
Correct function values if needed.
[in] | value | Function value. |
Definition at line 583 of file dividing_rectangles.h.
|
inlinenodiscardprivate |
Determine the divided dimension of a rectangle.
[in] | rect | Rectangle. |
Definition at line 504 of file dividing_rectangles.h.
|
inlinenodiscardprivate |
Search rectangles to divide.
Definition at line 405 of file dividing_rectangles.h.
|
inlineprivate |
Divide a rectangle.
[in] | index | Index in rects_. |
Definition at line 467 of file dividing_rectangles.h.
|
inlinenodiscardprivate |
Evaluate function value.
[in] | variable | Variable in unit hyper-cube. |
Definition at line 382 of file dividing_rectangles.h.
|
inlinenodiscardnoexcept |
Get the number of function evaluations.
Definition at line 192 of file dividing_rectangles.h.
|
inline |
Initialize the algorithm.
[in] | lower | Lower limit. |
[in] | upper | Upper limit. |
Definition at line 102 of file dividing_rectangles.h.
|
inlinenodiscard |
Determine if stopping criteria of the algorithm are satisfied.
Definition at line 150 of file dividing_rectangles.h.
|
inline |
Iterate the algorithm once.
init
functions) are assumed to have been done. Definition at line 138 of file dividing_rectangles.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 185 of file dividing_rectangles.h.
|
inline |
Set the maximum number of function evaluations.
[in] | value | Value. |
Definition at line 202 of file dividing_rectangles.h.
|
inline |
Set the minimum rate of improvement in the function value required for potentially optimal rectangles.
[in] | value | Value. |
Definition at line 217 of file dividing_rectangles.h.
|
inlinenodiscard |
Get current optimal value.
Definition at line 178 of file dividing_rectangles.h.
|
inlinenodiscard |
Get current optimal variable.
Definition at line 171 of file dividing_rectangles.h.
|
inlinestaticnodiscardprivate |
Separate a section.
[in] | lowest | Lower limit of the section. |
[in] | highest | Upper limit of the section. |
Definition at line 569 of file dividing_rectangles.h.
|
staticconstexprprivate |
Default maximum number of function evaluations.
Definition at line 630 of file dividing_rectangles.h.
|
inlinestaticprivate |
Default minimum rate of improvement in the function value required for potentially optimal rectangles.
Definition at line 639 of file dividing_rectangles.h.
|
private |
Number of dimension.
Definition at line 615 of file dividing_rectangles.h.
|
private |
Number of function evaluations.
Definition at line 627 of file dividing_rectangles.h.
|
private |
Number of iterations.
Definition at line 624 of file dividing_rectangles.h.
|
private |
Element-wise lower limit.
Definition at line 606 of file dividing_rectangles.h.
|
private |
Maximum number of function evaluations.
Definition at line 633 of file dividing_rectangles.h.
|
private |
Minimum rate of improvement in the function value required for potentially optimal rectangles.
Definition at line 646 of file dividing_rectangles.h.
|
private |
Objective function.
Definition at line 594 of file dividing_rectangles.h.
|
private |
Current optimal value.
Definition at line 621 of file dividing_rectangles.h.
|
private |
Current optimal variable.
Definition at line 618 of file dividing_rectangles.h.
|
private |
|
private |
Element-wise upper limit.
Definition at line 609 of file dividing_rectangles.h.
|
private |
Element-wise width.
Definition at line 612 of file dividing_rectangles.h.