ocra-recipes
Doxygen documentation for the ocra-recipes repository
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ocra::OneLevelSolverWithQPOASES Class Reference

Solver class that only consider one level of importance for all tasks using QPOASES. More...

#include <OneLevelSolver.h>

Inheritance diagram for ocra::OneLevelSolverWithQPOASES:
[legend]
Collaboration diagram for ocra::OneLevelSolverWithQPOASES:
[legend]

Public Member Functions

virtual OneLevelSolver::Ptr clone () const
 
 OneLevelSolverWithQPOASES ()
 
virtual ~OneLevelSolverWithQPOASES ()
 
- Public Member Functions inherited from ocra::OneLevelSolver
 OneLevelSolver ()
 
virtual ~OneLevelSolver ()
 
virtual void printValuesAtSolution ()
 
void addObjective (ObjectiveType &obj)
 
void removeObjective (ObjectiveType &obj)
 
void addConstraint (ocra::LinearConstraint &constraint)
 
void removeConstraint (ocra::LinearConstraint &constraint)
 
void writePerformanceInStream (std::ostream &myOstream, bool addCommaAtEnd)
 
virtual void setObjectiveLevel (ocra::GenericObjective &obj, int level)
 
virtual std::string toString ()
 
const std::vector< ObjectiveType * > & getObjectives ()
 
const Eigen::MatrixXd & getQuadraticMatrix ()
 
const Eigen::VectorXd & getQuadraticVector ()
 
- Public Member Functions inherited from ocra::Solver
const std::vector< int > & findMapping (Variable &var)
 
virtual ~Solver ()
 
const OptimizationResultsolve ()
 
const OptimizationResultgetLastResult () const
 
void printStatus (std::ostream &os)
 
virtual const std::string & getMoreInfo () const
 
void setMemoryLevel (int level)
 
void setAutoDumpFile (const std::string &file)
 
void activateAutoDump ()
 
void deactivateAutoDump ()
 
void dump (const std::string &file="") const
 
int n ()
 
VariablegetProblemVariable ()
 
void setVariableValue (const VectorXd &value)
 
- Public Member Functions inherited from ocra::ObserverSubject
 ObserverSubject ()
 
virtual ~ObserverSubject ()
 
- Public Member Functions inherited from ocra::Observer
virtual ~Observer ()
 
