Class BackEnd

Inheritance Relationships

Derived Types

Class Documentation

class BackEnd

Subclassed by OpenSoT::solvers::GLPKBackEnd, OpenSoT::solvers::OSQPBackEnd, OpenSoT::solvers::QPOasesBackEnd, OpenSoT::solvers::eiQuadProgBackEnd, OpenSoT::solvers::proxQPBackEnd, OpenSoT::solvers::qpSWIFTBackEnd

Public Types

typedef std::shared_ptr<BackEnd> Ptr

Public Functions

BackEnd(const int number_of_variables, const int number_of_constraints)
virtual ~BackEnd()
inline const Eigen::VectorXd &getSolution()

getSolution return the actual solution of the QP problem

Returns

solution

inline const Eigen::MatrixXd &getH()

Getters for internal matrices and Eigen::VectorXds.

inline const Eigen::VectorXd &getg()
inline const Eigen::MatrixXd &getA()
inline const Eigen::VectorXd &getlA()
inline const Eigen::VectorXd &getuA()
inline const Eigen::VectorXd &getl()
inline const Eigen::VectorXd &getu()
int getNumVariables() const
int getNumConstraints() const
void log(XBot::MatLogger2::Ptr logger, int i, const std::string &prefix)

log Tasks, Constraints and Bounds matrices

Parameters
  • logger – a pointer to a MatLogger

  • i – an index related to the particular index of the problem

  • prefix – a prefix before the logged matrices

bool updateProblem(const Eigen::MatrixXd &H, const Eigen::VectorXd &g, const Eigen::MatrixXd &A, const Eigen::VectorXd &lA, const Eigen::VectorXd &uA, const Eigen::VectorXd &l, const Eigen::VectorXd &u)

updateProblem update the whole problem see updateTask(), updateConstraints() and updateBounds()

Parameters
  • H – updated task matrix

  • g – updated reference Eigen::VectorXd

  • A – update constraint matrix

  • lA – update lower constraint Eigen::VectorXd

  • uA – update upper constraint Eigen::VectorXd

  • l – update lower bounds

  • u – update upper bounds

Returns

if the problem is correctly updated

void printProblemInformation(const int problem_number, const std::string &problem_id, const std::string &constraints_id, const std::string &bounds_id)
virtual bool updateTask(const Eigen::MatrixXd &H, const Eigen::VectorXd &g)

VIRTUAL METHODS.

updateTask update internal H and g: _H = H _g = g for now is not possible to have different size of H and g wrt internal ones

Parameters
  • H – updated task matrix

  • g – updated reference Eigen::VectorXd

Returns

true if task is correctly updated

virtual bool updateConstraints(const Eigen::Ref<const Eigen::MatrixXd> &A, const Eigen::Ref<const Eigen::VectorXd> &lA, const Eigen::Ref<const Eigen::VectorXd> &uA)

updateConstraints update internal A, lA and uA _A = A _lA = lA _uA = uA A, lA and uA can change rows size to allow variable constraints

Parameters
  • A – update constraint matrix

  • lA – update lower constraint Eigen::VectorXd

  • uA – update upper constraint Eigen::VectorXd

Returns

true if constraints are correctly updated

virtual bool updateBounds(const Eigen::VectorXd &l, const Eigen::VectorXd &u)

updateBounds update internal l and u _l = l _u = u

Parameters
  • l – update lower bounds

  • u – update upper bounds

Returns

true if bounds are correctly updated

virtual bool initProblem(const Eigen::MatrixXd &H, const Eigen::VectorXd &g, const Eigen::MatrixXd &A, const Eigen::VectorXd &lA, const Eigen::VectorXd &uA, const Eigen::VectorXd &l, const Eigen::VectorXd &u) = 0

PURE VIRTUAL METHODS:

initProblem initialize the QP problem and get the solution, the dual solution, bounds and constraints. The QP problem has the following structure:

 min = ||Hx - g||
st. lA <= Ax <= uA l <= x <= u

Parameters
  • HTask Matrix

  • gTask references

  • AConstraint Matrix

  • lA – lower constraint Eigen::VectorXd

  • uA – upper constraint Eigen::VectorXd

  • l – lower bounds

  • u – upper bounds

Returns

true if the problem can be solved

virtual bool solve() = 0

solve the QP problem

Returns

true if the QP problem is solved (implementation should use internally _solution)

virtual boost::any getOptions() = 0

getOptions return the options of the QP problem

Returns

options, a boost::any object since we do not know the type of the object which depends on the solver

virtual void setOptions(const boost::any &options) = 0

setOptions of the QP problem.

Parameters

options, a – boost::any object since we do not know the type of the object which depends on the solver

virtual double getObjective() = 0

getObjective to retrieve the value of the objective function

Returns

the value of the objective function at the optimum

inline virtual bool setEpsRegularisation(const double eps)

setEpsRegularisation is used to set internal solver eps

Parameters

eps – regularisation

Returns

false by default

inline virtual double getEpsRegularisation()

getEpsRegularisation return internal solver eps

Returns

eps value

Protected Functions

inline virtual void _log(XBot::MatLogger2::Ptr logger, int i, const std::string &prefix)

VIRTUAL METHODS.

_log can be used to log extra information

Parameters
  • logger – a pointer to a Matlogger

  • i – an index related to the particular index of the problem

  • prefix – a prefix before the logged matrices

inline virtual void _printProblemInformation()

_printProblemInformation can be used to print extra information

Protected Attributes

Eigen::MatrixXd _H

Define a cost function: ||Hx - g||.

Eigen::VectorXd _g
Eigen::MatrixXd _A

Define a set of constraints weighted with A: lA <= Ax <= uA.

Eigen::VectorXd _lA
Eigen::VectorXd _uA
Eigen::VectorXd _l

Define a set of bounds on solution: l <= x <= u.

Eigen::VectorXd _u
Eigen::VectorXd _solution

Solution of the QP problem.

int _number_of_variables

_number_of_variables which remain constant during BE existence