9#ifndef CROCODDYL_CORE_SOLVERS_BOX_QP_HPP_ 10#define CROCODDYL_CORE_SOLVERS_BOX_QP_HPP_ 12#include "crocoddyl/core/fwd.hpp" 13#include "crocoddyl/core/utils/exception.hpp" 26template <
typename _Scalar>
28 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
30 typedef _Scalar Scalar;
32 typedef typename MathBase::VectorXs VectorXs;
33 typedef typename MathBase::MatrixXs MatrixXs;
62 template <
typename NewScalar>
102template <
typename _Scalar>
105 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
107 typedef _Scalar Scalar;
110 typedef typename MathBase::VectorXs VectorXs;
111 typedef typename MathBase::MatrixXs MatrixXs;
123 BoxQPTpl(
const std::size_t nx,
const std::size_t maxiter = 100,
124 const Scalar th_acceptstep = Scalar(0.1),
125 const Scalar th_grad = Scalar(1e-9),
126 const Scalar reg = Scalar(1e-9));
143 const BoxQPSolution&
solve(
const MatrixXs& H,
const VectorXs& q,
144 const VectorXs& lb,
const VectorXs& ub,
145 const VectorXs& xinit);
155 template <
typename NewScalar>
225 BoxQPSolution solution_;
226 std::size_t maxiter_;
227 Scalar th_acceptstep_;
249 Eigen::LLT<MatrixXs> Hff_inv_llt_;
257#include "crocoddyl/core/solvers/box-qp.hxx" This class implements a Box QP solver based on a Projected Newton method.
void set_th_acceptstep(const Scalar th_acceptstep)
Modify the acceptance step threshold.
const BoxQPSolution & get_solution() const
Return the stored solution.
void set_reg(const Scalar reg)
Modify the regularization value.
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.
Scalar get_th_acceptstep() const
Return the acceptance step threshold.
void set_maxiter(const std::size_t maxiter)
Modify the maximum allowed number of iterations.
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.
Scalar get_reg() const
Return the regularization value.
void set_nx(const std::size_t nx)
Modify the decision vector dimension.
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.
Scalar get_th_grad() const
Return the gradient tolerance threshold.
void set_th_grad(const Scalar th_grad)
Modify the gradient tolerance threshold.
void set_alphas(const std::vector< Scalar > &alphas)
Modify the stack of step lengths using by the line-search procedure.
std::size_t get_nx() const
Return the decision vector dimension.
BoxQPTpl< NewScalar > cast() const
Cast the BoxQP solver to a different scalar type.
BoxQPSolutionTpl()
Initialize the QP solution structure.
std::vector< size_t > free_idx
BoxQPSolutionTpl< NewScalar > cast() const
Cast the BoxQP solution to a different scalar type.
BoxQPSolutionTpl(const MatrixXs &Hff_inv, const VectorXs &x, const std::vector< size_t > &free_idx, const std::vector< size_t > &clamped_idx)
Initialize the QP solution structure.
std::vector< size_t > clamped_idx