Class OSQPBackEnd

Inheritance Relationships

Base Type

Class Documentation

class OSQPBackEnd : public OpenSoT::solvers::BackEnd

The OSQPBackEnd class handle variables, options and execution of a single osqp problem.

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

Public Types

typedef MatrixPiler VectorPiler

Public Functions

OSQPBackEnd(const int number_of_variables, const int number_of_constraints, const double eps_regularisation = OSQP_DEFAULT_EPS_REGULARISATION)

OSQPBackEnd constructor with creation of a QP problem.

Parameters
  • number_of_variables – of the QP problem

  • number_of_constraints – of the QP problem

  • eps_regularisation – set the Scaling factor of identity matrix used for Hessian regularisation.s

~OSQPBackEnd()

~OSQPBackEnd destructor

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)

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

virtual boost::any getOptions()

getOptions return the options of the QP problem

Returns

options

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

setOptions of the QP problem.

Parameters

options

virtual bool updateTask(const Eigen::MatrixXd &H, const Eigen::VectorXd &g)

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

virtual bool setEpsRegularisation(const double eps)

setEpsRegularisation OVERWRITES the actual eps regularisation factor

Parameters

eps – the new regularisation factor

Returns

false if eps < 0

inline virtual double getEpsRegularisation()

getEpsRegularisation return internal solver eps

Returns

eps value