proxsuite 0.6.7
The Advanced Proximal Optimization Toolbox
Loading...
Searching...
No Matches
proxsuite::proxqp::sparse Namespace Reference

Namespaces

namespace  detail
 
namespace  preconditioner
 

Classes

struct  BatchQP
 
struct  Ldlt
 
struct  Model
 This class stores the model of the QP problem. More...
 
struct  PrimalDualGradResult
 
struct  QP
 This class defines the API of PROXQP solver with sparse backend. More...
 
struct  QpView
 
struct  QpViewMut
 
struct  SparseModel
 
struct  Workspace
 This class defines the workspace of the sparse solver. More...
 

Typedefs

template<typename T >
using DMat = Eigen::Matrix<T, -1, -1>
 
template<typename T , typename I >
using SparseMat = Eigen::SparseMatrix<T, Eigen::ColMajor, I>
 
template<typename T >
using VecRef = Eigen::Ref<Eigen::Matrix<T, DYN, 1> const>
 
template<typename T >
using MatRef = Eigen::Ref<Eigen::Matrix<T, DYN, DYN> const>
 
template<typename T >
using Vec = Eigen::Matrix<T, DYN, 1>
 
template<typename T , typename I >
using Mat = Eigen::SparseMatrix<T, Eigen::ColMajor, I>
 
using VecBool = Eigen::Matrix<bool, DYN, 1>
 

Enumerations

enum  { layout = Eigen::RowMajor }
 

Functions

template<typename T , typename I >
void solve_in_parallel (proxqp::sparse::BatchQP< T, I > &qps, const optional< size_t > num_threads=nullopt)
 
template<typename T , typename I >
void solve_in_parallel (std::vector< proxqp::sparse::QP< T, I > > &qps, const optional< size_t > num_threads=nullopt)
 
template<typename T , typename I >
power_iteration (SparseMat< T, I > &H, sparse::Vec< T > &dw, sparse::Vec< T > &rhs, sparse::Vec< T > &err_v, T power_iteration_accuracy, isize nb_power_iteration)
 
template<typename T , typename I >
min_eigen_value_via_modified_power_iteration (SparseMat< T, I > &H, sparse::Vec< T > &dw, sparse::Vec< T > &rhs, sparse::Vec< T > &err_v, T max_eigen_value, T power_iteration_accuracy, isize nb_power_iteration)
 
template<typename T , typename I >
estimate_minimal_eigen_value_of_symmetric_matrix (SparseMat< T, I > &H, T power_iteration_accuracy, isize nb_power_iteration)
 
template<typename T >
void update_default_rho_with_minimal_Hessian_eigen_value (optional< T > manual_minimal_H_eigenvalue, Results< T > &results, Settings< T > &settings)
 
template<typename T , typename I >
void update_proximal_parameters (Settings< T > &settings, Results< T > &results, Workspace< T, I > &work, optional< T > rho_new, optional< T > mu_eq_new, optional< T > mu_in_new)
 
template<typename T , typename I >
void warm_start (optional< VecRef< T > > x_wm, optional< VecRef< T > > y_wm, optional< VecRef< T > > z_wm, Results< T > &results, Settings< T > &settings, Model< T, I > &model)
 
template<typename T , typename I , typename P >
void qp_setup (QpView< T, I > qp, Results< T > &results, Model< T, I > &data, Workspace< T, I > &work, Settings< T > &settings, P &precond, PreconditionerStatus &preconditioner_status)
 
template<typename T , typename I >
auto have_same_structure (proxsuite::linalg::sparse::MatRef< T, I > a, proxsuite::linalg::sparse::MatRef< T, I > b) -> bool
 
template<typename T , typename I >
void copy (proxsuite::linalg::sparse::MatMut< T, I > a, proxsuite::linalg::sparse::MatRef< T, I > b)
 
template<typename T , typename I >
void ldl_solve (VectorViewMut< T > sol, VectorView< T > rhs, isize n_tot, proxsuite::linalg::sparse::MatMut< T, I > ldl, Eigen::MINRES< detail::AugmentedKkt< T, I >, Eigen::Upper|Eigen::Lower, Eigen::IdentityPreconditioner > &iterative_solver, bool do_ldlt, proxsuite::linalg::veg::dynstack::DynStackMut stack, T *ldl_values, I *perm, I *ldl_col_ptrs, I const *perm_inv)
 
