alpaqa 0.0.1
Nonconvex constrained optimization
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
alpaqa Namespace Reference

Namespaces

namespace  casadi_problem
 
namespace  detail
 
namespace  problems
 
namespace  test
 
namespace  vec_util
 

Classes

struct  ALMParams
 Parameters for the Augmented Lagrangian solver. More...
 
class  ALMSolver
 Augmented Lagrangian Method solver. More...
 
class  AndersonAccel
 Anderson Acceleration. More...
 
class  AtomicStopSignal
 
struct  Box
 
class  CasADiParamWrapper
 
struct  CircularIndexIterator
 
struct  CircularIndices
 
class  CircularRange
 
struct  EvalCounter
 
struct  GAAPGAParams
 
struct  GAAPGAProgressInfo
 
class  GAAPGASolver
 Guarded Anderson Accelerated Proximal Gradient Algorithm. More...
 
struct  InnerStatsAccumulator
 
struct  InnerStatsAccumulator< GAAPGASolver::Stats >
 
struct  InnerStatsAccumulator< LBFGSBStats >
 
struct  InnerStatsAccumulator< PANOCStats >
 
struct  InnerStatsAccumulator< PGASolver::Stats >
 
struct  InnerStatsAccumulator< PolymorphicInnerSolverWrapper::Stats >
 
struct  InnerStatsAccumulator< SecondOrderPANOCSolver::Stats >
 
struct  InnerStatsAccumulator< StructuredPANOCLBFGSStats >
 
class  LBFGS
 Limited memory Broyden–Fletcher–Goldfarb–Shanno (L-BFGS) algorithm. More...
 
class  LBFGSBSolver
 Box-constrained LBFGS solver for ALM. More...
 
struct  LBFGSBStats
 
struct  LBFGSParams
 Parameters for the LBFGS and SpecializedLBFGS classes. More...
 
struct  LBFGSParams.cbfgs
 
class  LBFGSSolver
 Unconstrained LBFGS solver for ALM. More...
 
class  LimitedMemoryQR
 Incremental QR factorization using modified Gram-Schmidt with reorthogonalization. More...
 
struct  LipschitzEstimateParams
 
struct  PANOCDirection
 
struct  PANOCDirection< AndersonAccel >
 
struct  PANOCDirection< LBFGS >
 
struct  PANOCDirection< PolymorphicPANOCDirectionBase >
 
struct  PANOCDirection< SpecializedLBFGS >
 
struct  PANOCParams
 Tuning parameters for the PANOC algorithm. More...
 
struct  PANOCProgressInfo
 
class  PANOCSolver
 PANOC solver for ALM. More...
 
struct  PANOCStats
 
class  ParamWrapper
 
struct  PGAParams
 
struct  PGAProgressInfo
 
class  PGASolver
 Standard Proximal Gradient Algorithm without any bells and whistles. More...
 
class  PolymorphicInnerSolver
 
class  PolymorphicInnerSolverBase
 
class  PolymorphicInnerSolverStatsAccumulatorBase
 
class  PolymorphicInnerSolverStatsBase
 
class  PolymorphicInnerSolverTrampoline
 
struct  PolymorphicInnerSolverWrapper
 
class  PolymorphicPANOCDirection
 
class  PolymorphicPANOCDirectionBase
 
class  PolymorphicPANOCDirectionTrampoline
 
class  Problem
 Problem description for minimization problems. More...
 
class  ProblemOnlyD
 Moves the state constraints in the set C to the set D, resulting in an unconstraint inner problem. More...
 
class  ProblemWithCounters
 
class  ProblemWithParam
 
struct  ReverseCircularIndexIterator
 
class  ReverseCircularRange
 
struct  SecondOrderPANOCParams
 Tuning parameters for the second order PANOC algorithm. More...
 
class  SecondOrderPANOCSolver
 Second order PANOC solver for ALM. More...
 
class  SpecializedLBFGS
 Limited memory Broyden–Fletcher–Goldfarb–Shanno (L-BFGS) algorithm that can handle updates of the γ parameter. More...
 
struct  StructuredPANOCLBFGSParams
 Tuning parameters for the second order PANOC algorithm. More...
 
struct  StructuredPANOCLBFGSProgressInfo
 
class  StructuredPANOCLBFGSSolver
 Second order PANOC solver for ALM. More...
 
struct  StructuredPANOCLBFGSStats
 
class  vec_allocator
 

Typedefs

using PolymorphicPGASolver = PolymorphicInnerSolver< PGASolver >
 
using PolymorphicGAAPGASolver = PolymorphicInnerSolver< GAAPGASolver >
 
using PolymorphicPANOCSolver = PolymorphicInnerSolver< PANOCSolver< PolymorphicPANOCDirectionBase > >
 
using PolymorphicStructuredPANOCLBFGSSolver = PolymorphicInnerSolver< StructuredPANOCLBFGSSolver >
 
using PolymorphicALMSolver = ALMSolver< PolymorphicInnerSolverWrapper >
 
using PolymorphicLBFGSDirection = PolymorphicPANOCDirection< LBFGS >
 
using real_t = double
 Default floating point type. More...
 
using realvec = Eigen::Matrix< real_t, Eigen::Dynamic, 1 >
 Default type for floating point vectors. More...
 
using realmat = Eigen::Matrix< real_t, Eigen::Dynamic, Eigen::Dynamic >
 Default type for floating point matrices. More...
 
using vec = realvec
 Default type for vectors. More...
 
using rvec = Eigen::Ref< vec >
 Default type for mutable references to vectors. More...
 
