17#include <Eigen/Cholesky>
18#include <Eigen/Eigenvalues>
19#include <Eigen/src/Cholesky/LDLT.h>
47template <Config Conf = DefaultConfig>
73 throw std::invalid_argument(
"Convex Newton direction does not "
74 "support general constraints");
76 throw std::invalid_argument(
"Convex Newton direction requires "
77 "eval_inactive_indices_res_lna");
79 throw std::invalid_argument(
"Structured Newton requires "
92 if (!is_dense(sparsity))
93 std::cerr <<
"Sparse hessians not yet implemented, converting to "
94 "dense matrix (may be very slow)\n";
111 template <
class Solver>
115 if (
ll.info() != Eigen::Success)
116 throw std::runtime_error(
"Cholesky factorization failed. "
117 "Is the problem convex?");
134 auto J =
JK.topRows(nJ);
140 HJ +=
reg * mat::Identity(nJ, nJ);
172 return "ConvexNewtonDirection<" + std::string(config_t::get_name()) +
bool provides_eval_hess_L() const
Returns true if the problem provides an implementation of eval_hess_L.
Sparsity get_hess_ψ_sparsity() const
[Optional] Function that returns (a view of) the sparsity pattern of the Hessian of the augmented Lag...
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...
void eval_hess_L(crvec x, crvec y, real_t scale, rvec H_values) const
[Optional] Function that evaluates the nonzero values of the Hessian of the Lagrangian,
#define USING_ALPAQA_CONFIG(Conf)
#define ALPAQA_IF_QUADF(...)
#define ALPAQA_IF_LONGD(...)
#define ALPAQA_IF_FLOAT(...)
#define ALPAQA_EXPORT_EXTERN_TEMPLATE(...)
real_t hessian_vec_factor
Set this option to a nonzero value to include the Hessian-vector product from equation 12b in ,...
Parameters for the ConvexNewtonDirection class.
Parameters for the ConvexNewtonDirection class.
@ Upper
Symmetric, upper-triangular part is stored.
Converts one matrix storage format to another.
typename Conf::indexvec indexvec
typename Conf::real_t real_t
typename Conf::rindexvec rindexvec
typename Conf::index_t index_t
typename Conf::length_t length_t
typename Conf::crvec crvec
std::string get_name() const
void changed_γ(real_t γₖ, real_t old_γₖ)
ConvexNewtonDirection(const Params ¶ms)
const auto & get_params() const
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ₙₑₓₜ)
AcceleratorParams reg_params
std::optional< sp_conv_t > H_sparsity
ConvexNewtonDirection(const AcceleratorParams ¶ms, const DirectionParams &directionparams={})
void initialize(const Problem &problem, crvec y, crvec Σ, real_t γ_0, crvec x_0, crvec x̂_0, crvec p_0, crvec grad_ψx_0)
ConvexNewtonDirection()=default
bool apply(real_t γₖ, crvec xₖ, crvec x̂ₖ, crvec pₖ, crvec grad_ψxₖ, rvec qₖ) const
bool has_initial_direction() const
AcceleratorParams accelerator
void solve(rmat H, rvec q) const
Double-precision double configuration.
Single-precision float configuration.
long double configuration.
static void compute_complement(std::span< const index_t > in, std::span< index_t > out)