template<typename T , typename I >
void ldl_iter_solve_noalias (VectorViewMut< T > sol, VectorView< T > rhs, VectorView< T > init_guess, Results< T > const &results, Model< T, I > const &data, isize n_tot, proxsuite::linalg::sparse::MatMut< T, I > ldl, Eigen::MINRES< detail::AugmentedKkt< T, I >, Eigen::Upper|Eigen::Lower, Eigen::IdentityPreconditioner > &iterative_solver, bool do_ldlt, proxsuite::linalg::veg::dynstack::DynStackMut stack, T *ldl_values, I *perm, I *ldl_col_ptrs, I const *perm_inv, Settings< T > const &settings, proxsuite::linalg::sparse::MatMut< T, I > kkt_active, proxsuite::linalg::veg::SliceMut< bool > active_constraints)
 
template<typename T , typename I >
void ldl_solve_in_place (VectorViewMut< T > rhs, VectorView< T > init_guess, Results< T > const &results, Model< T, I > const &data, isize n_tot, proxsuite::linalg::sparse::MatMut< T, I > ldl, Eigen::MINRES< detail::AugmentedKkt< T, I >, Eigen::Upper|Eigen::Lower, Eigen::IdentityPreconditioner > &iterative_solver, bool do_ldlt, proxsuite::linalg::veg::dynstack::DynStackMut stack, T *ldl_values, I *perm, I *ldl_col_ptrs, I const *perm_inv, Settings< T > const &settings, proxsuite::linalg::sparse::MatMut< T, I > kkt_active, proxsuite::linalg::veg::SliceMut< bool > active_constraints)
 
template<typename T , typename I >
auto inner_reconstructed_matrix (proxsuite::linalg::sparse::MatMut< T, I > ldl) -> DMat< T >
 
template<typename T , typename I >
auto reconstructed_matrix (proxsuite::linalg::sparse::MatMut< T, I > ldl, I const *perm_inv, isize n_tot) -> DMat< T >
 
template<typename T , typename I >
auto reconstruction_error (proxsuite::linalg::sparse::MatMut< T, I > ldl, I const *perm_inv, Results< T > const &results, Model< T, I > const &data, isize n_tot, proxsuite::linalg::sparse::MatMut< T, I > kkt_active, proxsuite::linalg::veg::SliceMut< bool > active_constraints) -> DMat< T >
 
template<typename T , typename I , typename P >
void qp_solve (Results< T > &results, Model< T, I > &data, const Settings< T > &settings, Workspace< T, I > &work, P &precond)
 
template<typename T , typename I >
void print_setup_header (const Settings< T > &settings, Results< T > &results, const Model< T, I > &model)
 
template<typename T , typename I >
void refactorize (Workspace< T, I > &work, Results< T > const &results, Settings< T > const &settings, proxsuite::linalg::sparse::MatMut< T, I > kkt_active, proxsuite::linalg::veg::SliceMut< bool > active_constraints, Model< T, I > const &data, proxsuite::linalg::veg::dynstack::DynStackMut stack, proxsuite::linalg::veg::Tag< T > &xtag)
 
template<typename T , typename I >
proxqp::Results< T > solve (optional< SparseMat< T, I > > H, optional< VecRef< T > > g, optional< SparseMat< T, I > > A, optional< VecRef< T > > b, optional< SparseMat< T, I > > C, optional< VecRef< T > > l, optional< VecRef< T > > u, optional< VecRef< T > > x=nullopt, optional< VecRef< T > > y=nullopt, optional< VecRef< T > > z=nullopt, optional< T > eps_abs=nullopt, optional< T > eps_rel=nullopt, optional< T > rho=nullopt, optional< T > mu_eq=nullopt, optional< T > mu_in=nullopt, optional< bool > verbose=nullopt, bool compute_preconditioner=true, bool compute_timings=false, optional< isize > max_iter=nullopt, proxsuite::proxqp::InitialGuessStatus initial_guess=proxsuite::proxqp::InitialGuessStatus::EQUALITY_CONSTRAINED_INITIAL_GUESS, proxsuite::proxqp::SparseBackend sparse_backend=proxsuite::proxqp::SparseBackend::Automatic, bool check_duality_gap=false, optional< T > eps_duality_gap_abs=nullopt, optional< T > eps_duality_gap_rel=nullopt, bool primal_infeasibility_solving=false, optional< T > manual_minimal_H_eigenvalue=nullopt)
 