using crvec = Eigen::Ref< const vec >
 Default type for immutable references to vectors. More...
 
using mat = realmat
 Default type for matrices. More...
 
using rmat = Eigen::Ref< mat >
 Default type for mutable references to matrices. More...
 
using crmat = Eigen::Ref< const mat >
 Default type for immutable references to matrices. More...
 
using dim = std::pair< casadi_int, casadi_int >
 

Enumerations

enum class  LBFGSStepSize { BasedOnGradientStepSize = 0 , BasedOnCurvature = 1 }
 Which method to use to select the L-BFGS step size. More...
 
enum class  PANOCStopCrit {
  ApproxKKT = 0 , ApproxKKT2 , ProjGradNorm , ProjGradNorm2 ,
  ProjGradUnitNorm , ProjGradUnitNorm2 , FPRNorm , FPRNorm2 ,
  Ipopt
}
 
enum class  SolverStatus {
  Unknown = 0 , Converged , MaxTime , MaxIter ,
  NotFinite , NoProgress , Interrupted
}
 Exit status of a numerical solver such as ALM or PANOC. More...
 

Functions

template<class InnerSolver >
auto InnerSolverCallWrapper ()
 
InnerStatsAccumulator< PolymorphicInnerSolverWrapper::Stats > & operator+= (InnerStatsAccumulator< PolymorphicInnerSolverWrapper::Stats > &acc, const PolymorphicInnerSolverWrapper::Stats &s)
 
py::dict stats_to_dict (const PANOCStats &s)
 
py::dict stats_to_dict (const InnerStatsAccumulator< PANOCStats > &s)
 
py::dict stats_to_dict (const StructuredPANOCLBFGSSolver::Stats &s)
 
py::dict stats_to_dict (const PGASolver::Stats &s)
 
py::dict stats_to_dict (const GAAPGASolver::Stats &s)
 
py::dict stats_to_dict (const InnerStatsAccumulator< StructuredPANOCLBFGSSolver::Stats > &s)
 
py::dict stats_to_dict (const InnerStatsAccumulator< PGASolver::Stats > &s)
 
py::dict stats_to_dict (const InnerStatsAccumulator< GAAPGASolver::Stats > &s)
 
py::dict stats_to_dict (const PolymorphicALMSolver::Stats &s)
 
const char * enum_name (PANOCStopCrit s)
 
std::ostream & operator<< (std::ostream &os, PANOCStopCrit s)
 
InnerStatsAccumulator< PANOCStats > & operator+= (InnerStatsAccumulator< PANOCStats > &acc, const PANOCStats &s)
 
InnerStatsAccumulator< SecondOrderPANOCSolver::Stats > & operator+= (InnerStatsAccumulator< SecondOrderPANOCSolver::Stats > &acc, const SecondOrderPANOCSolver::Stats &s)
 
InnerStatsAccumulator< StructuredPANOCLBFGSStats > & operator+= (InnerStatsAccumulator< StructuredPANOCLBFGSStats > &acc, const StructuredPANOCLBFGSStats &s)
 
void minimize_update_anderson (LimitedMemoryQR &qr, rmat G, crvec rₖ, crvec rₖ₋₁, crvec gₖ, rvec γ_LS, rvec xₖ_aa)
 Solve one step of Anderson acceleration to find a fixed point of a function g(x): More...
 
InnerStatsAccumulator< GAAPGASolver::Stats > & operator+= (InnerStatsAccumulator< GAAPGASolver::Stats > &acc, const GAAPGASolver::Stats &s)
 
InnerStatsAccumulator< LBFGSBStats > & operator+= (InnerStatsAccumulator< LBFGSBStats > &acc, const LBFGSBStats &s)
 
InnerStatsAccumulator< PGASolver::Stats > & operator+= (InnerStatsAccumulator< PGASolver::Stats > &acc, const PGASolver::Stats &s)
 
alpaqa::Problem load_CasADi_problem (const std::string &filename, unsigned n=0, unsigned m=0, bool second_order=false)
 Load a problem generated by CasADi (without parameters). More...
 
ProblemWithParam load_CasADi_problem_with_param (const std::string &filename, unsigned n=0, unsigned m=0, unsigned p=0, bool second_order=false)
 Load a problem generated by CasADi (with parameters). More...
 
template<class ObjFunT , class ObjGradFunT , class DirectionT >
PANOCStats panoc_impl (ObjFunT &ψ, ObjGradFunT &grad_ψ, const Box &C, rvec x, real_t ε, const PANOCParams &params, vec_allocator &alloc, DirectionT &direction_provider)
 
template<class DirectionProviderT = LBFGS, class ObjFunT , class ObjGradFunT >
PANOCStats panoc (ObjFunT &ψ, ObjGradFunT &grad_ψ, const Box &C, rvec x, real_t ε, const PANOCParams &params, PANOCDirection< DirectionProviderT > direction, vec_allocator &alloc)
 
template<class DirectionProviderT = LBFGS, class ObjFunT , class ObjGradFunT >
PANOCStats panoc (ObjFunT &ψ, ObjGradFunT &grad_ψ, const Box &C, rvec x, real_t ε, const PANOCParams &params, PANOCDirection< DirectionProviderT > direction)
 
template<class Vec >
auto project (const Vec &v, const Box &box)
 Project a vector onto a box. More...
 
template<class Vec >
auto projecting_difference (const Vec &v, const Box &box)
 Get the difference between the given vector and its projection. More...
 
real_t dist_squared (crvec v, const Box &box)
 Get the distance squared between the given vector and its projection. More...
 
real_t dist_squared (crvec v, const Box &box, crvec Σ)
 Get the distance squared between the given vector and its projection in the Σ norm. More...
 
EvalCounteroperator+= (EvalCounter &a, const EvalCounter &b)
 
EvalCounter::EvalTimeroperator+= (EvalCounter::EvalTimer &a, const EvalCounter::EvalTimer &b)
 
EvalCounter operator+ (EvalCounter a, const EvalCounter &b)
 
template<class F >
auto wrap_load (const std::string &so_name, const char *name, F f)
 
template<class T , class... Args>
auto wrapped_load (const std::string &so_name, const char *name, Args &&...args)
 
const char * enum_name (SolverStatus s)
 
std::ostream & operator<< (std::ostream &os, SolverStatus s)
 

Variables

constexpr size_t panoc_min_alloc_size = 10
 
constexpr real_t inf = std::numeric_limits<real_t>::infinity()
 \( \infty \) More...
 
constexpr real_t NaN = std::numeric_limits<real_t>::quiet_NaN()
 Not a number. More...
 
constexpr static auto dims
 

Class Documentation

◆ alpaqa::ALMParams

struct alpaqa::ALMParams
+ Collaboration diagram for ALMParams:
Class Members
real_t ε Primal tolerance.
real_t δ Dual tolerance.
real_t Δ Factor used in updating the penalty parameters.
real_t Δ_lower Factor to reduce ALMParams::Δ when inner convergence fails.
real_t Σ₀ Initial penalty parameter.

When set to zero (which is the default), it is computed automatically, based on the constraint violation in the starting point and the parameter ALMParams::σ₀.

real_t σ₀ Initial penalty parameter factor.

Active if ALMParams::Σ₀ is set to zero.

real_t Σ₀_lower Factor to reduce the initial penalty factor by if convergence fails in in the first iteration.
real_t ε₀ Initial primal tolerance.
real_t ε₀_increase Factor to increase the initial primal tolerance if convergence fails in the first iteration.
real_t ρ Update factor for primal tolerance.
real_t ρ_increase Factor to increase the primal tolerance update factor by if convergence fails.
real_t θ Error tolerance for penalty increase.
real_t M Lagrange multiplier bound.
real_t Σ_max Maximum penalty factor.
real_t Σ_min Minimum penalty factor (used during initialization).
unsigned int max_iter Maximum number of outer ALM iterations.
microseconds max_time Maximum duration.
unsigned max_num_initial_retries How many times can the initial penalty ALMParams::Σ₀ or ALMParams::σ₀ and the initial primal tolerance ALMParams::ε₀ be reduced.
unsigned max_num_retries How many times can the penalty update factor ALMParams::Δ and the primal tolerance factor ALMParams::ρ be reduced.
unsigned max_total_num_retries Combined limit for ALMParams::max_num_initial_retries and ALMParams::max_num_retries.
unsigned print_interval When to print progress.

If set to zero, nothing will be printed. If set to N != 0, progress is printed every N iterations.

bool preconditioning Apply preconditioning to the problem, based on the gradients in the starting point.
bool single_penalty_factor Use one penalty factor for all m constraints.

◆ alpaqa::Box

struct alpaqa::Box
+ Collaboration diagram for Box:
Class Members
vec upperbound
vec lowerbound

◆ alpaqa::GAAPGAParams

struct alpaqa::GAAPGAParams
+ Collaboration diagram for GAAPGAParams:
Class Members
LipschitzEstimateParams Lipschitz Parameters related to the Lipschitz constant estimate and step size.
unsigned limitedqr_mem Length of the history to keep in the limited-memory QR algorithm.
unsigned max_iter Maximum number of inner iterations.
microseconds max_time Maximum duration.
real_t L_min Minimum Lipschitz constant estimate.
real_t L_max Maximum Lipschitz constant estimate.
PANOCStopCrit stop_crit What stopping criterion to use.
unsigned print_interval When to print progress.

If set to zero, nothing will be printed. If set to N != 0, progress is printed every N iterations.

real_t quadratic_upperbound_tolerance_factor
unsigned max_no_progress Maximum number of iterations without any progress before giving up.
bool full_flush_on_γ_change

◆ alpaqa::GAAPGAProgressInfo

struct alpaqa::GAAPGAProgressInfo
+ Collaboration diagram for GAAPGAProgressInfo:
Class Members
unsigned k
crvec x
crvec p
real_t norm_sq_p
crvec x_hat
real_t ψ
crvec grad_ψ
real_t ψ_hat
crvec grad_ψ_hat
real_t L
real_t γ
real_t ε
crvec Σ
crvec y
const Problem & problem
const GAAPGAParams & params

◆ alpaqa::InnerStatsAccumulator

struct alpaqa::InnerStatsAccumulator
+ Collaboration diagram for InnerStatsAccumulator< InnerSolverStats >:

◆ alpaqa::InnerStatsAccumulator< GAAPGASolver::Stats >

struct alpaqa::InnerStatsAccumulator< GAAPGASolver::Stats >
+ Collaboration diagram for InnerStatsAccumulator< GAAPGASolver::Stats >:
Class Members
microseconds elapsed_time
unsigned iterations
unsigned accelerated_steps_accepted

◆ alpaqa::InnerStatsAccumulator< LBFGSBStats >

struct alpaqa::InnerStatsAccumulator< LBFGSBStats >
+ Collaboration diagram for InnerStatsAccumulator< LBFGSBStats >:
Class Members
microseconds elapsed_time
unsigned iterations

◆ alpaqa::InnerStatsAccumulator< PANOCStats >

struct alpaqa::InnerStatsAccumulator< PANOCStats >
+ Collaboration diagram for InnerStatsAccumulator< PANOCStats >:
Class Members
microseconds elapsed_time
unsigned iterations
unsigned linesearch_failures
unsigned lbfgs_failures
unsigned lbfgs_rejected
unsigned τ_1_accepted
unsigned count_τ
real_t sum_τ

◆ alpaqa::InnerStatsAccumulator< PGASolver::Stats >

struct alpaqa::InnerStatsAccumulator< PGASolver::Stats >
+ Collaboration diagram for InnerStatsAccumulator< PGASolver::Stats >:
Class Members
microseconds elapsed_time
unsigned iterations

◆ alpaqa::InnerStatsAccumulator< SecondOrderPANOCSolver::Stats >

struct alpaqa::InnerStatsAccumulator< SecondOrderPANOCSolver::Stats >
+ Collaboration diagram for InnerStatsAccumulator< SecondOrderPANOCSolver::Stats >:
Class Members
microseconds elapsed_time
unsigned iterations
unsigned newton_failures
unsigned linesearch_failures
unsigned τ_1_accepted
unsigned count_τ
real_t sum_τ

◆ alpaqa::InnerStatsAccumulator< StructuredPANOCLBFGSStats >

struct alpaqa::InnerStatsAccumulator< StructuredPANOCLBFGSStats >
+ Collaboration diagram for InnerStatsAccumulator< StructuredPANOCLBFGSStats >:
Class Members
microseconds elapsed_time Total elapsed time in the inner solver.
unsigned iterations Total number of inner PANOC iterations.
unsigned linesearch_failures Total number of PANOC line search failures.
unsigned lbfgs_failures Total number of times that the L-BFGS direction was not finite.
unsigned lbfgs_rejected Total number of times that the L-BFGS update was rejected (i.e.

it could have resulted in a non-positive definite Hessian estimate).

unsigned τ_1_accepted Total number of times that a line search parameter of \( \tau = 1 \) was accepted (i.e.

no backtracking necessary).

unsigned count_τ The total number of line searches performed (used for computing the average value of \( \tau \)).
real_t sum_τ The sum of the line search parameter \( \tau \) in all iterations (used for computing the average value of \( \tau \)).

◆ alpaqa::LBFGSBStats

struct alpaqa::LBFGSBStats
+ Collaboration diagram for LBFGSBStats:
Class Members
SolverStatus status
real_t ε
microseconds elapsed_time
unsigned iterations

◆ alpaqa::LBFGSParams

struct alpaqa::LBFGSParams
+ Collaboration diagram for LBFGSParams:
Class Members
unsigned memory Length of the history to keep.
struct LBFGSParams.cbfgs cbfgs Parameters in the cautious BFGS update condition.

\[ \frac{y^\top s}{s^\top s} \ge \epsilon \| g \|^\alpha \]

See also
https://epubs.siam.org/doi/10.1137/S1052623499354242
bool rescale_when_γ_changes

◆ alpaqa::LBFGSParams.cbfgs

struct alpaqa::LBFGSParams.cbfgs
+ Collaboration diagram for LBFGSParams.cbfgs:
Class Members
real_t α
real_t ϵ

◆ alpaqa::LipschitzEstimateParams

struct alpaqa::LipschitzEstimateParams
+ Collaboration diagram for LipschitzEstimateParams:
Class Members
real_t L₀ Initial estimate of the Lipschitz constant of ∇ψ(x)
real_t ε Relative step size for initial finite difference Lipschitz estimate.
real_t δ Minimum step size for initial finite difference Lipschitz estimate.
real_t Lγ_factor Factor that relates step size γ and Lipschitz constant.

◆ alpaqa::PANOCParams

struct alpaqa::PANOCParams
+ Collaboration diagram for PANOCParams:
Class Members
LipschitzEstimateParams Lipschitz Parameters related to the Lipschitz constant estimate and step size.
unsigned max_iter Maximum number of inner PANOC iterations.
microseconds max_time Maximum duration.
real_t τ_min Minimum weight factor between Newton step and projected gradient step.
real_t L_min Minimum Lipschitz constant estimate.
real_t L_max Maximum Lipschitz constant estimate.
PANOCStopCrit stop_crit What stopping criterion to use.
unsigned max_no_progress Maximum number of iterations without any progress before giving up.
unsigned print_interval When to print progress.

If set to zero, nothing will be printed. If set to N != 0, progress is printed every N iterations.

real_t quadratic_upperbound_tolerance_factor
bool update_lipschitz_in_linesearch
bool alternative_linesearch_cond
LBFGSStepSize lbfgs_stepsize

◆ alpaqa::PANOCProgressInfo

struct alpaqa::PANOCProgressInfo
+ Collaboration diagram for PANOCProgressInfo:
Class Members
unsigned k
crvec x
crvec p
real_t norm_sq_p
crvec x_hat
real_t φγ
real_t ψ
crvec grad_ψ
real_t ψ_hat
crvec grad_ψ_hat
real_t L
real_t γ
real_t τ
real_t ε
crvec Σ
crvec y
const Problem & problem
const PANOCParams & params

◆ alpaqa::PANOCStats

struct alpaqa::PANOCStats
+ Collaboration diagram for PANOCStats:
Class Members
SolverStatus status
real_t ε
microseconds elapsed_time
unsigned iterations
unsigned linesearch_failures
unsigned lbfgs_failures
unsigned lbfgs_rejected
unsigned τ_1_accepted
unsigned count_τ
real_t sum_τ

