31 std::sqrt(std::numeric_limits<real_t>::epsilon());
64 throw std::invalid_argument(
"NewtonTR without finite differences "
65 "requires Problem::eval_hess_ψ_prod()");
67 throw std::invalid_argument(
69 "Problem::eval_inactive_indices_res_lna()");
106 if (!std::isfinite(radius))
107 throw std::logic_error(
"Invalid trust radius");
108 if (radius < std::numeric_limits<real_t>::epsilon())
109 throw std::logic_error(
"Trust radius too small");
178 return "NewtonTRDirection<" + std::string(config_t::get_name()) +
'>';
189 std::optional<crvec>
y = std::nullopt;
190 std::optional<crvec>
Σ = std::nullopt;
192 std::optional<vec>
y = std::nullopt;
193 std::optional<vec>
Σ = std::nullopt;
bool provides_eval_hess_ψ_prod() const
Returns true if the problem provides an implementation of eval_hess_ψ_prod.
length_t get_n() const
[Required] Number of decision variables.
length_t get_m() const
[Required] Number of constraints.
bool provides_eval_inactive_indices_res_lna() const
Returns true if the problem provides an implementation of eval_inactive_indices_res_lna.
index_t eval_inactive_indices_res_lna(real_t γ, crvec x, crvec grad_ψ, rindexvec J) const
[Optional] Function that computes the inactive indices for the evaluation of the linear Newton appro...
bool provides_eval_hess_L_prod() const
Returns true if the problem provides an implementation of eval_hess_L_prod.
void eval_grad_ψ(crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const
[Optional] Calculate the gradient ∇ψ(x).
void eval_hess_ψ_prod(crvec x, crvec y, crvec Σ, real_t scale, crvec v, rvec Hv) const
[Optional] Function that evaluates the Hessian of the augmented Lagrangian multiplied by a vector,
#define USING_ALPAQA_CONFIG(Conf)
real_t hessian_vec_factor
The factor in front of the term in equation (9) in .
bool finite_diff
Use finite differences to compute Hessian-vector products.
real_t finite_diff_stepsize
Size of the perturbation for the finite differences computation.
Parameters for the NewtonTRDirection class.
Parameters for SteihaugCG.
typename Conf::indexvec indexvec
typename Conf::real_t real_t
typename Conf::rindexvec rindexvec
typename Conf::index_t index_t
typename Conf::crvec crvec
typename Conf::crindexvec crindexvec
std::string get_name() const
void changed_γ(real_t γₖ, real_t old_γₖ)
SteihaugCG< config_t > steihaug
real_t apply(real_t γₖ, crvec xₖ, crvec x̂ₖ, crvec pₖ, crvec grad_ψxₖ, real_t radius, rvec qₖ) const
NewtonTRDirection(const Params ¶ms)
NewtonTRDirection(const AcceleratorParams ¶ms, const DirectionParams &directionparams={})
DirectionParams direction_params
DirectionParams direction
bool update(real_t γₖ, real_t γₙₑₓₜ, crvec xₖ, crvec xₙₑₓₜ, crvec pₖ, crvec pₙₑₓₜ, crvec grad_ψxₖ, crvec grad_ψxₙₑₓₜ)
NewtonTRDirection()=default
void initialize(const Problem &problem, crvec y, crvec Σ, real_t γ_0, crvec x_0, crvec x̂_0, crvec p_0, crvec grad_ψx_0)
bool has_initial_direction() const
AcceleratorParams accelerator
Steihaug conjugate gradients procedure based on https://github.com/scipy/scipy/blob/583e70a50573169fc...
real_t solve(const auto &grad, const HessFun &hess_prod, real_t trust_radius, rvec step) const
static void compute_complement(std::span< const index_t > in, std::span< index_t > out)