Variables

static constexpr auto DYN = Eigen::Dynamic
 

Typedef Documentation

◆ DMat

template<typename T >
using proxsuite::proxqp::sparse::DMat = Eigen::Matrix<T, -1, -1>

Definition at line 23 of file fwd.hpp.

◆ SparseMat

template<typename T , typename I >
using proxsuite::proxqp::sparse::SparseMat = Eigen::SparseMatrix<T, Eigen::ColMajor, I>

Definition at line 31 of file fwd.hpp.

◆ VecRef

template<typename T >
using proxsuite::proxqp::sparse::VecRef = Eigen::Ref<Eigen::Matrix<T, DYN, 1> const>

Definition at line 34 of file fwd.hpp.

◆ MatRef

template<typename T >
using proxsuite::proxqp::sparse::MatRef = Eigen::Ref<Eigen::Matrix<T, DYN, DYN> const>

Definition at line 36 of file fwd.hpp.

◆ Vec

template<typename T >
using proxsuite::proxqp::sparse::Vec = Eigen::Matrix<T, DYN, 1>

Definition at line 38 of file fwd.hpp.

◆ Mat

template<typename T , typename I >
using proxsuite::proxqp::sparse::Mat = Eigen::SparseMatrix<T, Eigen::ColMajor, I>

Definition at line 41 of file fwd.hpp.

◆ VecBool

using proxsuite::proxqp::sparse::VecBool = Eigen::Matrix<bool, DYN, 1>

Definition at line 43 of file fwd.hpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
layout 

Definition at line 26 of file fwd.hpp.

Function Documentation

◆ solve_in_parallel() [1/2]

template<typename T , typename I >
void proxsuite::proxqp::sparse::solve_in_parallel ( proxqp::sparse::BatchQP< T, I > & qps,
const optional< size_t > num_threads = nullopt )

Definition at line 144 of file qp_solve.hpp.

◆ solve_in_parallel() [2/2]

template<typename T , typename I >
void proxsuite::proxqp::sparse::solve_in_parallel ( std::vector< proxqp::sparse::QP< T, I > > & qps,
const optional< size_t > num_threads = nullopt )

Definition at line 166 of file qp_solve.hpp.

◆ power_iteration()

template<typename T , typename I >
T proxsuite::proxqp::sparse::power_iteration ( SparseMat< T, I > & H,
sparse::Vec< T > & dw,
sparse::Vec< T > & rhs,
sparse::Vec< T > & err_v,
T power_iteration_accuracy,
isize nb_power_iteration )

Definition at line 20 of file helpers.hpp.

◆ min_eigen_value_via_modified_power_iteration()

template<typename T , typename I >
T proxsuite::proxqp::sparse::min_eigen_value_via_modified_power_iteration ( SparseMat< T, I > & H,
sparse::Vec< T > & dw,
sparse::Vec< T > & rhs,
sparse::Vec< T > & err_v,
T max_eigen_value,
T power_iteration_accuracy,
isize nb_power_iteration )

Definition at line 60 of file helpers.hpp.

◆ estimate_minimal_eigen_value_of_symmetric_matrix()

template<typename T , typename I >
T proxsuite::proxqp::sparse::estimate_minimal_eigen_value_of_symmetric_matrix ( SparseMat< T, I > & H,
T power_iteration_accuracy,
isize nb_power_iteration )

Estimate minimal eigenvalue of a symmetric Matrix via power iteration

Parameters
Hsymmetric matrix.
power_iteration_accuracypower iteration algorithm accuracy tracked
nb_power_iterationmaximal number of power iteration executed

Definition at line 118 of file helpers.hpp.

◆ update_default_rho_with_minimal_Hessian_eigen_value()

template<typename T >
void proxsuite::proxqp::sparse::update_default_rho_with_minimal_Hessian_eigen_value ( optional< T > manual_minimal_H_eigenvalue,
Results< T > & results,
Settings< T > & settings )