◆ alpaqa::PGAParams

struct alpaqa::PGAParams
+ Collaboration diagram for PGAParams:
Class Members
LipschitzEstimateParams Lipschitz Parameters related to the Lipschitz constant estimate and step size.
unsigned max_iter Maximum number of inner iterations.
microseconds max_time Maximum duration.
real_t L_min Minimum Lipschitz constant estimate.
real_t L_max Maximum Lipschitz constant estimate.
PANOCStopCrit stop_crit What stop criterion to use.
unsigned print_interval When to print progress.

If set to zero, nothing will be printed. If set to N != 0, progress is printed every N iterations.

real_t quadratic_upperbound_tolerance_factor

◆ alpaqa::PGAProgressInfo

struct alpaqa::PGAProgressInfo
+ Collaboration diagram for PGAProgressInfo:
Class Members
unsigned k
crvec x
crvec p
real_t norm_sq_p
crvec x_hat
real_t ψ
crvec grad_ψ
real_t ψ_hat
crvec grad_ψ_hat
real_t L
real_t γ
real_t ε
crvec Σ
crvec y
const Problem & problem
const PGAParams & params

◆ alpaqa::SecondOrderPANOCParams

struct alpaqa::SecondOrderPANOCParams
+ Collaboration diagram for SecondOrderPANOCParams:
Class Members
LipschitzEstimateParams Lipschitz Parameters related to the Lipschitz constant estimate and step size.
unsigned max_iter Maximum number of inner PANOC iterations.
microseconds max_time Maximum duration.
real_t τ_min Minimum weight factor between Newton step and projected gradient step.
real_t L_min Minimum Lipschitz constant estimate.
real_t L_max Maximum Lipschitz constant estimate.
PANOCStopCrit stop_crit What stopping criterion to use.
unsigned max_no_progress Maximum number of iterations without any progress before giving up.
unsigned print_interval When to print progress.

If set to zero, nothing will be printed. If set to N != 0, progress is printed every N iterations.

real_t quadratic_upperbound_tolerance_factor
bool update_lipschitz_in_linesearch
bool alternative_linesearch_cond

◆ alpaqa::StructuredPANOCLBFGSParams

struct alpaqa::StructuredPANOCLBFGSParams
+ Collaboration diagram for StructuredPANOCLBFGSParams:
Class Members
LipschitzEstimateParams Lipschitz Parameters related to the Lipschitz constant estimate and step size.
unsigned max_iter Maximum number of inner PANOC iterations.
microseconds max_time Maximum duration.
real_t τ_min Minimum weight factor between Newton step and projected gradient step.
real_t L_min Minimum Lipschitz constant estimate.
real_t L_max Maximum Lipschitz constant estimate.
real_t nonmonotone_linesearch Factor used in update for exponentially weighted nonmonotone line search.

Zero means monotone line search.

PANOCStopCrit stop_crit What stopping criterion to use.
unsigned max_no_progress Maximum number of iterations without any progress before giving up.
unsigned print_interval When to print progress.

If set to zero, nothing will be printed. If set to N != 0, progress is printed every N iterations.

real_t quadratic_upperbound_tolerance_factor
bool update_lipschitz_in_linesearch
bool alternative_linesearch_cond
bool hessian_vec
bool hessian_vec_finite_differences
bool full_augmented_hessian
unsigned hessian_step_size_heuristic
LBFGSStepSize lbfgs_stepsize

◆ alpaqa::StructuredPANOCLBFGSProgressInfo

struct alpaqa::StructuredPANOCLBFGSProgressInfo
+ Collaboration diagram for StructuredPANOCLBFGSProgressInfo:
Class Members
unsigned k
crvec x
crvec p
real_t norm_sq_p
crvec x_hat
real_t φγ
real_t ψ
crvec grad_ψ
real_t ψ_hat
crvec grad_ψ_hat
real_t L
real_t γ
real_t τ
real_t ε
crvec Σ
crvec y
const Problem & problem
const StructuredPANOCLBFGSParams & params

◆ alpaqa::StructuredPANOCLBFGSStats

struct alpaqa::StructuredPANOCLBFGSStats
+ Collaboration diagram for StructuredPANOCLBFGSStats:
Class Members
SolverStatus status
real_t ε
microseconds elapsed_time
unsigned iterations
unsigned linesearch_failures
unsigned lbfgs_failures
unsigned lbfgs_rejected
unsigned τ_1_accepted
unsigned count_τ
real_t sum_τ

Typedef Documentation

◆ PolymorphicPGASolver

Definition at line 373 of file polymorphic-inner-solver.hpp.

◆ PolymorphicGAAPGASolver

Definition at line 374 of file polymorphic-inner-solver.hpp.

◆ PolymorphicPANOCSolver

Definition at line 375 of file polymorphic-inner-solver.hpp.

◆ PolymorphicStructuredPANOCLBFGSSolver

Definition at line 377 of file polymorphic-inner-solver.hpp.

◆ PolymorphicALMSolver

Definition at line 380 of file polymorphic-inner-solver.hpp.

◆ PolymorphicLBFGSDirection

Definition at line 128 of file polymorphic-panoc-direction.hpp.

◆ real_t

using real_t = double

Default floating point type.

Definition at line 8 of file vec.hpp.

◆ realvec

using realvec = Eigen::Matrix<real_t, Eigen::Dynamic, 1>

Default type for floating point vectors.

Definition at line 10 of file vec.hpp.

◆ realmat

