alpaqa 1.0.0a13
Nonconvex constrained optimization
Loading...
Searching...
No Matches
anderson.hpp
Go to the documentation of this file.
1#pragma once
2
6
7namespace alpaqa {
8
9/// Parameters for the @ref AndersonDirection class.
10/// @ingroup grp_Parameters
11template <Config Conf>
13 /// Instead of flushing the buffer when the step size changes, rescale the
14 /// buffer by a factor @f$ \gamma_k / \gamma_{k-1} @f$.
16};
17
18/// @ingroup grp_DirectionProviders
19template <Config Conf>
22
27
29
34
35 AndersonDirection() = default;
37 : anderson(params.accelerator), direction_params(params.direction) {}
47
48 /// @see @ref PANOCDirection::initialize
57
58 /// @see @ref PANOCDirection::has_initial_direction
59 bool has_initial_direction() const { return false; }
60
61 /// @see @ref PANOCDirection::update
69
70 /// @see @ref PANOCDirection::apply
78
79 /// @see @ref PANOCDirection::changed_γ
86
87 /// @see @ref PANOCDirection::reset
88 void reset() { anderson.reset(); }
89
90 /// @see @ref PANOCDirection::get_name
91 std::string get_name() const {
92 return "AndersonDirection<" + std::string(config_t::get_name()) + '>';
93 }
94 auto get_params() const {
95 return std::tie(anderson.get_params(), direction_params);
96 }
97
99};
100
101} // namespace alpaqa
void compute(crvec gₖ, crvec rₖ, rvec xₖ_aa)
Compute the accelerated iterate , given the function value at the current iterate and the correspond...
Definition anderson.hpp:79
const Params & get_params() const
Get the parameters.
Definition anderson.hpp:116
void initialize(crvec g_0, crvec r_0)
Call this function on the first iteration to initialize the accelerator.
Definition anderson.hpp:67
void resize(length_t n)
Change the problem dimension.
Definition anderson.hpp:57
void reset()
Reset the accelerator (but keep the last function value and residual, so calling initialize is not ne...
Definition anderson.hpp:101
AndersonAccelParams< config_t > Params
Definition anderson.hpp:42
void scale_R(real_t scal)
Scale the factorization.
Definition anderson.hpp:123
length_t get_n() const
[Required] Number of decision variables.
#define USING_ALPAQA_CONFIG(Conf)
Definition config.hpp:56
bool rescale_on_step_size_changes
Instead of flushing the buffer when the step size changes, rescale the buffer by a factor .
Definition anderson.hpp:15
Parameters for the AndersonDirection class.
Definition anderson.hpp:12
typename Conf::real_t real_t
Definition config.hpp:65
constexpr const auto inf
Definition config.hpp:85
typename Conf::rvec rvec
Definition config.hpp:69
typename Conf::crvec crvec
Definition config.hpp:70
AndersonDirection(AndersonAccel &&anderson, const DirectionParams &directionparams={})
Definition anderson.hpp:44
std::string get_name() const
Definition anderson.hpp:91
void changed_γ(real_t γₖ, real_t old_γₖ)
Definition anderson.hpp:80
AndersonDirection(const typename AndersonAccel::Params &params, const DirectionParams &directionparams={})
Definition anderson.hpp:38
DirectionParams direction_params
Definition anderson.hpp:98
bool update(real_t γₖ, real_t γₙₑₓₜ, crvec xₖ, crvec xₙₑₓₜ, crvec pₖ, crvec pₙₑₓₜ, crvec grad_ψxₖ, crvec grad_ψxₙₑₓₜ)
Definition anderson.hpp:62
typename AndersonAccel::Params AcceleratorParams
Definition anderson.hpp:25
AndersonDirection(const Params &params)
Definition anderson.hpp:36
AndersonDirection(const AndersonAccel &anderson, const DirectionParams &directionparams={})
Definition anderson.hpp:41
void initialize(const Problem &problem, crvec y, crvec Σ, real_t γ_0, crvec x_0, crvec x̂_0, crvec p_0, crvec grad_ψx_0)
Definition anderson.hpp:49
bool apply(real_t γₖ, crvec xₖ, crvec x̂ₖ, crvec pₖ, crvec grad_ψxₖ, rvec qₖ) const
Definition anderson.hpp:71
bool has_initial_direction() const
Definition anderson.hpp:59