alpaqa 1.0.0a8
Nonconvex constrained optimization
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
BoxConstrProblem< Conf > Class Template Reference

#include <alpaqa/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.

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

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

+ Inheritance diagram for BoxConstrProblem< Conf >:
+ Collaboration diagram for BoxConstrProblem< Conf >:

Public Types

using Box = alpaqa::Box< config_t >
 

Public Member Functions

 BoxConstrProblem (length_t n, length_t m)
 
 BoxConstrProblem (Box C, Box D, vec l1_reg=vec(0))
 
void resize (length_t n, length_t m)
 
 BoxConstrProblem (const BoxConstrProblem &)=default
 
BoxConstrProblemoperator= (const BoxConstrProblem &)=default
 
 BoxConstrProblem (BoxConstrProblem &&) noexcept=default
 
BoxConstrProblemoperator= (BoxConstrProblem &&) noexcept=default
 
length_t get_n () const
 Number of decision variables, n.
 
length_t get_m () const
 Number of constraints, m.
 
real_t eval_prox_grad_step (real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) const
 
void eval_proj_diff_g (crvec z, rvec p) const
 
void eval_proj_multipliers (rvec y, real_t M) const
 
const Boxget_box_C () const
 
const Boxget_box_D () const
 
index_t eval_inactive_indices_res_lna (real_t γ, crvec x, crvec grad_ψ, rindexvec J) const
 
void check () 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 n
 Number of decision variables, dimension of x.
 
length_t m
 Number of constraints, dimension of g(x) and z.
 
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.
 
Box C {this->n}
 Constraints of the decision variables, \( x \in C \).
 
Box D {this->m}
 Other constraints, \( g(x) \in D \).
 
vec l1_reg {}
 \( \ell_1 \) (1-norm) regularization parameter.
 

Member Typedef Documentation

◆ Box

using Box = alpaqa::Box<config_t>

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

Constructor & Destructor Documentation

◆ BoxConstrProblem() [1/4]

BoxConstrProblem ( length_t  n,
length_t  m 
)
inline
Parameters
nNumber of decision variables
mNumber of constraints

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

◆ BoxConstrProblem() [2/4]

BoxConstrProblem ( Box  C,
Box  D,
vec  l1_reg = vec(0) 
)
inline

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

◆ BoxConstrProblem() [3/4]

BoxConstrProblem ( const BoxConstrProblem< Conf > &  )
default

◆ BoxConstrProblem() [4/4]

BoxConstrProblem ( BoxConstrProblem< Conf > &&  )
defaultnoexcept

Member Function Documentation

◆ resize()

void resize ( length_t  n,
length_t  m 
)
inline

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

◆ operator=() [1/2]

BoxConstrProblem & operator= ( const BoxConstrProblem< Conf > &  )
default

◆ operator=() [2/2]

BoxConstrProblem & operator= ( BoxConstrProblem< Conf > &&  )
defaultnoexcept

◆ get_n()

length_t get_n ( ) const
inline

Number of decision variables, n.

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

◆ get_m()

length_t get_m ( ) const
inline

Number of constraints, m.

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

◆ eval_proj_grad_step_box()

static 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 69 of file box-constr-problem.hpp.

+ Here is the caller graph for this function:

◆ eval_prox_grad_step_box_l1_impl()

static 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 92 of file box-constr-problem.hpp.

+ Here is the caller graph for this function:

◆ eval_prox_grad_step_box_l1()

static 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 101 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()

static 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 108 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()

real_t eval_prox_grad_step ( real_t  γ,
crvec  x,
crvec  grad_ψ,
rvec  ,
rvec  p 
) const
inline
See also
TypeErasedProblem::eval_prox_grad_step

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

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

◆ eval_proj_diff_g()

void eval_proj_diff_g ( crvec  z,
rvec  p 
) const
inline
See also
TypeErasedProblem::eval_proj_diff_g

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

+ Here is the call graph for this function:

◆ eval_proj_multipliers_box()

static void eval_proj_multipliers_box ( const Box D,
rvec  y,
real_t  M,
index_t  penalty_alm_split 
)
inlinestatic

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

+ Here is the caller graph for this function:

◆ eval_proj_multipliers()

void eval_proj_multipliers ( rvec  y,
real_t  M 
) const
inline
See also
TypeErasedProblem::eval_proj_multipliers

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

+ Here is the call graph for this function:

◆ get_box_C()

const Box & get_box_C ( ) const
inline
See also
TypeErasedProblem::get_box_C

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

◆ get_box_D()

const Box & get_box_D ( ) const
inline
See also
TypeErasedProblem::get_box_D

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

◆ eval_inactive_indices_res_lna()

index_t eval_inactive_indices_res_lna ( real_t  γ,
crvec  x,
crvec  grad_ψ,
rindexvec  J 
) const
inline

◆ check()

void check ( ) const
inline
See also
TypeErasedProblem::check

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

Member Data Documentation

◆ n

Number of decision variables, dimension of x.

Examples
C++/CustomCppProblem/main.cpp.

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

◆ m

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

Examples
C++/CustomCppProblem/main.cpp.

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

◆ penalty_alm_split

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 27 of file box-constr-problem.hpp.

◆ C

Box C {this->n}

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

Examples
C++/CasADi/Rosenbrock/main.cpp.

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

◆ D

Box D {this->m}

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

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

◆ l1_reg

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 57 of file box-constr-problem.hpp.


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