using realmat = Eigen::Matrix<real_t, Eigen::Dynamic, Eigen::Dynamic>

Default type for floating point matrices.

Definition at line 12 of file vec.hpp.

◆ vec

using vec = realvec

Default type for vectors.

Examples
CUTEst/Rosenbrock/main.cpp, and CasADi/Rosenbrock/main.cpp.

Definition at line 14 of file vec.hpp.

◆ rvec

using rvec = Eigen::Ref<vec>

Default type for mutable references to vectors.

Definition at line 16 of file vec.hpp.

◆ crvec

using crvec = Eigen::Ref<const vec>

Default type for immutable references to vectors.

Definition at line 18 of file vec.hpp.

◆ mat

using mat = realmat

Default type for matrices.

Definition at line 20 of file vec.hpp.

◆ rmat

using rmat = Eigen::Ref<mat>

Default type for mutable references to matrices.

Definition at line 22 of file vec.hpp.

◆ crmat

using crmat = Eigen::Ref<const mat>

Default type for immutable references to matrices.

Definition at line 24 of file vec.hpp.

◆ dim

using dim = std::pair<casadi_int, casadi_int>

Definition at line 86 of file CasADiLoader.cpp.

Enumeration Type Documentation

◆ LBFGSStepSize

enum class LBFGSStepSize
strong

Which method to use to select the L-BFGS step size.

Enumerator
BasedOnGradientStepSize 
BasedOnCurvature 

Definition at line 6 of file lbfgs-stepsize.hpp.

◆ PANOCStopCrit

enum class PANOCStopCrit
strong
Enumerator
ApproxKKT 

Find an ε-approximate KKT point in the ∞-norm:

\[ \varepsilon = \left\| \gamma_k^{-1} (x^k - \hat x^k) + \nabla \psi(\hat x^k) - \nabla \psi(x^k) \right\|_\infty \]

ApproxKKT2 

Find an ε-approximate KKT point in the 2-norm:

\[ \varepsilon = \left\| \gamma_k^{-1} (x^k - \hat x^k) + \nabla \psi(\hat x^k) - \nabla \psi(x^k) \right\|_2 \]

ProjGradNorm 

∞-norm of the projected gradient with step size γ:

\[ \varepsilon = \left\| x^k - \Pi_C\left(x^k - \gamma_k \nabla \psi(x^k)\right) \right\|_\infty \]

ProjGradNorm2 

2-norm of the projected gradient with step size γ:

\[ \varepsilon = \left\| x^k - \Pi_C\left(x^k - \gamma_k \nabla \psi(x^k)\right) \right\|_2 \]

This is the same criterion as used by OpEn.

ProjGradUnitNorm 

∞-norm of the projected gradient with unit step size:

\[ \varepsilon = \left\| x^k - \Pi_C\left(x^k - \nabla \psi(x^k)\right) \right\|_\infty \]

ProjGradUnitNorm2 

2-norm of the projected gradient with unit step size:

\[ \varepsilon = \left\| x^k - \Pi_C\left(x^k - \nabla \psi(x^k)\right) \right\|_2 \]

FPRNorm 

∞-norm of fixed point residual:

\[ \varepsilon = \gamma_k^{-1} \left\| x^k - \Pi_C\left(x^k - \gamma_k \nabla \psi(x^k)\right) \right\|_\infty \]

FPRNorm2 

2-norm of fixed point residual:

\[ \varepsilon = \gamma_k^{-1} \left\| x^k - \Pi_C\left(x^k - \gamma_k \nabla \psi(x^k)\right) \right\|_2 \]

Ipopt 

The stopping criterion used by Ipopt, see https://link.springer.com/article/10.1007/s10107-004-0559-y equation (5).

Given a candidate iterate \( \hat x^k \) and the corresponding candidate Lagrange multipliers \( \hat y^k \) for the general constraints \( g(x)\in D \), the multipliers \( w \) for the box constraints \( x\in C \) (that are otherwise not computed explicitly) are given by

\[ w^k = v^k - \Pi_C(v^k), \]

where

\[ \begin{aligned} v^k &\triangleq \hat x^k - \nabla f(\hat x^k) - \nabla g(\hat x^k)\, \hat y^k \\ &= \hat x^k - \nabla \psi(\hat x^k) \end{aligned} \]

The quantity that is compared to the (scaled) tolerance is then given by

