38 :
n{
C.lowerbound.size()},
m{
D.lowerbound.size()},
C{std::move(
C)},
D{std::move(
D)},
48 if (std::exchange(this->n,
n) !=
n) {
53 if (std::exchange(this->m,
m) !=
m) {
115 p = -x.cwiseMax(γ * (grad_ψ - λ))
116 .cwiseMin(γ * (grad_ψ + λ))
126 return norm_1(x̂.cwiseProduct(λ));
133 auto λ_vec = vec::Constant(
n, λ);
136 return λ * norm_1(x̂);
143 else if constexpr (
requires {
l1_reg(0); })
183 if constexpr (
requires {
l1_reg(0); })
190 requires config_t::supports_indexvec
205 else if (
x_fw < -γ * λ)
230 "Length of problem.C.lowerbound does not match problem size problem.n");
232 "Length of problem.C.upperbound does not match problem size problem.n");
234 "Length of problem.D.lowerbound does not match problem size problem.m");
236 "Length of problem.D.upperbound does not match problem size problem.m");
240 "Length of problem.l1_reg does not match problem size problem.n, 1 or 0");
242 throw std::invalid_argument(
"Invalid penalty_alm_split");
246 [[
nodiscard]] std::string get_name()
const {
return "BoxConstrProblem"; }
Implements common problem functions for minimization problems with box constraints.
Box C
Constraints of the decision variables, .
const Box & get_box_C() 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
bool provides_get_box_C() const
Only supported if the ℓ₁-regularization term is zero.
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(std::tuple< length_t, length_t > dims)
Create a problem with inactive boxes , with no -regularization, and all general constraints handled u...
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