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

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

#include <OneLevelSolver.h>

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

Public Member Functions

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

Eigen::VectorXd _xl
 
Eigen::VectorXd _xu
 
Eigen::MatrixXd AandG
 
Eigen::VectorXd bandh
 
ocra::ObjQLD_QLDsolver
 
MatrixMap MapP
 
VectorMap Mapq
 
MatrixMap MapAandG
 
VectorMap Mapbandh
 
VectorMap MapXsol
 
VectorMap MapXl
 
VectorMap MapXu
 
- 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 QLD.

It uses a linear quadratic program which is included in the ocra framework.

QLD solve the following problem:

\begin{align*} \argmin{\x} &: \; \frac{1}{2} \x\tp P \x + \vec{q}\tp \x \\ & \A \x + \b \geqq \vec{0} \\ & \x_{min} \leq \x \leq \x_{max} \end{align*}

with

\begin{align*} \A \x + \b &\geqq \vec{0} & &\Leftrightarrow &\begin{bmatrix} CE \\ CI \end{bmatrix} \x + \begin{bmatrix} \vec{ce}_0 \\ \vec{ci}_0 \end{bmatrix} & \quad \begin{matrix} = \\ \geq \end{matrix} \quad \begin{bmatrix} \vec{0} \\ \vec{0} \end{bmatrix} \end{align*}

Definition at line 245 of file OneLevelSolver.h.

Constructor & Destructor Documentation

OneLevelSolverWithQLD::OneLevelSolverWithQLD ( )

Instanciate a concrete one level solver with QLD.

Definition at line 600 of file OneLevelSolver.cpp.

OneLevelSolverWithQLD::~OneLevelSolverWithQLD ( )
virtual

Destructor

Definition at line 618 of file OneLevelSolver.cpp.

Member Function Documentation

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

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

Implements ocra::OneLevelSolver.

Definition at line 249 of file OneLevelSolver.h.

void OneLevelSolverWithQLD::doSolve ( void  )
protectedvirtual

Do the call QLD to find a solution of the problem.

Implements ocra::OneLevelSolver.

Definition at line 746 of file OneLevelSolver.cpp.

void OneLevelSolverWithQLD::updateConstraintEquations ( )
protectedvirtual

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

Implements ocra::OneLevelSolver.

Definition at line 657 of file OneLevelSolver.cpp.

void OneLevelSolverWithQLD::updateObjectiveEquations ( )
protectedvirtual

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

Implements ocra::OneLevelSolver.

Definition at line 628 of file OneLevelSolver.cpp.

Member Data Documentation

ocra::ObjQLD* ocra::OneLevelSolverWithQLD::_QLDsolver
protected

Definition at line 270 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQLD::_xl
protected

Definition at line 264 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQLD::_xu
protected

Definition at line 265 of file OneLevelSolver.h.

Eigen::MatrixXd ocra::OneLevelSolverWithQLD::AandG
protected

Definition at line 267 of file OneLevelSolver.h.

Eigen::VectorXd ocra::OneLevelSolverWithQLD::bandh
protected

Definition at line 268 of file OneLevelSolver.h.

MatrixMap ocra::OneLevelSolverWithQLD::MapAandG
protected

Definition at line 276 of file OneLevelSolver.h.

VectorMap ocra::OneLevelSolverWithQLD::Mapbandh
protected

Definition at line 277 of file OneLevelSolver.h.

MatrixMap ocra::OneLevelSolverWithQLD::MapP
protected

Definition at line 273 of file OneLevelSolver.h.

VectorMap ocra::OneLevelSolverWithQLD::Mapq
protected

Definition at line 274 of file OneLevelSolver.h.

VectorMap ocra::OneLevelSolverWithQLD::MapXl
protected

Definition at line 280 of file OneLevelSolver.h.

VectorMap ocra::OneLevelSolverWithQLD::MapXsol
protected

Definition at line 279 of file OneLevelSolver.h.

VectorMap ocra::OneLevelSolverWithQLD::MapXu
protected

Definition at line 281 of file OneLevelSolver.h.


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