alpaqa 1.1.0a1
Nonconvex constrained optimization
Loading...
Searching...
No Matches
BoxConstrProblem< Conf > Class Template Reference

#include <alpaqa/problem/box-constr-problem.hpp>

Detailed Description

template<Config Conf>
class alpaqa::BoxConstrProblem< Conf >

Implements common problem functions for minimization problems with box constraints.

Meant to be used as a base class for custom problem implementations. Supports optional \( \ell_1 \)-regularization.

Examples
C++/CustomCppProblem/main.cpp, and C++/FortranProblem/main.cpp.

Definition at line 16 of file box-constr-problem.hpp.

Collaboration diagram for BoxConstrProblem< Conf >:

Public Types

using Box = alpaqa::Box<config_t>

Public Member Functions

 BoxConstrProblem (length_t num_variables, length_t num_constraints)
 Create a problem with inactive boxes \( (-\infty, +\infty) \), with no \( \ell_1 \)-regularization, and all general constraints handled using ALM.
 BoxConstrProblem (std::tuple< length_t, length_t > dims)
 Create a problem with inactive boxes \( (-\infty, +\infty) \), with no \( \ell_1 \)-regularization, and all general constraints handled using ALM.
 BoxConstrProblem (Box variable_bounds, Box general_bounds, vec l1_reg=vec(0), index_t penalty_alm_split=0)
void resize (length_t num_variables, length_t num_constraints)
 Change the dimensions of the problem (number of decision variables and number of constraints).
 BoxConstrProblem (const BoxConstrProblem &)=default
BoxConstrProblemoperator= (const BoxConstrProblem &)=default
 BoxConstrProblem (BoxConstrProblem &&) noexcept=default
BoxConstrProblemoperator= (BoxConstrProblem &&) noexcept=default
length_t get_num_variables () const
 Number of decision variables \( n \), num_variables.
length_t get_num_constraints () const
 Number of constraints \( m \), num_constraints.
real_t eval_proximal_gradient_step (real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) const
void eval_projecting_difference_constraints (crvec z, rvec p) const
void eval_projection_multipliers (rvec y, real_t M) const
const Boxget_variable_bounds () const
const Boxget_general_bounds () const
bool provides_get_variable_bounds () const
 Only supported if the ℓ₁-regularization term is zero.
index_t eval_inactive_indices_res_lna (real_t γ, crvec x, crvec grad_ψ, rindexvec J) const
void check () const
std::string get_name () const

Static Public Member Functions

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.
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.
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 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.
static void eval_proj_multipliers_box (const Box &D, rvec y, real_t M, index_t penalty_alm_split)

Public Attributes

length_t num_variables
 Number of decision variables, dimension of x.
length_t num_constraints
 Number of constraints, dimension of g(x) and z.
Box variable_bounds {this->num_variables}
 Constraints of the decision variables, \( x \in C \).
Box general_bounds {this->num_constraints}
 Other constraints, \( g(x) \in D \).
vec l1_reg {}
 \( \ell_1 \) (1-norm) regularization parameter.
index_t penalty_alm_split = 0
 Components of the constraint function with indices below this number are handled using a quadratic penalty method rather than using an augmented Lagrangian method.

Member Typedef Documentation

◆ Box

template<Config Conf>
using Box = alpaqa::Box<config_t>

Definition at line 19 of file box-constr-problem.hpp.

Constructor & Destructor Documentation

◆ BoxConstrProblem() [1/5]

template<Config Conf>
BoxConstrProblem ( length_t num_variables,
length_t num_constraints )
inline

Create a problem with inactive boxes \( (-\infty, +\infty) \), with no \( \ell_1 \)-regularization, and all general constraints handled using ALM.

Parameters
num_variablesNumber of decision variables
num_constraintsNumber of constraints

Definition at line 29 of file box-constr-problem.hpp.

Here is the caller graph for this function:

◆ BoxConstrProblem() [2/5]

template<Config Conf>
BoxConstrProblem ( std::tuple< length_t, length_t > dims)
inline

Create a problem with inactive boxes \( (-\infty, +\infty) \), with no \( \ell_1 \)-regularization, and all general constraints handled using ALM.

Parameters
dimsNumber of variables and number of constraints.

Definition at line 34 of file box-constr-problem.hpp.

Here is the call graph for this function:

◆ BoxConstrProblem() [3/5]

template<Config Conf>
BoxConstrProblem ( Box variable_bounds,
Box general_bounds,
vec l1_reg = vec(0),
index_t penalty_alm_split = 0 )
inline