\[ \begin{aligned} \varepsilon' &= \left\| \nabla f(\hat x^k) + \nabla g(\hat x^k)\, \hat y^k + w^k \right\|_\infty \\ &= \left\| \hat x^k - \Pi_C\left(v^k\right) \right\|_\infty \end{aligned} \]

Finally, the quantity is scaled by the factor

\[ s_d \triangleq \max\left\{ s_\text{max},\;\frac{\|\hat y^k\|_1 + \|w^k\|_1}{2m + 2n} \right\} / s_\text{max}, \]

i.e. \( \varepsilon = \varepsilon' / s_d \).

Definition at line 8 of file panoc-stop-crit.hpp.

◆ SolverStatus

enum class SolverStatus
strong

Exit status of a numerical solver such as ALM or PANOC.

Enumerator
Unknown 

Initial value.

Converged 

Converged and reached given tolerance.

MaxTime 

Maximum allowed execution time exceeded.

MaxIter 

Maximum number of iterations exceeded.

NotFinite 

Intermediate results were infinite or not-a-number.

NoProgress 

No progress was made in the last iteration.

Interrupted 

Solver was interrupted by the user.

Definition at line 7 of file solverstatus.hpp.

Function Documentation

◆ InnerSolverCallWrapper()

auto alpaqa::InnerSolverCallWrapper ( )

Definition at line 20 of file polymorphic-inner-solver.hpp.

+ Here is the caller graph for this function:

◆ operator+=() [1/9]

Definition at line 152 of file polymorphic-inner-solver.hpp.

◆ stats_to_dict() [1/9]

py::dict alpaqa::stats_to_dict ( const PANOCStats s)
inline

Definition at line 192 of file polymorphic-inner-solver.hpp.

+ Here is the caller graph for this function:

◆ stats_to_dict() [2/9]

py::dict alpaqa::stats_to_dict ( const InnerStatsAccumulator< PANOCStats > &  s)
inline

Definition at line 208 of file polymorphic-inner-solver.hpp.

◆ stats_to_dict() [3/9]

py::dict alpaqa::stats_to_dict ( const StructuredPANOCLBFGSSolver::Stats s)
inline

Definition at line 222 of file polymorphic-inner-solver.hpp.

◆ stats_to_dict() [4/9]

py::dict alpaqa::stats_to_dict ( const PGASolver::Stats s)
inline

Definition at line 238 of file polymorphic-inner-solver.hpp.

◆ stats_to_dict() [5/9]

py::dict alpaqa::stats_to_dict ( const GAAPGASolver::Stats s)
inline

Definition at line 248 of file polymorphic-inner-solver.hpp.

◆ stats_to_dict() [6/9]

py::dict alpaqa::stats_to_dict ( const InnerStatsAccumulator< StructuredPANOCLBFGSSolver::Stats > &  s)
inline

Definition at line 259 of file polymorphic-inner-solver.hpp.

◆ stats_to_dict() [7/9]

py::dict alpaqa::stats_to_dict ( const InnerStatsAccumulator< PGASolver::Stats > &  s)
inline

Definition at line 275 of file polymorphic-inner-solver.hpp.

◆ stats_to_dict() [8/9]

py::dict alpaqa::stats_to_dict ( const InnerStatsAccumulator< GAAPGASolver::Stats > &  s)
inline

Definition at line 284 of file polymorphic-inner-solver.hpp.

◆ stats_to_dict() [9/9]

py::dict alpaqa::stats_to_dict ( const PolymorphicALMSolver::Stats s)
inline

Definition at line 382 of file polymorphic-inner-solver.hpp.

◆ enum_name() [1/2]

const char * alpaqa::enum_name ( PANOCStopCrit  s)
inline

Definition at line 96 of file panoc-stop-crit.hpp.

+ Here is the caller graph for this function:

◆ operator<<() [1/2]

std::ostream & alpaqa::operator<< ( std::ostream &  os,
PANOCStopCrit  s 
)
inline

Definition at line 111 of file panoc-stop-crit.hpp.

+ Here is the call graph for this function:

◆ operator+=() [2/9]

InnerStatsAccumulator< PANOCStats > & alpaqa::operator+= ( InnerStatsAccumulator< PANOCStats > &  acc,
const PANOCStats s 
)
inline

Definition at line 147 of file inner/decl/panoc.hpp.

◆ operator+=() [3/9]

Definition at line 127 of file decl/second-order-panoc.hpp.

◆ operator+=() [4/9]

Definition at line 162 of file decl/structured-panoc-lbfgs.hpp.

◆ minimize_update_anderson()

void alpaqa::minimize_update_anderson ( LimitedMemoryQR qr,
rmat  G,
crvec  rₖ,
crvec  rₖ₋₁,
crvec  gₖ,
rvec  γ_LS,
rvec  xₖ_aa 
)
inline

Solve one step of Anderson acceleration to find a fixed point of a function g(x):

\( g(x^\star) - x^\star = 0 \)

Updates the QR factorization of \( \mathcal{R}_k = QR \), solves the least squares problem to find \( \gamma_\text{LS} \), computes the next iterate \( x_{k+1} \), and stores the current function value \( g_k \) in the matrix \( G \), which is used as a circular buffer.

\[ \begin{aligned} \mathcal{R}_k &= \begin{pmatrix} \Delta r_{k-m_k} & \dots & \Delta r_{k-1} \end{pmatrix} \in \mathbb{R}^{n\times m_k} \\ \Delta r_i &= r_{i+1} - r_i \\ r_i &= g_i - x_i \\ g_i &= g(x_i) \\ \DeclareMathOperator*{\argmin}{argmin} \gamma_\text{LS} &= \argmin_\gamma \left\| \mathcal{R}_k \gamma - r_k \right\|_2 \\ \alpha_i &= \begin{cases} \gamma_\text{LS}[0] & i = 0 \\ \gamma_\text{LS}[i] - \gamma_\text{LS}[i-1] & 0 < i < m_k \\ 1 - \gamma_\text{LS}[m_k - 1] & i = m_k \end{cases} \\ x_{k+1} &= \sum_{i=0}^{m_k} \alpha_i\,g_i \end{aligned} \]

Definition at line 30 of file anderson-helpers.hpp.

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

◆ operator+=() [5/9]

InnerStatsAccumulator< GAAPGASolver::Stats > & alpaqa::operator+= ( InnerStatsAccumulator< GAAPGASolver::Stats > &  acc,
const GAAPGASolver::Stats s 
)
inline

Definition at line 361 of file guarded-aa-pga.hpp.

◆ operator+=() [6/9]

InnerStatsAccumulator< LBFGSBStats > & alpaqa::operator+= ( InnerStatsAccumulator< LBFGSBStats > &  acc,
const LBFGSBStats s 
)
inline

Definition at line 193 of file lbfgspp.hpp.

◆ operator+=() [7/9]

InnerStatsAccumulator< PGASolver::Stats > & alpaqa::operator+= ( InnerStatsAccumulator< PGASolver::Stats > &  acc,
const PGASolver::Stats s 
)
inline

Definition at line 283 of file pga.hpp.

◆ panoc_impl()

PANOCStats alpaqa::panoc_impl ( ObjFunT &  ψ,
ObjGradFunT &  grad_ψ,
const Box C,
rvec  x,
real_t  ε,
const PANOCParams params,
vec_allocator alloc,
DirectionT &  direction_provider 
)
inline

Definition at line 157 of file standalone/panoc.hpp.

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

◆ panoc() [1/2]

PANOCStats alpaqa::panoc ( ObjFunT &  ψ,
ObjGradFunT &  grad_ψ,
const Box C,
rvec  x,
real_t  ε,
const PANOCParams params,
PANOCDirection< DirectionProviderT >  direction,
vec_allocator alloc 
)

Definition at line 370 of file standalone/panoc.hpp.

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

◆ panoc() [2/2]

PANOCStats alpaqa::panoc ( ObjFunT &  ψ,
ObjGradFunT &  grad_ψ,
const Box C,
rvec  x,
real_t  ε,
const PANOCParams params,
PANOCDirection< DirectionProviderT >  direction 
)

Definition at line 385 of file standalone/panoc.hpp.

+ Here is the call graph for this function:

◆ project()

auto alpaqa::project ( const Vec &  v,
const Box box 
)
inline

Project a vector onto a box.

\[ \Pi_C(v) \]

Parameters
[in]vThe vector to project
[in]boxThe box to project onto

Definition at line 15 of file box.hpp.

+ Here is the caller graph for this function:

◆ projecting_difference()

auto alpaqa::projecting_difference ( const Vec &  v,
const Box box 
)
inline

Get the difference between the given vector and its projection.

\[ v - \Pi_C(v) \]

Warning
Beware catastrophic cancellation!
Parameters
[in]vThe vector to project
[in]boxThe box to project onto

Definition at line 28 of file box.hpp.

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

◆ dist_squared() [1/2]

real_t alpaqa::dist_squared ( crvec  v,
const Box box 
)
inline

Get the distance squared between the given vector and its projection.

\[ \left\| v - \Pi_C(v) \right\|_2^2 \]

Warning
Beware catastrophic cancellation!
Parameters
[in]vThe vector to project
[in]boxThe box to project onto

Definition at line 37 of file box.hpp.

+ Here is the call graph for this function:

◆ dist_squared() [2/2]

real_t alpaqa::dist_squared ( crvec  v,
const Box box,
crvec  Σ 
)
inline

Get the distance squared between the given vector and its projection in the Σ norm.

\[ \left\| v - \Pi_C(v) \right\|_\Sigma^2 = \left(v - \Pi_C(v)\right)^\top \Sigma \left(v - \Pi_C(v)\right) \]

Warning
Beware catastrophic cancellation!
Parameters
[in]vThe vector to project
[in]boxThe box to project onto
[in]ΣDiagonal matrix defining norm

Definition at line 48 of file box.hpp.

+ Here is the call graph for this function:

◆ operator+=() [8/9]

EvalCounter & alpaqa::operator+= ( EvalCounter a,
const EvalCounter b 
)
inline

Definition at line 191 of file include/alpaqa/util/problem.hpp.

◆ operator+=() [9/9]

EvalCounter::EvalTimer & alpaqa::operator+= ( EvalCounter::EvalTimer a,
const EvalCounter::EvalTimer b 
)
inline

Definition at line 202 of file include/alpaqa/util/problem.hpp.

◆ operator+()

EvalCounter alpaqa::operator+ ( EvalCounter  a,
const EvalCounter b 
)
inline

Definition at line 214 of file include/alpaqa/util/problem.hpp.

◆ wrap_load()

auto alpaqa::wrap_load ( const std::string &  so_name,
const char *  name,
f 
)

Definition at line 66 of file CasADiLoader.cpp.

+ Here is the caller graph for this function:

◆ wrapped_load()

auto alpaqa::wrapped_load ( const std::string &  so_name,
const char *  name,
Args &&...  args 
)

Definition at line 76 of file CasADiLoader.cpp.

+ Here is the call graph for this function:

◆ enum_name() [2/2]

const char * alpaqa::enum_name ( SolverStatus  s)

Definition at line 8 of file solverstatus.cpp.

◆ operator<<() [2/2]

std::ostream & alpaqa::operator<< ( std::ostream &  os,
SolverStatus  s 
)

Definition at line 22 of file solverstatus.cpp.

+ Here is the call graph for this function:

Variable Documentation

◆ panoc_min_alloc_size

constexpr size_t panoc_min_alloc_size = 10
constexpr

Definition at line 154 of file standalone/panoc.hpp.

◆ inf

constexpr real_t inf = std::numeric_limits<real_t>::infinity()
constexpr

\( \infty \)

Examples
CasADi/Rosenbrock/main.cpp.

Definition at line 26 of file vec.hpp.

◆ NaN

constexpr real_t NaN = std::numeric_limits<real_t>::quiet_NaN()
constexpr

Not a number.

Definition at line 28 of file vec.hpp.

◆ dims

constexpr static auto dims
staticconstexpr
Initial value:
= [](auto... a) {
return std::array<casadi_int, sizeof...(a)>{a...};
}

Definition at line 83 of file CasADiLoader.cpp.