34 :
n{
C.lowerbound.size()},
m{
D.lowerbound.size()},
C{std::move(
C)},
D{std::move(
D)},
42 if (std::exchange(this->n,
n) !=
n) {
47 if (std::exchange(this->m,
m) !=
m) {
109 p = -x.cwiseMax(γ * (grad_ψ - λ))
110 .cwiseMin(γ * (grad_ψ + λ))
126 auto λ_vec = vec::Constant(
n, λ);
128 return λ * vec_util ::norm_1(x̂);
135 else if (
l1_reg.size() == 1)
149 return std::max(y,
y_lb);
154 return std::min(y,
y_ub);
190 else if (
x_fw < -γ * λ)
215 "Length of problem.C.lowerbound does not match problem size problem.n");
217 "Length of problem.C.upperbound does not match problem size problem.n");
219 "Length of problem.D.lowerbound does not match problem size problem.m");
221 "Length of problem.D.upperbound does not match problem size problem.m");
225 "Length of problem.l1_reg does not match problem size problem.n, 1 or 0");
227 throw std::invalid_argument(
"Invalid penalty_alm_split");
Implements common problem functions for minimization problems with box constraints.
Box C
Constraints of the decision variables, .
const Box & get_box_C() const
index_t eval_inactive_indices_res_lna(real_t γ, crvec x, crvec grad_ψ, rindexvec J) const
void eval_proj_diff_g(crvec z, rvec p) const
static real_t eval_prox_grad_step_box_l1(const Box &C, const auto &λ, real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p)
Proximal gradient step for rectangular box C with ℓ₁-regularization.
static void eval_proj_multipliers_box(const Box &D, rvec y, real_t M, index_t penalty_alm_split)
BoxConstrProblem(const BoxConstrProblem &)=default
length_t m
Number of constraints, dimension of g(x) and z.
static void eval_prox_grad_step_box_l1_impl(const Box &C, const auto &λ, real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p)
Proximal gradient step for rectangular box C with ℓ₁-regularization.
const Box & get_box_D() const
BoxConstrProblem & operator=(const BoxConstrProblem &)=default
length_t get_m() const
Number of constraints, m.
index_t penalty_alm_split
Components of the constraint function with indices below this number are handled using a quadratic pe...
length_t n
Number of decision variables, dimension of x.
BoxConstrProblem(Box C, Box D, vec l1_reg=vec(0), index_t penalty_alm_split=0)
Box D
Other constraints, .
void eval_proj_multipliers(rvec y, real_t M) const
BoxConstrProblem(BoxConstrProblem &&) noexcept=default
real_t eval_prox_grad_step(real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) const
void resize(length_t n, length_t m)
Change the dimensions of the problem (number of decision variables and number of constaints).
BoxConstrProblem(length_t n, length_t m)
Create a problem with inactive boxes , with no -regularization, and all general constraints handled u...
static real_t eval_prox_grad_step_box_l1_scal(const Box &C, real_t λ, real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p)
Proximal gradient step for rectangular box C with ℓ₁-regularization.
length_t get_n() const
Number of decision variables, n.
vec l1_reg
(1-norm) regularization parameter.
static real_t eval_proj_grad_step_box(const Box &C, real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p)
Projected gradient step for rectangular box C.
#define USING_ALPAQA_CONFIG(Conf)
void check_dim_msg(const V &v, auto sz, std::string msg)
auto norm_1(const Eigen::MatrixBase< Derived > &v)
Get the 1-norm of the given vector.
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