Definition at line 37 of file box-constr-problem.hpp.

◆ BoxConstrProblem() [4/5]

template<Config Conf>
BoxConstrProblem ( const BoxConstrProblem< Conf > & )
default
Here is the call graph for this function:

◆ BoxConstrProblem() [5/5]

template<Config Conf>
BoxConstrProblem ( BoxConstrProblem< Conf > && )
defaultnoexcept
Here is the call graph for this function:

Member Function Documentation

◆ resize()

template<Config Conf>
void resize ( length_t num_variables,
length_t num_constraints )
inline

Change the dimensions of the problem (number of decision variables and number of constraints).

Destructive: resizes and/or resets the members variable_bounds, general_bounds, l1_reg and penalty_alm_split.

Parameters
num_variablesNumber of decision variables
num_constraintsNumber of constraints

Definition at line 47 of file box-constr-problem.hpp.

◆ operator=() [1/2]

template<Config Conf>
BoxConstrProblem & operator= ( const BoxConstrProblem< Conf > & )
default
Here is the call graph for this function:

◆ operator=() [2/2]

template<Config Conf>
BoxConstrProblem & operator= ( BoxConstrProblem< Conf > && )
defaultnoexcept
Here is the call graph for this function:

◆ get_num_variables()

template<Config Conf>
length_t get_num_variables ( ) const
inline

Number of decision variables \( n \), num_variables.

Definition at line 83 of file box-constr-problem.hpp.

◆ get_num_constraints()

template<Config Conf>
length_t get_num_constraints ( ) const
inline

Number of constraints \( m \), num_constraints.

Definition at line 85 of file box-constr-problem.hpp.

◆ eval_proj_grad_step_box()

template<Config Conf>
real_t eval_proj_grad_step_box ( const Box & C,
real_t γ,
crvec x,
crvec grad_ψ,
rvec ,
rvec p )
inlinestatic

Projected gradient step for rectangular box C.

