Crocoddyl
Loading...
Searching...
No Matches
BoxQPTpl< _Scalar > Class Template Reference

This class implements a Box QP solver based on a Projected Newton method. More...

#include <box-qp.hpp>

Public Types

typedef BoxQPSolutionTpl< Scalar > BoxQPSolution
typedef MathBaseTpl< Scalar > MathBase
typedef MathBase::MatrixXs MatrixXs
typedef MathBase::VectorXs VectorXs

Public Member Functions

 BoxQPTpl (const std::size_t nx, const std::size_t maxiter=100, const Scalar th_acceptstep=Scalar(0.1), const Scalar th_grad=Scalar(1e-9), const Scalar reg=Scalar(1e-9))
 Initialize the Projected-Newton QP for bound constraints.
 ~BoxQPTpl ()=default
 Destroy the Projected-Newton QP solver.
template<typename NewScalar>
BoxQPTpl< NewScalar > cast () const
 Cast the BoxQP solver to a different scalar type.
const std::vector< Scalar > & get_alphas () const
 Return the stack of step lengths using by the line-search procedure.
std::size_t get_maxiter () const
 Return the maximum allowed number of iterations.
std::size_t get_nx () const
 Return the decision vector dimension.
Scalar get_reg () const
 Return the regularization value.
const BoxQPSolution & get_solution () const
 Return the stored solution.
Scalar get_th_acceptstep () const
 Return the acceptance step threshold.
Scalar get_th_grad () const
 Return the gradient tolerance threshold.
void set_alphas (const std::vector< Scalar > &alphas)
 Modify the stack of step lengths using by the line-search procedure.
void set_maxiter (const std::size_t maxiter)
 Modify the maximum allowed number of iterations.
void set_nx (const std::size_t nx)
 Modify the decision vector dimension.
void set_reg (const Scalar reg)
 Modify the regularization value.
void set_th_acceptstep (const Scalar th_acceptstep)
 Modify the acceptance step threshold.
void set_th_grad (const Scalar th_grad)
 Modify the gradient tolerance threshold.
const BoxQPSolution & solve (const MatrixXs &H, const VectorXs &q, const VectorXs &lb, const VectorXs &ub, const VectorXs &xinit)
 Compute the solution of bound-constrained QP based on Newton projection.

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Detailed Description

template<typename _Scalar>
class crocoddyl::BoxQPTpl< _Scalar >

This class implements a Box QP solver based on a Projected Newton method.

We consider a box QP problem of the form:

\begin{eqnarray*}  \min_{\mathbf{x}} &= \frac{1}{2}\mathbf{x}^T\mathbf{H}\mathbf{x} +
\mathbf{q}^T\mathbf{x} \\
  \textrm{subject to} & \hspace{1em} \mathbf{\underline{b}} \leq \mathbf{x}
\leq \mathbf{\bar{b}} \\ \end{eqnarray*}

where $\mathbf{H}$, $\mathbf{q}$ are the Hessian and gradient of the problem, respectively, $\mathbf{\underline{b}}$, $\mathbf{\bar{b}}$ are lower and upper bounds of the decision variable $\mathbf{x}$.

The algorithm procees by iteratively identifying the active bounds, and then performing a projected Newton step in the free sub-space. The projection uses the Hessian of the free sub-space and is computed efficiently using a Cholesky decomposition. It uses a line search procedure with polynomial step length values in a backtracking fashion. The steps are checked using an Armijo condition together L2-norm gradient.

For more details about this solver, we encourage you to read the following article:

Definition at line 103 of file box-qp.hpp.

Member Typedef Documentation

◆ BoxQPSolution

template<typename _Scalar>
typedef BoxQPSolutionTpl<Scalar> BoxQPSolution

Definition at line 108 of file box-qp.hpp.

◆ MathBase

template<typename _Scalar>
typedef MathBaseTpl<Scalar> MathBase

Definition at line 109 of file box-qp.hpp.

◆ VectorXs

template<typename _Scalar>
typedef MathBase::VectorXs VectorXs

Definition at line 110 of file box-qp.hpp.

◆ MatrixXs

template<typename _Scalar>
typedef MathBase::MatrixXs MatrixXs

Definition at line 111 of file box-qp.hpp.

Constructor & Destructor Documentation

◆ BoxQPTpl()

template<typename _Scalar>
BoxQPTpl(const std::size_tnx,
const std::size_tmaxiter = 100,
const Scalarth_acceptstep = Scalar(0.1),
const Scalarth_grad = Scalar(1e-9),
const Scalarreg = Scalar(1e-9) )

Initialize the Projected-Newton QP for bound constraints.

Parameters
[in]nxDimension of the decision vector
[in]maxiterMaximum number of allowed iterations (default 100)
[in]th_acceptstepAcceptance step threshold (default 0.1)
[in]th_gradGradient tolerance threshold (default 1e-9)
[in]regRegularization value (default 1e-9)

Member Function Documentation

◆ solve()

template<typename _Scalar>
const BoxQPSolution & solve(const MatrixXs &H,
const VectorXs &q,
const VectorXs &lb,
const VectorXs &ub,
const VectorXs &xinit )

Compute the solution of bound-constrained QP based on Newton projection.

Parameters
[in]HHessian (dimension nx * nx)
[in]qGradient (dimension nx)
[in]lbLower bound (dimension nx)
[in]ubUpper bound (dimension nx)
[in]xinitInitial guess (dimension nx)
Returns
The solution of the problem

◆ cast()

template<typename _Scalar>
template<typename NewScalar>
BoxQPTpl< NewScalar > cast()const

Cast the BoxQP solver to a different scalar type.

It is useful for operations requiring different precision or scalar types.

Template Parameters
NewScalarThe new scalar type to cast to.
Returns
BoxQPTpl<NewScalar> A BoxQP solver with the new scalar type.

Member Data Documentation

◆ Scalar

template<typename _Scalar>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Definition at line 107 of file box-qp.hpp.


The documentation for this class was generated from the following files:
  • /build/source/include/crocoddyl/core/fwd.hpp
  • /build/source/include/crocoddyl/core/solvers/box-qp.hpp