Functions | |
void | project_y (rvec y, crvec z_lb, crvec z_ub, real_t M) |
void | update_penalty_weights (const ALMParams ¶ms, real_t Δ, bool first_iter, rvec e, rvec old_e, real_t norm_e, real_t old_norm_e, crvec Σ_old, rvec Σ) |
void | initialize_penalty (const Problem &p, const ALMParams ¶ms, crvec x0, rvec Σ) |
void | apply_preconditioning (const Problem &problem, Problem &prec_problem, crvec x, real_t &prec_f, vec &prec_g) |
real_t | calc_ψ_ŷ (const Problem &p, crvec x, crvec y, crvec Σ, rvec ŷ) |
Calculate both ψ(x) and the vector ŷ that can later be used to compute ∇ψ. More... | |
void | calc_grad_ψ_from_ŷ (const Problem &p, crvec x, crvec ŷ, rvec grad_ψ, rvec work_n) |
Calculate ∇ψ(x) using ŷ. More... | |
real_t | calc_ψ_grad_ψ (const Problem &p, crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) |
Calculate both ψ(x) and its gradient ∇ψ(x). More... | |
void | calc_grad_ψ (const Problem &p, crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) |
Calculate the gradient ∇ψ(x). More... | |
void | calc_err_z (const Problem &p, crvec x̂, crvec y, crvec Σ, rvec err_z) |
Calculate the error between ẑ and g(x). More... | |
auto | projected_gradient_step (const Box &C, real_t γ, crvec x, crvec grad_ψ) |
Projected gradient step. More... | |
void | calc_x̂ (const Problem &prob, real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) |
bool | stop_crit_requires_grad_̂ψₖ (PANOCStopCrit crit) |
real_t | calc_error_stop_crit (const Box &C, PANOCStopCrit crit, crvec pₖ, real_t γ, crvec xₖ, crvec x̂ₖ, crvec ŷₖ, crvec grad_ψₖ, crvec grad_̂ψₖ) |
Compute the ε from the stopping criterion, see PANOCStopCrit. More... | |
real_t | descent_lemma (const Problem &problem, real_t rounding_tolerance, real_t L_max, crvec xₖ, real_t ψₖ, crvec grad_ψₖ, crvec y, crvec Σ, rvec x̂ₖ, rvec pₖ, rvec ŷx̂ₖ, real_t &ψx̂ₖ, real_t &norm_sq_pₖ, real_t &grad_ψₖᵀpₖ, real_t &Lₖ, real_t &γₖ) |
Increase the estimate of the Lipschitz constant of the objective gradient and decrease the step size until quadratic upper bound or descent lemma is satisfied: More... | |
template<class ParamsT , class DurationT > | |
SolverStatus | check_all_stop_conditions (const ParamsT ¶ms, DurationT time_elapsed, unsigned iteration, const AtomicStopSignal &stop_signal, real_t ε, real_t εₖ, unsigned no_progress) |
Check all stop conditions (required tolerance reached, out of time, maximum number of iterations exceeded, interrupted by user, infinite iterate, no progress made) More... | |
void | calc_augmented_lagrangian_hessian (const Problem &problem, crvec xₖ, crvec ŷxₖ, crvec y, crvec Σ, rvec g, mat &H, rvec work_n) |
Compute the Hessian matrix of the augmented Lagrangian function. More... | |
void | calc_augmented_lagrangian_hessian_prod_fd (const Problem &problem, crvec xₖ, crvec y, crvec Σ, crvec grad_ψ, crvec v, rvec Hv, rvec work_n1, rvec work_n2, rvec work_m) |
Compute the Hessian matrix of the augmented Lagrangian function multiplied by the given vector, using finite differences. More... | |
real_t | initial_lipschitz_estimate (const Problem &problem, crvec xₖ, crvec y, crvec Σ, real_t ε, real_t δ, real_t L_min, real_t L_max, real_t &ψ, rvec grad_ψ, rvec work_n1, rvec work_n2, rvec work_n3, rvec work_m) |
Estimate the Lipschitz constant of the gradient \( \nabla \psi \) using finite differences. More... | |
real_t | initial_lipschitz_estimate (const Problem &problem, crvec xₖ, crvec y, crvec Σ, real_t ε, real_t δ, real_t L_min, real_t L_max, rvec grad_ψ, rvec work_n1, rvec work_n2, rvec work_n3, rvec work_m) |
Estimate the Lipschitz constant of the gradient \( \nabla \psi \) using finite differences. More... | |
template<class ObjFunT , class ObjGradFunT > | |
real_t | initial_lipschitz_estimate (const ObjFunT &ψ, const ObjGradFunT &grad_ψ, crvec xₖ, real_t ε, real_t δ, real_t L_min, real_t L_max, real_t &ψₖ, rvec grad_ψₖ, vec_allocator &alloc) |
Estimate the Lipschitz constant of the gradient \( \nabla \psi \) using finite differences. More... | |
void | calc_x̂ (real_t γ, crvec x, const Box &C, crvec grad_ψ, rvec x̂, rvec p) |
template<class ObjFunT > | |
real_t | descent_lemma (const ObjFunT &ψ, const Box &C, real_t rounding_tolerance, real_t L_max, crvec xₖ, real_t ψₖ, crvec grad_ψₖ, rvec x̂ₖ, rvec pₖ, real_t &ψx̂ₖ, real_t &norm_sq_pₖ, real_t &grad_ψₖᵀpₖ, real_t &Lₖ, real_t &γₖ) |
Increase the estimate of the Lipschitz constant of the objective gradient and decrease the step size until quadratic upper bound or descent lemma is satisfied: More... | |
void | print_progress (unsigned k, real_t ψₖ, crvec grad_ψₖ, real_t pₖᵀpₖ, real_t γₖ, real_t εₖ) |
Calculate both ψ(x) and the vector ŷ that can later be used to compute ∇ψ.
\[ \psi(x^k) = f(x^k) + \frac{1}{2} \text{dist}_\Sigma^2\left(g(x^k) + \Sigma^{-1}y,\;D\right) \]
\[ \hat{y} \]
[in] | p | Problem description |
[in] | x | Decision variable \( x \) |
[in] | y | Lagrange multipliers \( y \) |
[in] | Σ | Penalty weights \( \Sigma \) |
[out] | ŷ | \( \hat{y} \) |
Definition at line 16 of file panoc-helpers.hpp.
|
inline |
Calculate ∇ψ(x) using ŷ.
[in] | p | Problem description |
[in] | x | Decision variable \( x \) |
[in] | ŷ | \( \hat{y} \) |
[out] | grad_ψ | \( \nabla \psi(x) \) |
work_n | Dimension n |
Definition at line 44 of file panoc-helpers.hpp.
|
inline |
Calculate both ψ(x) and its gradient ∇ψ(x).
\[ \psi(x^k) = f(x^k) + \frac{1}{2} \text{dist}_\Sigma^2\left(g(x^k) + \Sigma^{-1}y,\;D\right) \]
\[ \nabla \psi(x) = \nabla f(x) + \nabla g(x)\ \hat{y}(x) \]
[in] | p | Problem description |
[in] | x | Decision variable \( x \) |
[in] | y | Lagrange multipliers \( y \) |
[in] | Σ | Penalty weights \( \Sigma \) |
[out] | grad_ψ | \( \nabla \psi(x) \) |
work_n | Dimension n | |
work_m | Dimension m |
Definition at line 62 of file panoc-helpers.hpp.
|
inline |
Calculate the gradient ∇ψ(x).
\[ \nabla \psi(x) = \nabla f(x) + \nabla g(x)\ \hat{y}(x) \]
[in] | p | Problem description |
[in] | x | Decision variable \( x \) |
[in] | y | Lagrange multipliers \( y \) |
[in] | Σ | Penalty weights \( \Sigma \) |
[out] | grad_ψ | \( \nabla \psi(x) \) |
work_n | Dimension n | |
work_m | Dimension m |
Definition at line 79 of file panoc-helpers.hpp.
|
inline |
Calculate the error between ẑ and g(x).
\[ \hat{z}^k = \Pi_D\left(g(x^k) + \Sigma^{-1}y\right) \]
[in] | p | Problem description |
[in] | x̂ | Decision variable \( \hat{x} \) |
[in] | y | Lagrange multipliers \( y \) |
[in] | Σ | Penalty weights \( \Sigma \) |
[out] | err_z | \( g(\hat{x}) - \hat{z} \) |
Definition at line 107 of file panoc-helpers.hpp.
|
inline |
Projected gradient step.
\[ \begin{aligned} \hat{x}^k &= T_{\gamma^k}\left(x^k\right) \\ &= \Pi_C\left(x^k - \gamma^k \nabla \psi(x^k)\right) \\ p^k &= \hat{x}^k - x^k \\ \end{aligned} \]
[in] | C | Set to project onto |
[in] | γ | Step size |
[in] | x | Decision variable \( x \) |
[in] | grad_ψ | \( \nabla \psi(x^k) \) |
Definition at line 131 of file panoc-helpers.hpp.
|
inline |
[in] | prob | Problem description |
[in] | γ | Step size |
[in] | x | Decision variable \( x \) |
[in] | grad_ψ | \( \nabla \psi(x^k) \) |
[out] | x̂ | \( \hat{x}^k = T_{\gamma^k}(x^k) \) |
[out] | p | \( \hat{x}^k - x^k \) |
Definition at line 142 of file panoc-helpers.hpp.
|
inline |
|
inline |
Compute the ε from the stopping criterion, see PANOCStopCrit.
[in] | C | Box constraints on x |
[in] | crit | What stoppint criterion to use |
[in] | pₖ | Projected gradient step \( \hat x^k - x^k \) |
[in] | γ | Step size |
[in] | xₖ | Current iterate |
[in] | x̂ₖ | Current iterate after projected gradient step |
[in] | ŷₖ | Candidate Lagrange multipliers |
[in] | grad_ψₖ | Gradient in \( x^k \) |
[in] | grad_̂ψₖ | Gradient in \( \hat x^k \) |
Definition at line 169 of file panoc-helpers.hpp.
|
inline |
Increase the estimate of the Lipschitz constant of the objective gradient and decrease the step size until quadratic upper bound or descent lemma is satisfied:
\[ \psi(x + p) \le \psi(x) + \nabla\psi(x)^\top p + \frac{L}{2} \|p\|^2 \]
The projected gradient iterate \( \hat x^k \) and step \( p^k \) are updated with the new step size \( \gamma^k \), and so are other quantities that depend on them, such as \( \nabla\psi(x^k)^\top p^k \) and \( \|p\|^2 \). The intermediate vector \( \hat y(x^k) \) can be used to compute the gradient \( \nabla\psi(\hat x^k) \) or to update the Lagrange multipliers.
[in] | problem | Problem description |
[in] | rounding_tolerance | Tolerance used to ignore rounding errors when the function \( \psi(x) \) is relatively flat or the step size is very small, which could cause \( \psi(x^k) < \psi(\hat x^k) \), which is mathematically impossible but could occur in finite precision floating point arithmetic. |
[in] | L_max | Maximum allowed Lipschitz constant estimate (prevents infinite loop if function or derivatives are discontinuous, and keeps step size bounded away from zero). |
[in] | xₖ | Current iterate \( x^k \) |
[in] | ψₖ | Objective function \( \psi(x^k) \) |
[in] | grad_ψₖ | Gradient of objective \( \nabla\psi(x^k) \) |
[in] | y | Lagrange multipliers \( y \) |
[in] | Σ | Penalty weights \( \Sigma \) |
[out] | x̂ₖ | Projected gradient iterate \( \hat x^k \) |
[out] | pₖ | Projected gradient step \( p^k \) |
[out] | ŷx̂ₖ | Intermediate vector \( \hat y(x^k) \) |
[in,out] | ψx̂ₖ | Objective function \( \psi(\hat x^k) \) |
[in,out] | norm_sq_pₖ | Squared norm of the step \( \left\| p^k \right\|^2 \) |
[in,out] | grad_ψₖᵀpₖ | Gradient of objective times step \( \nabla\psi(x^k)^\top p^k\) |
[in,out] | Lₖ | Lipschitz constant estimate \( L_{\nabla\psi}^k \) |
[in,out] | γₖ | Step size \( \gamma^k \) |
Definition at line 242 of file panoc-helpers.hpp.
|
inline |
Check all stop conditions (required tolerance reached, out of time, maximum number of iterations exceeded, interrupted by user, infinite iterate, no progress made)
[in] | params | Parameters including `max_iter`, `max_time` and `max_no_progress` |
[in] | time_elapsed | Time elapsed since the start of the algorithm |
[in] | iteration | The current iteration number |
[in] | stop_signal | A stop signal for the user to interrupt the algorithm |
[in] | ε | Desired primal tolerance |
[in] | εₖ | Tolerance of the current iterate |
[in] | no_progress | The number of successive iterations no progress was made |
Definition at line 307 of file panoc-helpers.hpp.
|
inline |
Compute the Hessian matrix of the augmented Lagrangian function.
\[ \nabla^2_{xx} L_\Sigma(x, y) = \Big. \nabla_{xx}^2 L(x, y) \Big|_{\big(x,\, \hat y(x, y)\big)} + \sum_{i\in\mathcal{I}} \Sigma_i\,\nabla g_i(x) \nabla g_i(x)^\top \]
[in] | problem | Problem description |
[in] | xₖ | Current iterate \( x^k \) |
[in] | ŷxₖ | Intermediate vector \( \hat y(x^k) \) |
[in] | y | Lagrange multipliers \( y \) |
[in] | Σ | Penalty weights \( \Sigma \) |
[out] | g | The constraint values \( g(x^k) \) |
[out] | H | Hessian matrix \( H(x, y) \) |
work_n | Dimension n |
Definition at line 342 of file panoc-helpers.hpp.
|
inline |
Compute the Hessian matrix of the augmented Lagrangian function multiplied by the given vector, using finite differences.
\[ \nabla^2_{xx} L_\Sigma(x, y)\, v \approx \frac{\nabla_x L_\Sigma(x+hv, y) - \nabla_x L_\Sigma(x, y)}{h} \]
[in] | problem | Problem description |
[in] | xₖ | Current iterate \( x^k \) |
[in] | y | Lagrange multipliers \( y \) |
[in] | Σ | Penalty weights \( \Sigma \) |
[in] | grad_ψ | Gradient \( \nabla \psi(x^k) \) |
[in] | v | Vector to multiply with the Hessian |
[out] | Hv | Hessian-vector product |
work_n1 | Dimension n | |
work_n2 | Dimension n | |
work_m | Dimension m |
Definition at line 379 of file panoc-helpers.hpp.
|
inline |
Estimate the Lipschitz constant of the gradient \( \nabla \psi \) using finite differences.
[in] | problem | Problem description |
[in] | xₖ | Current iterate \( x^k \) |
[in] | y | Lagrange multipliers \( y \) |
[in] | Σ | Penalty weights \( \Sigma \) |
[in] | ε | Finite difference step size relative to xₖ |
[in] | δ | Minimum absolute finite difference step size |
[in] | L_min | Minimum allowed Lipschitz estimate. |
[in] | L_max | Maximum allowed Lipschitz estimate. |
[out] | ψ | \( \psi(x^k) \) |
[out] | grad_ψ | Gradient \( \nabla \psi(x^k) \) |
work_n1 | Dimension n | |
work_n2 | Dimension n | |
work_n3 | Dimension n | |
work_m | Dimension m |
Definition at line 412 of file panoc-helpers.hpp.
|
inline |
Estimate the Lipschitz constant of the gradient \( \nabla \psi \) using finite differences.
[in] | problem | Problem description |
[in] | xₖ | Current iterate \( x^k \) |
[in] | y | Lagrange multipliers \( y \) |
[in] | Σ | Penalty weights \( \Sigma \) |
[in] | ε | Finite difference step size relative to xₖ |
[in] | δ | Minimum absolute finite difference step size |
[in] | L_min | Minimum allowed Lipschitz estimate. |
[in] | L_max | Maximum allowed Lipschitz estimate. |
[out] | grad_ψ | Gradient \( \nabla \psi(x^k) \) |
work_n1 | Dimension n | |
work_n2 | Dimension n | |
work_n3 | Dimension n | |
work_m | Dimension m |
Definition at line 459 of file panoc-helpers.hpp.
real_t alpaqa::detail::initial_lipschitz_estimate | ( | const ObjFunT & | ψ, |
const ObjGradFunT & | grad_ψ, | ||
crvec | xₖ, | ||
real_t | ε, | ||
real_t | δ, | ||
real_t | L_min, | ||
real_t | L_max, | ||
real_t & | ψₖ, | ||
rvec | grad_ψₖ, | ||
vec_allocator & | alloc | ||
) |
Estimate the Lipschitz constant of the gradient \( \nabla \psi \) using finite differences.
[in] | ψ | Objective |
[in] | grad_ψ | Gradient of |
[in] | xₖ | Current iterate \( x^k \) |
[in] | ε | Finite difference step size relative to xₖ |
[in] | δ | Minimum absolute finite difference step size |
[in] | L_min | Minimum allowed Lipschitz estimate. |
[in] | L_max | Maximum allowed Lipschitz estimate. |
[out] | ψₖ | \( \psi(x^k) \) |
[out] | grad_ψₖ | Gradient \( \nabla \psi(x^k) \) |
[in] | alloc |
Definition at line 20 of file standalone/panoc.hpp.
|
inline |
[in] | γ | Step size |
[in] | x | Decision variable \( x \) |
[in] | C | Box constraints \( C \) |
[in] | grad_ψ | \( \nabla \psi(x^k) \) |
[out] | x̂ | \( \hat{x}^k = T_{\gamma^k}(x^k) \) |
[out] | p | \( \hat{x}^k - x^k \) |
Definition at line 58 of file standalone/panoc.hpp.
real_t alpaqa::detail::descent_lemma | ( | const ObjFunT & | ψ, |
const Box & | C, | ||
real_t | rounding_tolerance, | ||
real_t | L_max, | ||
crvec | xₖ, | ||
real_t | ψₖ, | ||
crvec | grad_ψₖ, | ||
rvec | x̂ₖ, | ||
rvec | pₖ, | ||
real_t & | ψx̂ₖ, | ||
real_t & | norm_sq_pₖ, | ||
real_t & | grad_ψₖᵀpₖ, | ||
real_t & | Lₖ, | ||
real_t & | γₖ | ||
) |
Increase the estimate of the Lipschitz constant of the objective gradient and decrease the step size until quadratic upper bound or descent lemma is satisfied:
\[ \psi(x + p) \le \psi(x) + \nabla\psi(x)^\top p + \frac{L}{2} \|p\|^2 \]
The projected gradient iterate \( \hat x^k \) and step \( p^k \) are updated with the new step size \( \gamma^k \), and so are other quantities that depend on them, such as \( \nabla\psi(x^k)^\top p^k \) and \( \|p\|^2 \). The intermediate vector \( \hat y(x^k) \) can be used to compute the gradient \( \nabla\psi(\hat x^k) \) or to update the Lagrange multipliers.
[in] | ψ | Objective. |
[in] | C | Box constraints. |
[in] | rounding_tolerance | Tolerance used to ignore rounding errors when the function \( \psi(x) \) is relatively flat or the step size is very small, which could cause \( \psi(x^k) < \psi(\hat x^k) \), which is mathematically impossible but could occur in finite precision floating point arithmetic. |
[in] | L_max | Maximum allowed Lipschitz constant estimate (prevents infinite loop if function or derivatives are discontinuous, and keeps step size bounded away from zero). |
[in] | xₖ | Current iterate \( x^k \) |
[in] | ψₖ | Objective function \( \psi(x^k) \) |
[in] | grad_ψₖ | Gradient of objective \( \nabla\psi(x^k) \) |
[out] | x̂ₖ | Projected gradient iterate \( \hat x^k \) |
[out] | pₖ | Projected gradient step \( p^k \) |
[in,out] | ψx̂ₖ | Objective function \( \psi(\hat x^k) \) |
[in,out] | norm_sq_pₖ | Squared norm of the step \( \left\| p^k \right\|^2 \) |
[in,out] | grad_ψₖᵀpₖ | Gradient of objective times step \( \nabla\psi(x^k)^\top p^k\) |
[in,out] | Lₖ | Lipschitz constant estimate \( L_{\nabla\psi}^k \) |
[in,out] | γₖ | Step size \( \gamma^k \) |
Definition at line 82 of file standalone/panoc.hpp.