numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
|
Class of adaptive diagonal curves (ADC) method [27] for optimization. More...
#include <num_collect/opt/adaptive_diagonal_curves.h>
Public Types | |
using | objective_function_type = ObjectiveFunction |
Type of the objective function. | |
enum class | state_type : std::uint8_t { none , local , local_last , global , global_last } |
Enumeration of states in ADC method. More... | |
using | this_type = adaptive_diagonal_curves<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 | |
adaptive_diagonal_curves (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 | decrease_rate_bound (value_type value) -> adaptive_diagonal_curves & |
Set the rate of function value used to check whether the function value decreased in the current phase. | |
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 | last_state () const noexcept -> state_type |
Get the last state. | |
auto | last_state_name () const noexcept -> std::string_view |
Get the name of the last state. | |
auto | max_evaluations (index_type value) -> adaptive_diagonal_curves & |
Set the maximum number of function evaluations. | |
auto | min_rate_imp (value_type value) -> adaptive_diagonal_curves & |
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< adaptive_diagonal_curves< 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< adaptive_diagonal_curves< 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< adaptive_diagonal_curves< ObjectiveFunction > > | |
iteration_logger_mixin ()=default | |
Constructor. | |
void | configure_iteration_logger (num_collect::logging::iterations::iteration_logger< adaptive_diagonal_curves< ObjectiveFunction > > &iteration_logger) const |
Configure an iteration logger. | |
auto | initialize_iteration_logger () -> num_collect::logging::iterations::iteration_logger< adaptive_diagonal_curves< ObjectiveFunction > > & |
Get the iteration logger. | |
Static Public Member Functions | |
static auto | state_name (state_type state) -> std::string_view |
Convert a state to string. | |
Private Types | |
using | dict_type = impl::adc_sample_dict<objective_function_type> |
Type of dictionaries of sample points. | |
using | group_type = impl::adc_group<value_type> |
Type of groups of hyper-rectangles. | |
using | rectangle_type = typename group_type::rectangle_type |
Type of hyper-rectangles. | |
Private Member Functions | |
auto | calculate_slope (std::size_t group_ind1, std::size_t group_ind2) const -> value_type |
Calculate slope. | |
void | create_first_rectangle () |
Create the first hyper-rectangle. | |
auto | create_rect (const impl::ternary_vector &vertex, std::size_t group_ind) -> std::shared_ptr< rectangle_type > |
Create a hyper-rectangle. | |
auto | determine_nondominated_rectangles (std::size_t min_group, std::size_t max_group) const -> std::vector< std::pair< std::size_t, value_type > > |
Determine nondominated hyper-rectangles. | |
void | divide_nondominated_rectangles (std::size_t min_group, std::size_t max_group) |
Divide nondominated hyper-rectangles. | |
void | divide_rectangle (std::size_t group_ind) |
Divide a hyper-rectangle. | |
void | iterate_globally () |
Iterate once in the global phase (not last iteration). | |
void | iterate_globally_last () |
Iterate once at teh last of the global phase. | |
void | iterate_locally () |
Iterate once in the local phase (not last iteration). | |
void | iterate_locally_last () |
Iterate once at the last of the local phase. | |
auto | min_nonempty_group_index () const -> std::size_t |
Get the minimum index of non-empty groups. | |
void | switch_state () |
Switch to the next state if necessary. | |
void | switch_state_on_local_last () |
Switch to the next state if necessary in local_last state. | |
Private Attributes | |
value_type | decrease_rate_bound_ {default_decrease_rate_bound} |
Rate of function value used to check whether the function value decreased in the current phase. | |
std::vector< group_type > | groups_ {} |
Groups of hyper-rectangles. | |
index_type | iterations_ {0} |
Number of iterations. | |
index_type | iterations_in_current_phase_ {0} |
Number of iterations in the current phase. | |
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. | |
std::size_t | optimal_group_index_ {0} |
Index of the group in which the optimal solution exists. | |
value_type | optimal_value_ {} |
Current optimal value. | |
std::size_t | prec_optimal_group_index_ {0} |
Index of the group in which the old optimal solution at the start of the current phase exists. | |
value_type | prec_optimal_value_ {} |
Old optimal value at the start of the current phase. | |
state_type | state_ {state_type::none} |
State. | |
dict_type | value_dict_ |
Dictionary of sampled points. | |
Static Private Attributes | |
static const auto | default_decrease_rate_bound |
Default rate of function value used to check whether the function value decreased in the current phase. | |
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. | |
static const auto | half = static_cast<value_type>(0.5) |
Half. | |
Additional Inherited Members | |
Protected Member Functions inherited from num_collect::base::iterative_solver_base< adaptive_diagonal_curves< ObjectiveFunction > > | |
auto | derived () const noexcept -> const adaptive_diagonal_curves< ObjectiveFunction > & |
Access derived object. | |
auto | derived () const noexcept -> const adaptive_diagonal_curves< ObjectiveFunction > & |
Access derived object. | |
auto | derived () noexcept -> adaptive_diagonal_curves< ObjectiveFunction > & |
Access derived object. | |
auto | derived () noexcept -> adaptive_diagonal_curves< ObjectiveFunction > & |
Access derived object. | |
Class of adaptive diagonal curves (ADC) method [27] for optimization.
ObjectiveFunction | Type of the objective function. |
Definition at line 473 of file adaptive_diagonal_curves.h.
|
private |
Type of dictionaries of sample points.
Definition at line 709 of file adaptive_diagonal_curves.h.
|
private |
Type of groups of hyper-rectangles.
Definition at line 712 of file adaptive_diagonal_curves.h.
using num_collect::opt::adaptive_diagonal_curves< ObjectiveFunction >::objective_function_type = ObjectiveFunction |
Type of the objective function.
Definition at line 480 of file adaptive_diagonal_curves.h.
|
private |
Type of hyper-rectangles.
Definition at line 715 of file adaptive_diagonal_curves.h.
using num_collect::opt::adaptive_diagonal_curves< ObjectiveFunction >::this_type = adaptive_diagonal_curves<ObjectiveFunction> |
This class.
Definition at line 477 of file adaptive_diagonal_curves.h.
using num_collect::opt::adaptive_diagonal_curves< ObjectiveFunction >::value_type = typename objective_function_type::value_type |
Type of function values.
Definition at line 486 of file adaptive_diagonal_curves.h.
using num_collect::opt::adaptive_diagonal_curves< ObjectiveFunction >::variable_type = typename objective_function_type::variable_type |
Type of variables.
Definition at line 483 of file adaptive_diagonal_curves.h.
|
strong |
Enumeration of states in ADC method.
Enumerator | |
---|---|
none | No operation. |
local | Local phase (not last iteration). |
local_last | Last iteration in local phase. |
global | Global phase (not last iteration). |
global_last | Last iteration in global phase. |
Definition at line 491 of file adaptive_diagonal_curves.h.
|
inlineexplicit |
Constructor.
[in] | obj_fun | Objective function. |
Definition at line 527 of file adaptive_diagonal_curves.h.
|
inlinenodiscardprivate |
Calculate slope.
[in] | group_ind1 | Index of group. |
[in] | group_ind2 | Index of group. |
Definition at line 957 of file adaptive_diagonal_curves.h.
|
inline |
Change the objective function.
[in] | obj_fun | Objective function. |
Definition at line 538 of file adaptive_diagonal_curves.h.
|
inline |
Configure an iteration logger.
[in] | iteration_logger | Iteration logger. |
Definition at line 598 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Create the first hyper-rectangle.
Definition at line 720 of file adaptive_diagonal_curves.h.
|
inlinenodiscardprivate |
Create a hyper-rectangle.
[in] | vertex | Vertex with lower first component. |
[in] | group_ind | Group index. |
Definition at line 1003 of file adaptive_diagonal_curves.h.
|
inline |
Set the rate of function value used to check whether the function value decreased in the current phase.
[in] | value | Value. |
Definition at line 698 of file adaptive_diagonal_curves.h.
|
inlinenodiscardprivate |
Determine nondominated hyper-rectangles.
[in] | min_group | Minimum index of groups to search in. |
[in] | max_group | Maximum index of groups to search in. |
Definition at line 905 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Divide nondominated hyper-rectangles.
[in] | min_group | Minimum index of groups to search in. |
[in] | max_group | Maximum index of groups to search in. |
Definition at line 888 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Divide a hyper-rectangle.
[in] | group_ind | Index of group. |
Definition at line 969 of file adaptive_diagonal_curves.h.
|
inlinenodiscardnoexcept |
Get the number of function evaluations.
Definition at line 638 of file adaptive_diagonal_curves.h.
|
inline |
Initialize the algorithm.
[in] | lower | Lower limit. |
[in] | upper | Upper limit. |
Definition at line 548 of file adaptive_diagonal_curves.h.
|
inlinenodiscard |
Determine if stopping criteria of the algorithm are satisfied.
Definition at line 591 of file adaptive_diagonal_curves.h.
|
inline |
Iterate the algorithm once.
init
functions) are assumed to have been done. Definition at line 564 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Iterate once in the global phase (not last iteration).
Definition at line 852 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Iterate once at teh last of the global phase.
Definition at line 865 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Iterate once in the local phase (not last iteration).
Definition at line 831 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Iterate once at the last of the local phase.
Definition at line 842 of file adaptive_diagonal_curves.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 631 of file adaptive_diagonal_curves.h.
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
Get the name of the last state.
Definition at line 656 of file adaptive_diagonal_curves.h.
|
inline |
Set the maximum number of function evaluations.
[in] | value | Value. |
Definition at line 666 of file adaptive_diagonal_curves.h.
|
inlinenodiscardprivate |
Get the minimum index of non-empty groups.
Definition at line 872 of file adaptive_diagonal_curves.h.
|
inline |
Set the minimum rate of improvement in the function value required for potentially optimal rectangles.
[in] | value | Value. |
Definition at line 682 of file adaptive_diagonal_curves.h.
|
inlinenodiscard |
Get current optimal value.
Definition at line 624 of file adaptive_diagonal_curves.h.
|
inlinenodiscard |
Get current optimal variable.
Definition at line 617 of file adaptive_diagonal_curves.h.
|
inlinestaticnodiscard |
Convert a state to string.
[in] | state | State. |
Definition at line 505 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Switch to the next state if necessary.
Step 2.1, 2.4, 3, 4.4, 4.5, 4.7 in [27].
Definition at line 746 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Switch to the next state if necessary in local_last state.
Definition at line 799 of file adaptive_diagonal_curves.h.
|
private |
Rate of function value used to check whether the function value decreased in the current phase.
Definition at line 1098 of file adaptive_diagonal_curves.h.
|
inlinestaticprivate |
Default rate of function value used to check whether the function value decreased in the current phase.
Definition at line 1091 of file adaptive_diagonal_curves.h.
|
staticconstexprprivate |
Default maximum number of function evaluations.
Definition at line 1069 of file adaptive_diagonal_curves.h.
|
inlinestaticprivate |
Default minimum rate of improvement in the function value required for potentially optimal rectangles.
Definition at line 1078 of file adaptive_diagonal_curves.h.
|
private |
Groups of hyper-rectangles.
Definition at line 1034 of file adaptive_diagonal_curves.h.
|
inlinestaticprivate |
Half.
Definition at line 1028 of file adaptive_diagonal_curves.h.
|
private |
Number of iterations.
Definition at line 1037 of file adaptive_diagonal_curves.h.
|
private |
Number of iterations in the current phase.
This is initialized at the start of the local or global phases.
Definition at line 1066 of file adaptive_diagonal_curves.h.
|
private |
Maximum number of function evaluations.
Definition at line 1072 of file adaptive_diagonal_curves.h.
|
private |
Minimum rate of improvement in the function value required for potentially optimal rectangles.
Definition at line 1085 of file adaptive_diagonal_curves.h.
|
private |
Index of the group in which the optimal solution exists.
Definition at line 1050 of file adaptive_diagonal_curves.h.
|
private |
Current optimal value.
This value is used for updating optimal_group_index_.
Definition at line 1047 of file adaptive_diagonal_curves.h.
|
private |
Index of the group in which the old optimal solution at the start of the current phase exists.
Definition at line 1059 of file adaptive_diagonal_curves.h.
|
private |
Old optimal value at the start of the current phase.
Definition at line 1053 of file adaptive_diagonal_curves.h.
|
private |
State.
Definition at line 1040 of file adaptive_diagonal_curves.h.
|
private |
Dictionary of sampled points.
Definition at line 1031 of file adaptive_diagonal_curves.h.