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 , non_dividable } |
Enumeration of states in ADC method. More... | |
using | this_type = adaptive_diagonal_curves<ObjectiveFunction, MaxDigits> |
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. | |
![]() | |
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. | |
![]() | |
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. | |
![]() | |
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. | |
![]() | |
iteration_logger_mixin ()=default | |
Constructor. | |
void | configure_iteration_logger (num_collect::logging::iterations::iteration_logger< adaptive_diagonal_curves< ObjectiveFunction, 8 > > &iteration_logger) const |
Configure an iteration logger. | |
auto | initialize_iteration_logger () -> num_collect::logging::iterations::iteration_logger< adaptive_diagonal_curves< ObjectiveFunction, 8 > > & |
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, MaxDigits> |
Type of dictionaries of sample points. | |
using | group_type = impl::adc_group<value_type, ternary_vector_type> |
Type of groups of hyper-rectangles. | |
using | rectangle_type = typename group_type::rectangle_type |
Type of hyper-rectangles. | |
using | ternary_vector_type = typename dict_type::ternary_vector_type |
Type of ternary vectors. | |
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 ternary_vector_type &vertex, std::size_t group_ind) -> 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. | |
auto | divide_rectangle (std::size_t group_ind) -> bool |
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 | |
![]() | |
auto | derived () const noexcept -> const adaptive_diagonal_curves< ObjectiveFunction, 8 > & |
Access derived object. | |
auto | derived () const noexcept -> const adaptive_diagonal_curves< ObjectiveFunction, 8 > & |
Access derived object. | |
auto | derived () noexcept -> adaptive_diagonal_curves< ObjectiveFunction, 8 > & |
Access derived object. | |
auto | derived () noexcept -> adaptive_diagonal_curves< ObjectiveFunction, 8 > & |
Access derived object. | |
Class of adaptive diagonal curves (ADC) method [27] for optimization.
ObjectiveFunction | Type of the objective function. |
MaxDigits | Maximum number of ternary digits per dimension at compile time. |
Definition at line 61 of file adaptive_diagonal_curves.h.
|
private |
Type of dictionaries of sample points.
Definition at line 306 of file adaptive_diagonal_curves.h.
|
private |
Type of groups of hyper-rectangles.
Definition at line 312 of file adaptive_diagonal_curves.h.
using num_collect::opt::adaptive_diagonal_curves< ObjectiveFunction, MaxDigits >::objective_function_type = ObjectiveFunction |
Type of the objective function.
Definition at line 69 of file adaptive_diagonal_curves.h.
|
private |
Type of hyper-rectangles.
Definition at line 315 of file adaptive_diagonal_curves.h.
|
private |
Type of ternary vectors.
Definition at line 309 of file adaptive_diagonal_curves.h.
using num_collect::opt::adaptive_diagonal_curves< ObjectiveFunction, MaxDigits >::this_type = adaptive_diagonal_curves<ObjectiveFunction, MaxDigits> |
This class.
Definition at line 66 of file adaptive_diagonal_curves.h.
using num_collect::opt::adaptive_diagonal_curves< ObjectiveFunction, MaxDigits >::value_type = typename objective_function_type::value_type |
Type of function values.
Definition at line 75 of file adaptive_diagonal_curves.h.
using num_collect::opt::adaptive_diagonal_curves< ObjectiveFunction, MaxDigits >::variable_type = typename objective_function_type::variable_type |
Type of variables.
Definition at line 72 of file adaptive_diagonal_curves.h.
|
strong |
Enumeration of states in ADC method.
Definition at line 80 of file adaptive_diagonal_curves.h.
|
inlineexplicit |
Constructor.
[in] | obj_fun | Objective function. |
Definition at line 119 of file adaptive_diagonal_curves.h.
|
inlinenodiscardprivate |
Calculate slope.
[in] | group_ind1 | Index of group. |
[in] | group_ind2 | Index of group. |
Definition at line 569 of file adaptive_diagonal_curves.h.
|
inline |
Change the objective function.
[in] | obj_fun | Objective function. |
Definition at line 129 of file adaptive_diagonal_curves.h.
|
inline |
Configure an iteration logger.
[in] | iteration_logger | Iteration logger. |
Definition at line 195 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Create the first hyper-rectangle.
Definition at line 320 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 615 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 295 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 517 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 491 of file adaptive_diagonal_curves.h.
|
inlinenodiscardprivate |
Divide a hyper-rectangle.
[in] | group_ind | Index of group. |
true | The hyper-rectangle is divided. |
false | The hyper-rectangle is not divided. |
Definition at line 583 of file adaptive_diagonal_curves.h.
|
inlinenodiscardnoexcept |
Get the number of function evaluations.
Definition at line 235 of file adaptive_diagonal_curves.h.
|
inline |
Initialize the algorithm.
[in] | lower | Lower limit. |
[in] | upper | Upper limit. |
Definition at line 139 of file adaptive_diagonal_curves.h.
|
inlinenodiscard |
Determine if stopping criteria of the algorithm are satisfied.
Definition at line 187 of file adaptive_diagonal_curves.h.
|
inline |
Iterate the algorithm once.
init
functions) are assumed to have been done. Definition at line 157 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Iterate once in the global phase (not last iteration).
Definition at line 455 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Iterate once at teh last of the global phase.
Definition at line 468 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Iterate once in the local phase (not last iteration).
Definition at line 434 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Iterate once at the last of the local phase.
Definition at line 445 of file adaptive_diagonal_curves.h.
|
inlinenodiscardnoexcept |
Get the number of iterations.
Definition at line 228 of file adaptive_diagonal_curves.h.
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
Get the name of the last state.
Definition at line 253 of file adaptive_diagonal_curves.h.
|
inline |
Set the maximum number of function evaluations.
[in] | value | Value. |
Definition at line 263 of file adaptive_diagonal_curves.h.
|
inlinenodiscardprivate |
Get the minimum index of non-empty groups.
Definition at line 475 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 279 of file adaptive_diagonal_curves.h.
|
inlinenodiscard |
Get current optimal value.
Definition at line 221 of file adaptive_diagonal_curves.h.
|
inlinenodiscard |
Get current optimal variable.
Definition at line 214 of file adaptive_diagonal_curves.h.
|
inlinestaticnodiscard |
Convert a state to string.
[in] | state | State. |
Definition at line 95 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 346 of file adaptive_diagonal_curves.h.
|
inlineprivate |
Switch to the next state if necessary in local_last state.
Definition at line 402 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 710 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 703 of file adaptive_diagonal_curves.h.
|
staticconstexprprivate |
Default maximum number of function evaluations.
Definition at line 681 of file adaptive_diagonal_curves.h.
|
inlinestaticprivate |
Default minimum rate of improvement in the function value required for potentially optimal rectangles.
Definition at line 690 of file adaptive_diagonal_curves.h.
|
private |
Groups of hyper-rectangles.
Definition at line 646 of file adaptive_diagonal_curves.h.
|
inlinestaticprivate |
Half.
Definition at line 640 of file adaptive_diagonal_curves.h.
|
private |
Number of iterations.
Definition at line 649 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 678 of file adaptive_diagonal_curves.h.
|
private |
Maximum number of function evaluations.
Definition at line 684 of file adaptive_diagonal_curves.h.
|
private |
Minimum rate of improvement in the function value required for potentially optimal rectangles.
Definition at line 697 of file adaptive_diagonal_curves.h.
|
private |
Index of the group in which the optimal solution exists.
Definition at line 662 of file adaptive_diagonal_curves.h.
|
private |
Current optimal value.
This value is used for updating optimal_group_index_.
Definition at line 659 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 671 of file adaptive_diagonal_curves.h.
|
private |
Old optimal value at the start of the current phase.
Definition at line 665 of file adaptive_diagonal_curves.h.
|
private |
State.
Definition at line 652 of file adaptive_diagonal_curves.h.
|
private |
Dictionary of sampled points.
Definition at line 643 of file adaptive_diagonal_curves.h.