Estimate H minimal eigenvalue

Parameters
settingssolver settings
resultssolver results.
manual_minimal_H_eigenvalueminimal H eigenvalue estimate.

Definition at line 159 of file helpers.hpp.

◆ update_proximal_parameters()

template<typename T , typename I >
void proxsuite::proxqp::sparse::update_proximal_parameters ( Settings< T > & settings,
Results< T > & results,
Workspace< T, I > & work,
optional< T > rho_new,
optional< T > mu_eq_new,
optional< T > mu_in_new )

Update the proximal parameters of the results object.

Parameters
rho_newprimal proximal parameter
mu_eq_newdual equality proximal parameter
mu_in_newdual inequality proximal parameter
resultssolver result

Definition at line 183 of file helpers.hpp.

◆ warm_start()

template<typename T , typename I >
void proxsuite::proxqp::sparse::warm_start ( optional< VecRef< T > > x_wm,
optional< VecRef< T > > y_wm,
optional< VecRef< T > > z_wm,
Results< T > & results,
Settings< T > & settings,
Model< T, I > & model )

Warm start the results primal and dual variables.

Parameters
x_wmprimal proximal parameter
y_wmdual equality proximal parameter
z_wmdual inequality proximal parameter
resultssolver result
settingssolver settings

Definition at line 219 of file helpers.hpp.

◆ qp_setup()

template<typename T , typename I , typename P >
void proxsuite::proxqp::sparse::qp_setup ( QpView< T, I > qp,
Results< T > & results,
Model< T, I > & data,
Workspace< T, I > & work,
Settings< T > & settings,
P & precond,
PreconditionerStatus & preconditioner_status )

Setups the QP solver model.

Parameters
qpview of the QP model.
worksolver workspace.
settingssolver settings.
datasolver model.
resultssolver result.
precondpreconditioner.
preconditioner_statusbool variable for deciding whether executing the preconditioning algorithm, or keeping previous preconditioning variables, or using the identity preconditioner (i.e., no preconditioner).

Definition at line 282 of file helpers.hpp.

◆ have_same_structure()

template<typename T , typename I >
auto proxsuite::proxqp::sparse::have_same_structure ( proxsuite::linalg::sparse::MatRef< T, I > a,
proxsuite::linalg::sparse::MatRef< T, I > b ) -> bool

Checks whether matrix b has the same sparsity structure as matrix a.

Parameters
amatrix.
bmatrix.

Definition at line 414 of file helpers.hpp.

◆ copy()

template<typename T , typename I >
void proxsuite::proxqp::sparse::copy ( proxsuite::linalg::sparse::MatMut< T, I > a,
proxsuite::linalg::sparse::MatRef< T, I > b )

Copies matrix b elements into matrix a.

Parameters
amatrix.
bmatrix.

Definition at line 443 of file helpers.hpp.

◆ ldl_solve()

template<typename T , typename I >
void proxsuite::proxqp::sparse::ldl_solve ( VectorViewMut< T > sol,
VectorView< T > rhs,
isize n_tot,
proxsuite::linalg::sparse::MatMut< T, I > ldl,
Eigen::MINRES< detail::AugmentedKkt< T, I >, Eigen::Upper|Eigen::Lower, Eigen::IdentityPreconditioner > & iterative_solver,
bool do_ldlt,
proxsuite::linalg::veg::dynstack::DynStackMut stack,
T * ldl_values,
I * perm,
I * ldl_col_ptrs,
I const * perm_inv )

Definition at line 40 of file solver.hpp.

◆ ldl_iter_solve_noalias()

template<typename T , typename I >
void proxsuite::proxqp::sparse::ldl_iter_solve_noalias ( VectorViewMut< T > sol,
VectorView< T > rhs,
VectorView< T > init_guess,
Results< T > const & results,
Model< T, I > const & data,
isize n_tot,
proxsuite::linalg::sparse::MatMut< T, I > ldl,
Eigen::MINRES< detail::AugmentedKkt< T, I >, Eigen::Upper|Eigen::Lower, Eigen::IdentityPreconditioner > & iterative_solver,
bool do_ldlt,
proxsuite::linalg::veg::dynstack::DynStackMut stack,
T * ldl_values,
I * perm,
I * ldl_col_ptrs,
I const * perm_inv,
Settings< T > const & settings,
proxsuite::linalg::sparse::MatMut< T, I > kkt_active,
proxsuite::linalg::veg::SliceMut< bool > active_constraints )

