tasks::qp::GenQPSolver Class Referenceabstract

#include <Tasks/GenQPSolver.h>

Inheritance diagram for tasks::qp::GenQPSolver:

Public Member Functions

virtual ~GenQPSolver ()
 
virtual void updateSize (int nrVars, int nrEq, int nrInEq, int nrGenInEq)=0
 
virtual void setDependencies (int nrVars, std::vector< std::tuple< int, int, double >> dependencies)
 
virtual void updateMatrix (const std::vector< Task * > &tasks, const std::vector< Equality * > &eqConstr, const std::vector< Inequality * > &inEqConstr, const std::vector< GenInequality * > &genInEqConstr, const std::vector< Bound * > &boundConstr)=0
 
virtual bool solve ()=0
 
virtual const Eigen::VectorXd & result () const =0
 
virtual std::ostream & errorMsg (const std::vector< rbd::MultiBody > &mbs, const std::vector< Task * > &tasks, const std::vector< Equality * > &eqConstr, const std::vector< Inequality * > &inEqConstr, const std::vector< GenInequality * > &genInEqConstr, const std::vector< Bound * > &boundConstr, std::ostream &out) const =0
 
virtual std::string name () const =0
 

Static Public Attributes

static const std::string default_qp_solver
 Default QP solver. More...
 

Protected Attributes

std::vector< int > fullToReduced_
 
std::vector< int > reducedToFull_
 
std::vector< std::tuple< int, int, double > > dependencies_
 
Eigen::SparseMatrix< double > multipliers_
 

Detailed Description

Generic QP solver abstract interface. Solve the following problem:

\begin{align} \underset{x}{\text{minimize }} & \frac{1}{2} x^T Q x + x^T c\\ \text{s.t. } & L \leq \left\{ \begin{array}{c} x \\ A x \end{array} \right\} \leq U \end{align}

Constructor & Destructor Documentation

◆ ~GenQPSolver()

virtual tasks::qp::GenQPSolver::~GenQPSolver ( )
inlinevirtual

Member Function Documentation

◆ errorMsg()

virtual std::ostream& tasks::qp::GenQPSolver::errorMsg ( const std::vector< rbd::MultiBody > &  mbs,
const std::vector< Task * > &  tasks,
const std::vector< Equality * > &  eqConstr,
const std::vector< Inequality * > &  inEqConstr,
const std::vector< GenInequality * > &  genInEqConstr,
const std::vector< Bound * > &  boundConstr,
std::ostream &  out 
) const
pure virtual
Returns
Error message if GenQPSolver::solve has returned false.

Implemented in tasks::qp::LSSOLQPSolver, and tasks::qp::QLDQPSolver.

◆ name()

virtual std::string tasks::qp::GenQPSolver::name ( ) const
pure virtual
Returns
Name of the solver

Implemented in tasks::qp::LSSOLQPSolver, and tasks::qp::QLDQPSolver.

◆ result()

virtual const Eigen::VectorXd& tasks::qp::GenQPSolver::result ( ) const
pure virtual
Returns
Optimal \( x \) vector.

Implemented in tasks::qp::LSSOLQPSolver, and tasks::qp::QLDQPSolver.

◆ setDependencies()

virtual void tasks::qp::GenQPSolver::setDependencies ( int  nrVars,
std::vector< std::tuple< int, int, double >>  dependencies 
)
virtual

Setup dependent variables, only linear dependencies are supported

Parameters
nrVarsVariable number.
dependenciesList of tuple {primary, replica, factor, offset}

◆ solve()

virtual bool tasks::qp::GenQPSolver::solve ( )
pure virtual

Solve the quadratic program.

Returns
true of success false on failure.

Implemented in tasks::qp::LSSOLQPSolver, and tasks::qp::QLDQPSolver.

◆ updateMatrix()

virtual void tasks::qp::GenQPSolver::updateMatrix ( const std::vector< Task * > &  tasks,
const std::vector< Equality * > &  eqConstr,
const std::vector< Inequality * > &  inEqConstr,
const std::vector< GenInequality * > &  genInEqConstr,
const std::vector< Bound * > &  boundConstr 
)
pure virtual

Construct the QP matrices.

Parameters
tasksBuild \( Q \) and \( c \).
eqConstrBuild \( A x = b \) constraints.
inEqConstrBuild \( A x \geq b \) constraints.
genInEqConstrBuild \( L \leq A x \leq U \) constraints.
boundConstrBuild \( L \leq x \leq U \) constraints.

Implemented in tasks::qp::LSSOLQPSolver, and tasks::qp::QLDQPSolver.

◆ updateSize()

virtual void tasks::qp::GenQPSolver::updateSize ( int  nrVars,
int  nrEq,
int  nrInEq,
int  nrGenInEq 
)
pure virtual

Update the problem size.

Parameters
nrVarsVariable number.
nrEqmaximum number of equality.
nrInEqmaximum number of inequality.
nrGenInEqmaximum number of general inequality.

Implemented in tasks::qp::LSSOLQPSolver, and tasks::qp::QLDQPSolver.

Member Data Documentation

◆ default_qp_solver

const std::string tasks::qp::GenQPSolver::default_qp_solver
static

Default QP solver.

◆ dependencies_

std::vector<std::tuple<int, int, double> > tasks::qp::GenQPSolver::dependencies_
protected

Variable dependencies, each tuple gives the primary variable index in the full variable, replica variable index in the full variable and the factor and offset in the dependency equation: replica = factor * primary

◆ fullToReduced_

std::vector<int> tasks::qp::GenQPSolver::fullToReduced_
protected

Correspondence between full variable indices and reduced variables

◆ multipliers_

Eigen::SparseMatrix<double> tasks::qp::GenQPSolver::multipliers_
protected

Multipliers matrix M of size (nFull, nReduced) such that full = M * reduce

◆ reducedToFull_

std::vector<int> tasks::qp::GenQPSolver::reducedToFull_
protected

Correspondence between reduced variable indices and full variable indices


The documentation for this class was generated from the following file: