Class qpSWIFTBackEnd

Inheritance Relationships

Base Type

Class Documentation

class qpSWIFTBackEnd : public OpenSoT::solvers::BackEnd

The qpSWIFTBackEnd class handle variables, options and execution of a single qpSWIFT problem.

Is implemented using Eigen. This represent the Back-End.

Note

This implementation makes use of ONLY inequality constraints (EQUALITY ARE THREATED AS INEQUALITY)

Public Functions

qpSWIFTBackEnd(const int number_of_variables, const int number_of_constraints, const double eps_regularisation = QPSWIFT_DEFAULT_EPS_REGULARISATION)
~qpSWIFTBackEnd()
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)

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()

solve the QP problem

Returns

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

virtual boost::any getOptions()

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)

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 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 double getObjective()

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