template<int EVT>
void bind (SubjectBase< EVT > &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
template<int EVT>
void stopPropagation ()
 
- Public Member Functions inherited from ocra::ObserverBase< EVT_RESIZE >
void bind (subject_type &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
- Public Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES >
void bind (subject_type &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
- Public Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_VALUE >
void bind (subject_type &subject)
 Call this method to automatically propagate observed events to observers connected to the subject given in argument. More...
 
- Public Member Functions inherited from ocra::Subject
virtual ~Subject ()
 
template<int EVT, class Derived , class Base >
void connect (Derived &object, void(Base::*newCallback)(int)) const
 Call this method to register a non-static method as a callback. More...
 
template<int EVT>
void connect (void(*newCallback)(int)) const
 Call this method to register a free function as a callback. More...
 
template<int EVT, class Derived , class Base >
void disconnect (Derived &object, void(Base::*callbackToErase)(int)) const
 Disconnect non-static method. More...
 
template<int EVT>
void disconnect (void(*callbackToErase)(int)) const
 Disconnect free function. More...
 
template<int EVT>
void propagate () const
 
template<int EVT>
void propagate (int timestamp) const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_RESIZE >
void connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const
 Call this method to register a non-static method as a callback. More...
 
void connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const
 Call this method to register a free function as a callback. More...
 
void disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const
 Disconnect non-static method. More...
 
void disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const
 Disconnect free function. More...
 
void propagate (int timestamp) const
 
void propagate () const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_DEPENDENCIES >
void connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const
 Call this method to register a non-static method as a callback. More...
 
void connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const
 Call this method to register a free function as a callback. More...
 
void disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const
 Disconnect non-static method. More...
 
void disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const
 Disconnect free function. More...
 
void propagate (int timestamp) const
 
void propagate () const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_VALUE >
void connect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type newCallback) const
 Call this method to register a non-static method as a callback. More...
 
void connect (typename SubjectBaseTraits< EVT, void >::callback_type newCallback) const
 Call this method to register a free function as a callback. More...
 
void disconnect (T &object, typename SubjectBaseTraits< EVT, T >::callback_type callback) const
 Disconnect non-static method. More...
 
void disconnect (typename SubjectBaseTraits< EVT, void >::callback_type callbackToErase) const
 Disconnect free function. More...
 
void propagate (int timestamp) const
 
void propagate () const
 
- Public Member Functions inherited from ocra::NamedInstance
 NamedInstance (const std::string &name)
 
const std::string & getName () const
 
virtual ~NamedInstance ()
 

Protected Member Functions

virtual void doSolve ()
 
virtual void updateObjectiveEquations ()
 
virtual void updateConstraintEquations ()
 
- Protected Member Functions inherited from ocra::OneLevelSolver
virtual void doPrepare ()
 
virtual void doConclude ()
 
virtual void prepareMatrices ()
 
void reduceConstraints (const Eigen::MatrixXd &A, const Eigen::VectorXd &b, Eigen::MatrixXd &Ar, Eigen::VectorXd &br, double tolerance=1e-6)
 
- Protected Member Functions inherited from ocra::Solver
 Solver ()
 
void internalAddObjective (const GenericObjective &objective)
 
void internalAddConstraint (const GenericConstraint &constraint)
 
void internalRemoveObjective (const GenericObjective &objective)
 
void internalRemoveConstraint (const GenericConstraint &constraint)
 
virtual void onConstraintResize (int timestamp)
 
virtual void onObjectiveResize (int timestamp)
 
- Protected Member Functions inherited from ocra::ObserverBase< EVT_RESIZE >
void stopPropagation ()
 Call this method from your callbacks to avoid propagation to the bound subject (if any). More...
 
 ObserverBase ()
 
 ~ObserverBase ()
 
- Protected Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES >
void stopPropagation ()
 Call this method from your callbacks to avoid propagation to the bound subject (if any). More...
 
 ObserverBase ()
 
 ~ObserverBase ()
 
- Protected Member Functions inherited from ocra::ObserverBase< EVT_CHANGE_VALUE >
void stopPropagation ()
 Call this method from your callbacks to avoid propagation to the bound subject (if any). More...
 
 ObserverBase ()
 
 ~ObserverBase ()
 
- Protected Member Functions inherited from ocra::SubjectBase< EVT_RESIZE >
 SubjectBase ()
 
 ~SubjectBase ()
 
- Protected Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_DEPENDENCIES >
 SubjectBase ()
 
 ~SubjectBase ()
 
- Protected Member Functions inherited from ocra::SubjectBase< EVT_CHANGE_VALUE >
 SubjectBase ()
 
 ~SubjectBase ()
 

Static Protected Member Functions

static ocra::eReturnInfo toOcraRetValue (const qpOASES::returnValue &ret)
 

Protected Attributes

std::unique_ptr< qpOASES::SQProblem > sqp_prob
 
qpOASES::Options sqp_options
 
std::vector< qpOASES::real_t > H
 
qpOASES::real_t * g
 
qpOASES::real_t * lb
 
qpOASES::real_t * ub
 
qpOASES::real_t * A
 
qpOASES::real_t * lbA
 
qpOASES::real_t * ubA
 
Eigen::VectorXd _xl
 
Eigen::VectorXd _xu
 
MatrixXdRm _AandG
 
MatrixXdRm _C_row_major
 
Eigen::MatrixXd _RegTerm
 
Eigen::VectorXd _lbAandG
 
Eigen::VectorXd _ubAandG
 
Eigen::VectorXd _lbA
 
Eigen::VectorXd _lbG
 
Eigen::VectorXd _ubA
 
Eigen::VectorXd _ubG
 
int _nWSR_every_run
 
int nWSR
 
- Protected Attributes inherited from ocra::OneLevelSolver
std::vector< ObjectiveType * > _objectives
 
std::vector< ocra::LinearConstraint * > _equalityConstraints
 
Eigen::MatrixXd _A
 
Eigen::VectorXd _b
 
Eigen::MatrixXd _Atotal
 
Eigen::VectorXd _btotal
 
int ne
 
std::vector< ocra::LinearConstraint * > _inequalityConstraints
 
Eigen::MatrixXd _G
 
Eigen::VectorXd _h
 
int ni
 
Eigen::VectorXd Xsolution
 
Eigen::MatrixXd _C
 
Eigen::VectorXd _d
 
- Protected Attributes inherited from ocra::Solver
OptimizationResult _result
 

Additional Inherited Members

- Public Types inherited from ocra::OneLevelSolver
using ObjectiveType = ocra::QuadraticObjective
 
- Protected Types inherited from ocra::ObserverBase< EVT_RESIZE >
typedef SubjectBase< EVT > subject_type
 
typedef InvokerBase< EVT > invoker_type
 
- Protected Types inherited from ocra::ObserverBase< EVT_CHANGE_DEPENDENCIES >
typedef SubjectBase< EVT > subject_type
 
typedef InvokerBase< EVT > invoker_type
 
- Protected Types inherited from ocra::ObserverBase< EVT_CHANGE_VALUE >
typedef SubjectBase< EVT > subject_type
 
typedef InvokerBase< EVT > invoker_type
 

Detailed Description

Solver class that only consider one level of importance for all tasks using QPOASES.

It uses a linear quadratic program which comes from https://projects.coin-or.org/qpOASES .

QPOASES solve the following problem:

\begin{align*} \argmin{\x} &: \; \frac{1}{2} \x\tp G \x + \vec{g}_0\tp \x \\ & CE \x + \vec{ce}_0 = \vec{0} \\ & CI \x + \vec{ci}_0 \geq \vec{0} \end{align*}

Definition at line 184 of file OneLevelSolver.h.

Constructor & Destructor Documentation

OneLevelSolverWithQPOASES::OneLevelSolverWithQPOASES ( )

Definition at line 395 of file OneLevelSolver.cpp.

virtual ocra::OneLevelSolverWithQPOASES::~OneLevelSolverWithQPOASES ( )
inlinevirtual

Definition at line 191 of file OneLevelSolver.h.

Member Function Documentation

virtual OneLevelSolver::Ptr ocra::OneLevelSolverWithQPOASES::clone ( ) const
inlinevirtual

retuns a pointer to a new instance, very usefull in Hocra

Implements ocra::OneLevelSolver.

Definition at line 188 of file OneLevelSolver.h.

void OneLevelSolverWithQPOASES::doSolve ( void  )
protectedvirtual

Implements ocra::OneLevelSolver.

Definition at line 560 of file OneLevelSolver.cpp.

eReturnInfo OneLevelSolverWithQPOASES::toOcraRetValue ( const qpOASES::returnValue &  ret)
staticprotected

Definition at line 547 of file OneLevelSolver.cpp.

void OneLevelSolverWithQPOASES::updateConstraintEquations ( )
protectedvirtual

Implements ocra::OneLevelSolver.

Definition at line 406 of file OneLevelSolver.cpp.

void OneLevelSolverWithQPOASES::updateObjectiveEquations ( )
protectedvirtual

Implements ocra::OneLevelSolver.

Definition at line 519 of file OneLevelSolver.cpp.

Member Data Documentation

MatrixXdRm ocra::OneLevelSolverWithQPOASES::_AandG
protected

Definition at line 209 of file OneLevelSolver.h.

MatrixXdRm ocra::OneLevelSolverWithQPOASES::_C_row_major
protected

Definition at line 209 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQPOASES::_lbA
protected

Definition at line 212 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQPOASES::_lbAandG
protected

Definition at line 211 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQPOASES::_lbG
protected

Definition at line 212 of file OneLevelSolver.h.

int ocra::OneLevelSolverWithQPOASES::_nWSR_every_run
protected

Definition at line 214 of file OneLevelSolver.h.

Eigen::MatrixXd ocra::OneLevelSolverWithQPOASES::_RegTerm
protected

Definition at line 210 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQPOASES::_ubA
protected

Definition at line 212 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQPOASES::_ubAandG
protected

Definition at line 211 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQPOASES::_ubG
protected

Definition at line 212 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQPOASES::_xl
protected

Definition at line 206 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQPOASES::_xu
protected

Definition at line 207 of file OneLevelSolver.h.

qpOASES::real_t* ocra::OneLevelSolverWithQPOASES::A
protected

Definition at line 201 of file OneLevelSolver.h.

qpOASES::real_t* ocra::OneLevelSolverWithQPOASES::g
protected

Definition at line 198 of file OneLevelSolver.h.

std::vector<qpOASES::real_t> ocra::OneLevelSolverWithQPOASES::H
protected

Definition at line 197 of file OneLevelSolver.h.

qpOASES::real_t* ocra::OneLevelSolverWithQPOASES::lb
protected

Definition at line 199 of file OneLevelSolver.h.

qpOASES::real_t* ocra::OneLevelSolverWithQPOASES::lbA
protected

Definition at line 202 of file OneLevelSolver.h.

int ocra::OneLevelSolverWithQPOASES::nWSR
protected

Definition at line 214 of file OneLevelSolver.h.

qpOASES::Options ocra::OneLevelSolverWithQPOASES::sqp_options
protected

Definition at line 195 of file OneLevelSolver.h.

std::unique_ptr<qpOASES::SQProblem> ocra::OneLevelSolverWithQPOASES::sqp_prob
protected

Definition at line 191 of file OneLevelSolver.h.

qpOASES::real_t* ocra::OneLevelSolverWithQPOASES::ub
protected

Definition at line 200 of file OneLevelSolver.h.

qpOASES::real_t* ocra::OneLevelSolverWithQPOASES::ubA
protected

Definition at line 203 of file OneLevelSolver.h.


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