Definition at line 88 of file solver.hpp.

◆ ldl_solve_in_place()

template<typename T , typename I >
void proxsuite::proxqp::sparse::ldl_solve_in_place ( VectorViewMut< T > rhs,
VectorView< T > init_guess,
Results< T > const & results,
Model< T, I > const & data,
isize n_tot,
proxsuite::linalg::sparse::MatMut< T, I > ldl,
Eigen::MINRES< detail::AugmentedKkt< T, I >, Eigen::Upper|Eigen::Lower, Eigen::IdentityPreconditioner > & iterative_solver,
bool do_ldlt,
proxsuite::linalg::veg::dynstack::DynStackMut stack,
T * ldl_values,
I * perm,
I * ldl_col_ptrs,
I const * perm_inv,
Settings< T > const & settings,
proxsuite::linalg::sparse::MatMut< T, I > kkt_active,
proxsuite::linalg::veg::SliceMut< bool > active_constraints )

Solves in place a linear system.

Parameters
rhsright hand side vector of the linear system to solver.
init_guessinitial guess for solving the linear system
ldlcurrent ldlt.
do_ldltboolean variable for doing the ldlt (rather than MinRes algorithm).
perm_invpointer to the inverse of the permutation.
resultssolver results.
datamodel of the QP.
n_totdimension of the KKT matrix
kkt_activeactive part of the KKT matrix.
active_constraintsvector boolean precising whether the constraints are active or not.
iterative_solveriterative solver matrix free.
stackmemory stack.
ldl_valuespointor to ldl values.
permpointor to the ldl permutation.
ldl_col_ptrspointor to the column of the ldl.
perm_invpointor the inverse permutation.
settingssolver's settings.
kkt_activeactive part of the kkt.

Definition at line 201 of file solver.hpp.

◆ inner_reconstructed_matrix()

template<typename T , typename I >
auto proxsuite::proxqp::sparse::inner_reconstructed_matrix ( proxsuite::linalg::sparse::MatMut< T, I > ldl) -> DMat<T>

Reconstructs manually the permutted matrix.

Parameters
ldlcurrent ldlt.
do_ldltboolean variable for doing the ldlt (rather than MinRes algorithm).

Definition at line 250 of file solver.hpp.

◆ reconstructed_matrix()

template<typename T , typename I >
auto proxsuite::proxqp::sparse::reconstructed_matrix ( proxsuite::linalg::sparse::MatMut< T, I > ldl,
I const * perm_inv,
isize n_tot ) -> DMat<T>

Reconstructs manually the value of the KKT matrix.

Parameters
ldlcurrent ldlt.
do_ldltboolean variable for doing the ldlt (rather than MinRes algorithm).
perm_invpointer to the inverse of the permutation.
n_totdimension of the KKT matrix

Definition at line 271 of file solver.hpp.

◆ reconstruction_error()

template<typename T , typename I >
auto proxsuite::proxqp::sparse::reconstruction_error ( proxsuite::linalg::sparse::MatMut< T, I > ldl,
I const * perm_inv,
Results< T > const & results,
Model< T, I > const & data,
isize n_tot,
proxsuite::linalg::sparse::MatMut< T, I > kkt_active,
proxsuite::linalg::veg::SliceMut< bool > active_constraints ) -> DMat<T>

Derives the norm of the difference between current KKT and the one it should be (derived manually).

Parameters
ldlcurrent ldlt.
perm_invpointer to the inverse of the permutation.
resultssolver results.
datamodel of the QP.
n_totdimension of the KKT matrix
kkt_activeactive part of the KKT matrix.
active_constraintsvector boolean precising whether the constraints are active or not.

Definition at line 299 of file solver.hpp.

◆ qp_solve()

template<typename T , typename I , typename P >
void proxsuite::proxqp::sparse::qp_solve ( Results< T > & results,
Model< T, I > & data,
const Settings< T > & settings,
Workspace< T, I > & work,
P & precond )

