9 #ifndef CROCODDYL_CORE_SOLVERS_BOX_QP_HPP_
10 #define CROCODDYL_CORE_SOLVERS_BOX_QP_HPP_
12 #include <Eigen/Cholesky>
13 #include <Eigen/Dense>
16 #include "crocoddyl/core/utils/exception.hpp"
30 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
84 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
96 BoxQP(
const std::size_t nx,
const std::size_t maxiter = 100,
97 const double th_acceptstep = 0.1,
const double th_grad = 1e-9,
98 const double reg = 1e-9);
116 const Eigen::VectorXd& lb,
117 const Eigen::VectorXd& ub,
118 const Eigen::VectorXd& xinit);
128 std::size_t
get_nx()
const;
153 const std::vector<double>&
get_alphas()
const;
158 void set_nx(
const std::size_t nx);
178 void set_reg(
const double reg);
183 void set_alphas(
const std::vector<double>& alphas);
188 std::size_t maxiter_;
189 double th_acceptstep_;
201 Eigen::VectorXd xnew_;
212 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.