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"
27 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
81 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
93 BoxQP(
const std::size_t nx,
const std::size_t maxiter = 100,
94 const double th_acceptstep = 0.1,
const double th_grad = 1e-9,
95 const double reg = 1e-9);
113 const Eigen::VectorXd& lb,
114 const Eigen::VectorXd& ub,
115 const Eigen::VectorXd& xinit);
125 std::size_t
get_nx()
const;
150 const std::vector<double>&
get_alphas()
const;
155 void set_nx(
const std::size_t nx);
175 void set_reg(
const double reg);
180 void set_alphas(
const std::vector<double>& alphas);
185 std::size_t maxiter_;
186 double th_acceptstep_;
198 Eigen::VectorXd xnew_;
209 Eigen::LLT<Eigen::MatrixXd> Hff_inv_llt_;
This class implements a Box QP solver based on a Projected Newton method.
void set_reg(const double reg)
Modify the regularization value.
void set_th_grad(const double th_grad)
Modify the gradient tolerance threshold.
const BoxQPSolution & get_solution() const
Return the stored solution.
double get_th_grad() const
Return the gradient tolerance threshold.
const BoxQPSolution & solve(const Eigen::MatrixXd &H, const Eigen::VectorXd &q, const Eigen::VectorXd &lb, const Eigen::VectorXd &ub, const Eigen::VectorXd &xinit)
Compute the solution of bound-constrained QP based on Newton projection.
std::size_t get_maxiter() const
Return the maximum allowed number of iterations.
void set_maxiter(const std::size_t maxiter)
Modify the maximum allowed number of iterations.
~BoxQP()
Destroy the Projected-Newton QP solver.
void set_nx(const std::size_t nx)
Modify the decision vector dimension.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW BoxQP(const std::size_t nx, const std::size_t maxiter=100, const double th_acceptstep=0.1, const double th_grad=1e-9, const double reg=1e-9)
Initialize the Projected-Newton QP for bound constraints.
const std::vector< double > & get_alphas() const
Return the stack of step lengths using by the line-search procedure.
void set_alphas(const std::vector< double > &alphas)
Modify the stack of step lengths using by the line-search procedure.
void set_th_acceptstep(const double th_acceptstep)
Modify the acceptance step threshold.
double get_th_acceptstep() const
Return the acceptance step threshold.
double get_reg() const
Return the regularization value.
std::size_t get_nx() const
Return the decision vector dimension.
std::vector< size_t > free_idx
Free space indexes.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW BoxQPSolution()
Initialize the QP solution structure.
Eigen::MatrixXd Hff_inv
Inverse of the free space Hessian.
Eigen::VectorXd x
Decision vector.
BoxQPSolution(const Eigen::MatrixXd &Hff_inv, const Eigen::VectorXd &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
Clamped space indexes.