11 if constexpr (
requires { Σ(0); })
14 g_ŷ += (1 / Σ(0)) * y;
16 vtable.eval_projecting_difference_constraints(self, g_ŷ, g_ŷ);
18 real_t dᵀŷ = Σ(0) * g_ŷ.dot(g_ŷ);
22 if (Σ.size() != y.size())
23 throw std::logic_error(
"Penalty/multiplier size mismatch");
25 g_ŷ += y.cwiseQuotient(Σ);
27 vtable.eval_projecting_difference_constraints(self, g_ŷ, g_ŷ);
29 real_t dᵀŷ = g_ŷ.dot(Σ.cwiseProduct(g_ŷ));
30 g_ŷ = Σ.cwiseProduct(g_ŷ);
38 throw not_implemented_error(
"eval_inactive_indices_res_lna");
45 throw not_implemented_error(
"eval_constraints_jacobian");
51 return sparsity::Dense{vtable.m, vtable.n};
57 throw not_implemented_error(
"eval_grad_gi");
64 throw not_implemented_error(
"eval_lagrangian_hessian_product");
70 throw not_implemented_error(
"eval_lagrangian_hessian");
76 return sparsity::Dense{vtable.n, vtable.n, sparsity::Symmetry::Upper};
86 throw not_implemented_error(
"eval_augmented_lagrangian_hessian_product");
96 throw not_implemented_error(
"eval_augmented_lagrangian_hessian");
104 return vtable.get_lagrangian_hessian_sparsity(self, vtable);
105 return sparsity::Dense{vtable.n, vtable.n, sparsity::Symmetry::Upper};
109template <Config Conf>
113 vtable.eval_objective_gradient(self, x, grad_fx);
114 return vtable.eval_objective(self, x);
119template <Config Conf>
123 vtable.eval_constraints(self, x, g);
124 return vtable.eval_objective(self, x);
129template <Config Conf>
139template <Config Conf>
153template <Config Conf>
159 return vtable.eval_objective(self, x);
161 auto f = vtable.eval_objective_and_constraints(self, x, ŷ, vtable);
164 auto ψ = f +
real_t(0.5) * dᵀŷ;
170template <Config Conf>
187template <Config Conf>
193 return vtable.eval_objective_and_gradient(self, x, grad_ψ, vtable);
197 auto f = vtable.eval_objective_and_constraints(self, x, ŷ, vtable);
199 auto ψ = f +
real_t(0.5) * dᵀŷ;
201 vtable.eval_lagrangian_gradient(self, x, ŷ, grad_ψ, work_n, vtable);
206template <Config Conf>
209 throw not_implemented_error(
"get_variable_bounds");
212template <Config Conf>
215 throw not_implemented_error(
"get_general_bounds");
218template <Config Conf>
221template <Config Conf>
223 return "unknown problem";
typename Conf::real_t real_t
typename Conf::rindexvec rindexvec
typename Conf::index_t index_t
typename Conf::crvec crvec
static std::string default_get_name(const void *, const ProblemVTable &)
static Sparsity default_get_lagrangian_hessian_sparsity(const void *, const ProblemVTable &)
static Sparsity default_get_constraints_jacobian_sparsity(const void *, const ProblemVTable &)
optional_function_t< void(crvec x, crvec y, real_t scale, rvec H_values) const > eval_lagrangian_hessian
ProblemVTable(std::in_place_t, P &p)
static void default_eval_objective_gradient_and_constraints_gradient_product(const void *self, crvec x, crvec y, rvec grad_f, rvec grad_gxy, const ProblemVTable &vtable)
static real_t default_eval_augmented_lagrangian(const void *self, crvec x, crvec y, crvec Σ, rvec ŷ, const ProblemVTable &vtable)
static void default_eval_lagrangian_hessian(const void *, crvec, crvec, real_t, rvec, const ProblemVTable &)
required_function_t< void(crvec x, rvec grad_fx) const > eval_objective_gradient
static void default_eval_grad_gi(const void *, crvec, index_t, rvec, const ProblemVTable &)
static Sparsity default_get_augmented_lagrangian_hessian_sparsity(const void *, const ProblemVTable &)
static void default_eval_lagrangian_gradient(const void *self, crvec x, crvec y, rvec grad_L, rvec work_n, const ProblemVTable &vtable)
optional_function_t< void(crvec x, crvec y, rvec grad_L, rvec work_n) const > eval_lagrangian_gradient
static const Box & default_get_general_bounds(const void *, const ProblemVTable &)
optional_function_t< void(crvec x, crvec y, rvec grad_f, rvec grad_gxy) const > eval_objective_gradient_and_constraints_gradient_product
static void default_eval_lagrangian_hessian_product(const void *, crvec, crvec, real_t, crvec, rvec, const ProblemVTable &)
required_function_t< void(crvec x, rvec gx) const > eval_constraints
static const Box & default_get_variable_bounds(const void *, const ProblemVTable &)
static void default_eval_constraints_jacobian(const void *, crvec, rvec, const ProblemVTable &)
required_function_t< void(crvec x, crvec y, rvec grad_gxy) const > eval_constraints_gradient_product
static real_t default_eval_objective_and_gradient(const void *self, crvec x, rvec grad_fx, const ProblemVTable &vtable)
alpaqa::Box< config_t > Box
static real_t default_eval_augmented_lagrangian_and_gradient(const void *self, crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m, const ProblemVTable &vtable)
static void default_eval_augmented_lagrangian_hessian_product(const void *self, crvec x, crvec y, crvec, real_t scale, crvec v, rvec Hv, const ProblemVTable &vtable)
static index_t default_eval_inactive_indices_res_lna(const void *, real_t, crvec, crvec, rindexvec, const ProblemVTable &)
static void default_check(const void *, const ProblemVTable &)
static real_t default_eval_objective_and_constraints(const void *self, crvec x, rvec g, const ProblemVTable &vtable)
static real_t calc_ŷ_dᵀŷ(const void *self, rvec g_ŷ, crvec y, crvec Σ, const ProblemVTable &vtable)
optional_function_t< void(crvec x, crvec y, real_t scale, crvec v, rvec Hv) const > eval_lagrangian_hessian_product
static void default_eval_augmented_lagrangian_hessian(const void *self, crvec x, crvec y, crvec, real_t scale, rvec H_values, const ProblemVTable &vtable)
static void default_eval_augmented_lagrangian_gradient(const void *self, crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m, const ProblemVTable &vtable)