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

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

#include <OneLevelSolver.h>

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

Public Member Functions

virtual OneLevelSolver::Ptr clone () const
 
 OneLevelSolverWithQuadProg ()
 
virtual ~OneLevelSolverWithQuadProg ()
 
- 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 ()
 

Protected Attributes

std::mutex mutex
 
- 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 Quadprog++.

It uses a linear quadratic program which comes from http://quadprog.sourceforge.net/ .

Quadprog++ 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 152 of file OneLevelSolver.h.

Constructor & Destructor Documentation

OneLevelSolverWithQuadProg::OneLevelSolverWithQuadProg ( )

Instanciate a concrete one level solver with Quadprog++.

Definition at line 236 of file OneLevelSolver.cpp.

OneLevelSolverWithQuadProg::~OneLevelSolverWithQuadProg ( )
virtual

Destructor

Definition at line 246 of file OneLevelSolver.cpp.

Member Function Documentation

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

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

Implements ocra::OneLevelSolver.

Definition at line 156 of file OneLevelSolver.h.

void OneLevelSolverWithQuadProg::doSolve ( void  )
protectedvirtual

Do the call Quadprog++ to find a solution of the problem.

Implements ocra::OneLevelSolver.

Definition at line 379 of file OneLevelSolver.cpp.

void OneLevelSolverWithQuadProg::updateConstraintEquations ( )
protectedvirtual

Update the constraint set, by considering all the active ones.

Implements ocra::OneLevelSolver.

Definition at line 278 of file OneLevelSolver.cpp.

void OneLevelSolverWithQuadProg::updateObjectiveEquations ( )
protectedvirtual

Update the objective function, by considering all the active registered tasks.

Implements ocra::OneLevelSolver.

Definition at line 254 of file OneLevelSolver.cpp.

Member Data Documentation

std::mutex ocra::OneLevelSolverWithQuadProg::mutex
protected

Definition at line 166 of file OneLevelSolver.h.


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