Executes the PROXQP algorithm.

Parameters
resultssolver results.
dataQP problem model as defined by the user (without any scaling performed).
settingssolver settings.
worksolver workspace.
precondpreconditioner.

Definition at line 344 of file solver.hpp.

◆ print_setup_header()

template<typename T , typename I >
void proxsuite::proxqp::sparse::print_setup_header ( const Settings< T > & settings,
Results< T > & results,
const Model< T, I > & model )

Definition at line 36 of file utils.hpp.

◆ refactorize()

template<typename T , typename I >
void proxsuite::proxqp::sparse::refactorize ( Workspace< T, I > & work,
Results< T > const & results,
Settings< T > const & settings,
proxsuite::linalg::sparse::MatMut< T, I > kkt_active,
proxsuite::linalg::veg::SliceMut< bool > active_constraints,
Model< T, I > const & data,
proxsuite::linalg::veg::dynstack::DynStackMut stack,
proxsuite::linalg::veg::Tag< T > & xtag )

Definition at line 33 of file workspace.hpp.

◆ solve()

template<typename T , typename I >
proxqp::Results< T > proxsuite::proxqp::sparse::solve ( optional< SparseMat< T, I > > H,
optional< VecRef< T > > g,
optional< SparseMat< T, I > > A,
optional< VecRef< T > > b,
optional< SparseMat< T, I > > C,
optional< VecRef< T > > l,
optional< VecRef< T > > u,
optional< VecRef< T > > x = nullopt,
optional< VecRef< T > > y = nullopt,
optional< VecRef< T > > z = nullopt,
optional< T > eps_abs = nullopt,
optional< T > eps_rel = nullopt,
optional< T > rho = nullopt,
optional< T > mu_eq = nullopt,
optional< T > mu_in = nullopt,
optional< bool > verbose = nullopt,
bool compute_preconditioner = true,
bool compute_timings = false,
optional< isize > max_iter = nullopt,
proxsuite::proxqp::InitialGuessStatus initial_guess = proxsuite::proxqp::InitialGuessStatus::EQUALITY_CONSTRAINED_INITIAL_GUESS,
proxsuite::proxqp::SparseBackend sparse_backend = proxsuite::proxqp::SparseBackend::Automatic,
bool check_duality_gap = false,
optional< T > eps_duality_gap_abs = nullopt,
optional< T > eps_duality_gap_rel = nullopt,
bool primal_infeasibility_solving = false,
optional< T > manual_minimal_H_eigenvalue = nullopt )

Solves the QP problem using PROXQP algorithm without the need to define a QP object, with matrices defined by Dense Eigen matrices. It is possible to set up some of the solver parameters (warm start, initial guess option, proximal step sizes, absolute and relative accuracies, maximum number of iterations, preconditioner execution).

Parameters
Hquadratic cost input defining the QP model.
glinear cost input defining the QP model.
Aequality constraint matrix input defining the QP model.
bequality constraint vector input defining the QP model.
Cinequality constraint matrix input defining the QP model.
llower inequality constraint vector input defining the QP model.
uupper inequality constraint vector input defining the QP model.
xprimal warm start.
ydual equality constraint warm start.
zdual inequality constraint warm start.
verboseif set to true, the solver prints more information about each iteration.
compute_preconditionerboolean parameter for executing or not the preconditioner.
compute_timingsboolean parameter for computing the solver timings.
rhoproximal step size wrt primal variable.
mu_eqproximal step size wrt equality constrained multiplier.
mu_inproximal step size wrt inequality constrained multiplier.
eps_absabsolute accuracy threshold.
eps_relrelative accuracy threshold.
max_itermaximum number of iteration.
initial_guessinitial guess option for warm starting or not the initial iterate values.
check_duality_gapIf set to true, include the duality gap in absolute and relative stopping criteria.
eps_duality_gap_absabsolute accuracy threshold for the duality-gap criterion.
eps_duality_gap_relrelative accuracy threshold for the duality-gap criterion.

Definition at line 707 of file wrapper.hpp.

Variable Documentation

◆ DYN

constexpr auto proxsuite::proxqp::sparse::DYN = Eigen::Dynamic
staticconstexpr

Definition at line 25 of file fwd.hpp.