38template <concepts::differentiable_
objective_function ObjectiveFunction>
57 using value_type =
typename objective_function_type::value_type;
59 static_assert(std::is_same_v<typename variable_type::Scalar, value_type>,
60 "This class assumes that scalars in Eigen::Matrix class is same as "
182 "Coefficient in Armijo rule must be in the range (0, 1).");
196 "Ratio to scale step sizes must be in the range (0, 1).");
Class of exception on failure in algorithm.
auto armijo_coeff(value_type value) -> backtracking_line_searcher &
Set the coefficient in Armijo rule.
auto obj_fun() const -> const objective_function_type &
Access objective function.
auto gradient() const -> const variable_type &
Get gradient for current optimal variable.
variable_type variable_
Current variable.
value_type step_
Step size.
typename objective_function_type::variable_type variable_type
Type of variables.
value_type step_scale_
Ratio to scale step sizes.
value_type armijo_coeff_
Coefficient in Armijo rule.
auto step_scale(value_type value) -> backtracking_line_searcher &
Set the ratio to scale step sizes.
auto obj_fun() -> objective_function_type &
Access objective function.
static const auto init_step
Initial step size.
void search(const variable_type &direction)
Search step size.
index_type evaluations_
Number of function evaluations.
auto opt_value() const -> const value_type &
Get current optimal value.
auto evaluations() const -> index_type
Get the number of function evaluations.
backtracking_line_searcher(const objective_function_type &obj_fun=objective_function_type())
Constructor.
static const auto default_armijo_coeff
Default coefficient in Armijo rule.
objective_function_type obj_fun_
Objective function.
typename objective_function_type::value_type value_type
Type of function values.
void init(const variable_type &init_variable)
Initialize.
auto last_step() const -> value_type
Get last step size.
static const auto default_step_scale
Default ratio to scale step sizes.
auto opt_variable() const -> const variable_type &
Get current optimal variable.
ObjectiveFunction objective_function_type
Type of the objective function.
Class to perform backtracking line search.
Concept of multi-variate first-order differentiable objective functions in optimization.
Definition of differentiable_objective_function concept.
Definition of exceptions.
Definition of index_type type.
Definition of macros for logging.
#define NUM_COLLECT_LOG_AND_THROW(EXCEPTION_TYPE,...)
Write an error log and throw an exception for an error.
Definition of multi_variate_differentiable_objective_function concept.
std::ptrdiff_t index_type
Type of indices in this library.
Namespace of optimization algorithms.
Definition of NUM_COLLECT_PRECONDITION macro.
#define NUM_COLLECT_PRECONDITION(CONDITION,...)
Check whether a precondition is satisfied and throw an exception if not.