\[ \begin{aligned} \hat x &= \Pi_C(x - \gamma\nabla\psi(x)) \\ p &= \hat x - x \\ &= \max(\underline x - x, \;\min(-\gamma\nabla\psi(x), \overline x - x) \end{aligned} \]

Definition at line 92 of file box-constr-problem.hpp.

Here is the caller graph for this function:

◆ eval_prox_grad_step_box_l1_impl()

template<Config Conf>
void eval_prox_grad_step_box_l1_impl ( const Box & C,
const auto & λ,
real_t γ,
crvec x,
crvec grad_ψ,
rvec ,
rvec p )
inlinestatic

Proximal gradient step for rectangular box C with ℓ₁-regularization.

\[ \begin{aligned} h(x) &= \|x\|_1 + \delta_C(x) \\ \hat x &= \prox_{\gamma h}(x - \gamma\nabla\psi(x)) \\ &= -\max\big( x - \overline x, \;\min\big( x - \underline x, \;\min\big( \gamma(\nabla\psi(x) + \lambda), \;\max\big( \gamma(\nabla\psi(x) - \lambda), x \big) \big) \big) \big) \end{aligned} \]

Definition at line 115 of file box-constr-problem.hpp.

Here is the caller graph for this function:

◆ eval_prox_grad_step_box_l1()

template<Config Conf>
real_t eval_prox_grad_step_box_l1 ( const Box & C,
const auto & λ,
real_t γ,
crvec x,
crvec grad_ψ,
rvec ,
rvec p )
inlinestatic

Proximal gradient step for rectangular box C with ℓ₁-regularization.

\[ \begin{aligned} h(x) &= \|x\|_1 + \delta_C(x) \\ \hat x &= \prox_{\gamma h}(x - \gamma\nabla\psi(x)) \\ &= -\max\big( x - \overline x, \;\min\big( x - \underline x, \;\min\big( \gamma(\nabla\psi(x) + \lambda), \;\max\big( \gamma(\nabla\psi(x) - \lambda), x \big) \big) \big) \big) \end{aligned} \]

Definition at line 124 of file box-constr-problem.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eval_prox_grad_step_box_l1_scal()

template<Config Conf>
real_t eval_prox_grad_step_box_l1_scal ( const Box & C,
real_t λ,
real_t γ,
crvec x,
crvec grad_ψ,
rvec ,
rvec p )
inlinestatic

Proximal gradient step for rectangular box C with ℓ₁-regularization.

\[ \begin{aligned} h(x) &= \|x\|_1 + \delta_C(x) \\ \hat x &= \prox_{\gamma h}(x - \gamma\nabla\psi(x)) \\ &= -\max\big( x - \overline x, \;\min\big( x - \underline x, \;\min\big( \gamma(\nabla\psi(x) + \lambda), \;\max\big( \gamma(\nabla\psi(x) - \lambda), x \big) \big) \big) \big) \end{aligned} \]

Definition at line 132 of file box-constr-problem.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eval_proximal_gradient_step()

template<Config Conf>
real_t eval_proximal_gradient_step ( real_t γ,
crvec x,
crvec grad_ψ,
rvec ,
rvec p ) const
inline
See also
eval_proximal_gradient_step

Definition at line 142 of file box-constr-problem.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eval_projecting_difference_constraints()

template<Config Conf>
void eval_projecting_difference_constraints ( crvec z,
rvec p ) const
inline
See also
eval_projecting_difference_constraints

Definition at line 153 of file box-constr-problem.hpp.

Here is the caller graph for this function:

◆ eval_proj_multipliers_box()

template<Config Conf>
void eval_proj_multipliers_box ( const Box & D,
rvec y,
real_t M,
index_t penalty_alm_split )
inlinestatic

Definition at line 157 of file box-constr-problem.hpp.

Here is the caller graph for this function:

◆ eval_projection_multipliers()

template<Config Conf>
void eval_projection_multipliers ( rvec y,
real_t M ) const
inline
See also
eval_projection_multipliers

Definition at line 173 of file box-constr-problem.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_variable_bounds()

template<Config Conf>
const Box & get_variable_bounds ( ) const
inline
See also
get_variable_bounds

Definition at line 178 of file box-constr-problem.hpp.

◆ get_general_bounds()

template<Config Conf>
const Box & get_general_bounds ( ) const
inline
See also
get_general_bounds

Definition at line 180 of file box-constr-problem.hpp.

◆ provides_get_variable_bounds()

template<Config Conf>
bool provides_get_variable_bounds ( ) const
inlinenodiscard

Only supported if the ℓ₁-regularization term is zero.

See also
provides_get_variable_bounds

Definition at line 184 of file box-constr-problem.hpp.

Here is the caller graph for this function:

◆ eval_inactive_indices_res_lna()

template<Config Conf>
index_t eval_inactive_indices_res_lna ( real_t γ,
crvec x,
crvec grad_ψ,
rindexvec J ) const
inline
See also
eval_inactive_indices_res_lna

Definition at line 194 of file box-constr-problem.hpp.

Here is the caller graph for this function:

◆ check()

template<Config Conf>
void check ( ) const
inline
See also
check

Definition at line 233 of file box-constr-problem.hpp.

Here is the call graph for this function:

◆ get_name()

template<Config Conf>
std::string get_name ( ) const
inlinenodiscard
See also
get_name

Definition at line 255 of file box-constr-problem.hpp.

Member Data Documentation

◆ num_variables

template<Config Conf>
length_t num_variables

Number of decision variables, dimension of x.

Definition at line 22 of file box-constr-problem.hpp.

◆ num_constraints

template<Config Conf>
length_t num_constraints

Number of constraints, dimension of g(x) and z.

Definition at line 24 of file box-constr-problem.hpp.

◆ variable_bounds

template<Config Conf>
Box variable_bounds {this->num_variables}

Constraints of the decision variables, \( x \in C \).

Definition at line 67 of file box-constr-problem.hpp.

◆ general_bounds

template<Config Conf>
Box general_bounds {this->num_constraints}

Other constraints, \( g(x) \in D \).

Definition at line 69 of file box-constr-problem.hpp.

◆ l1_reg

template<Config Conf>
vec l1_reg {}

\( \ell_1 \) (1-norm) regularization parameter.

Possible dimensions are: \( 0 \) (no regularization), \( 1 \) (a single scalar factor), or \( n \) (a different factor for each variable).

Definition at line 74 of file box-constr-problem.hpp.

◆ penalty_alm_split

template<Config Conf>
index_t penalty_alm_split = 0

Components of the constraint function with indices below this number are handled using a quadratic penalty method rather than using an augmented Lagrangian method.

Specifically, the Lagrange multipliers for these components (which determine the shifts in ALM) are kept at zero.

Definition at line 80 of file box-constr-problem.hpp.


The documentation for this class was generated from the following file: