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

QuadraticFunction class. More...

#include <QuadraticFunction.h>

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

Public Types

typedef Function functionType_t
 

Public Member Functions

template<class Derived , class VectorBase >
 QuadraticFunction (Variable &x, const MatrixBase< Derived > &P, const VectorBase &q, double r)
 
virtual ~QuadraticFunction ()
 
const MatrixXd & getPi (int index=0) const
 
const VectorXd & getqi (int index=0) const
 
double getri (int index=0) const
 
const VectorXd & getr () const
 
void changePi (const MatrixXd &Pi, int index=0)
 
void changeqi (const VectorXd &qi, int index=0)
 
void changeri (double ri, int index=0)
 
- Public Member Functions inherited from ocra::Function
virtual ~Function ()
 
int getDimension () const
 
virtual void updateFdot () const
 
virtual void updateFddot () const
 
virtual void updateJdotXdot () const
 
const VariablegetVariable () const
 
VariablegetVariable ()
 
template<eFunctionAbility Ability>
void invalidate ()
 
void invalidateAll (int timestamp)
 
void invalidateAll ()
 
template<eFunctionAbility Ability>
bool isValid () const
 
template<eFunctionAbility Ability>
bool canCompute () const
 
template<eFunctionAbility Ability>
const IFunction< Ability >::return_type & get () const
 
template<eFunctionAbility Ability>
IFunction< Ability >::return_sub_type get (int index) const
 
const VectorXd & getValue () const
 
double getValue (int index) const
 
const MatrixXd & getJacobian () const
 
MatrixXdRow getJacobian (int index) const
 
- 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::IFunctionProperties
bool hasSeparableTimeDependancy (void) const
 
eFunctionLinearity getType (void) const
 
eFunctionConvexity getConvexityProperty (void) const
 
int getContinuityProperty (void) const
 
const std::string & getProperty (int i) const
 
int getNumberOfProperties (void) const
 
bool hasProperty (const std::string &functionProperty) const
 
bool isExplicitlyTimeDependant (void) const
 
- Public Member Functions inherited from ocra::NamedInstance
 NamedInstance (const std::string &name)
 
const std::string & getName () const
 
virtual ~NamedInstance ()
 
- Public Member Functions inherited from ocra::AbilitySet
AbilitySetadd (eFunctionAbility prop)
 
AbilitySetremove (eFunctionAbility prop)
 

Protected Member Functions

 QuadraticFunction (Variable &x, int dimension=1)
 
virtual void updateValue () const
 
virtual void updateJacobian () const
 
virtual void updateHessian () const
 
virtual void updateq () const
 
virtual void updater () const
 
virtual void doUpdateInputSizeEnd ()
 
virtual void doUpdateDimensionEnd (int oldDimension)
 
virtual void doChangePi (const MatrixXd &Pi, int index)
 
virtual void doChangeqi (const VectorXd &qi, int index)
 
virtual void doChangeri (double ri, int index)
 
void invalidateq (int timestamp)
 
void invalidater (int timestamp)
 
void inhibitPropagationFrom_q_or_r () const
 
void desinhibitPropagationFrom_q_or_r () const
 
- Protected Member Functions inherited from ocra::Function
 Function (Variable &x, int dimension, eFunctionLinearity linearity=LINEARITY_UNDEFINED, eFunctionConvexity convexity=CONVEXITY_UNDEFINED, int continuity=CONTINUITY_UNKNOWN, bool explicitlyTimeDependant=false, bool separableTimeDependancy=true)
 Function Constructor. More...
 
void disconnectVariable ()
 
void changeFunctionDimension (int newDimension)
 
void updateInputSize (int timestamp)
 
void resize ()
 
virtual int computeDimensionFromInputSize () const
 
virtual void doUpdateInputSizeBegin ()
 
virtual void doUpdateDimensionBegin (int newDimension)
 
- 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 Member Functions inherited from ocra::IFunctionProperties
 IFunctionProperties (eFunctionLinearity linearity=LINEARITY_UNDEFINED, eFunctionConvexity convexity=CONVEXITY_UNDEFINED, int continuity=CONTINUITY_UNKNOWN, bool explicitlyTimeDependant=false, bool separableTimeDependancy=true)
 IFunctionProperties Constructor. More...
 
void changeType (eFunctionLinearity newType)
 
void changeConvexityProperty (eFunctionConvexity newProperty)
 
void changeContinuityProperty (int newProperty)
 
void addProperty (const std::string &functionProperty)
 
void removeProperty (const std::string &functionProperty)
 
void changeExplicitTimeDependancy (bool b)
 
void changeSeparableTimeDependancy (bool b)
 
- Protected Member Functions inherited from ocra::AbilitySet
 AbilitySet (const std::vector< bool > &usageSet)
 
const std::vector< bool > & getUsageSet () const
 
 AbilitySet (eFunctionAbility prop0=FUN_VALUE, eFunctionAbility prop1=FUN_VALUE)
 
 AbilitySet (eFunctionAbility prop0, eFunctionAbility prop1, eFunctionAbility prop2, eFunctionAbility prop3=FUN_VALUE, eFunctionAbility prop4=FUN_VALUE)
 
 AbilitySet (eFunctionAbility prop0, eFunctionAbility prop1, eFunctionAbility prop2, eFunctionAbility prop3, eFunctionAbility prop4, eFunctionAbility prop5, eFunctionAbility prop6=FUN_VALUE, eFunctionAbility prop7=FUN_VALUE, eFunctionAbility prop8=FUN_VALUE, eFunctionAbility prop9=FUN_VALUE)
 
- Protected Member Functions inherited from ocra::CoupledInputOutputSize
 CoupledInputOutputSize (bool coupledInputOutputSize)
 
bool inputAndOutputSizesAreCoupled () const
 

Protected Attributes

std::vector< VectorXd * > _q
 
VectorXd _r
 
bool _qIsUpToDate
 
bool _rIsUpToDate
 
- Protected Attributes inherited from ocra::Function
Variablex
 
VectorXd & _value
 
MatrixXd & _jacobian
 
const int & _dim
 

Additional Inherited Members

- 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

QuadraticFunction class.

Warning
None

A quadratic function with & f_i(x) = 1/2 x^T P_i x + q_i^T x + r_i & for each dimension of the function, with $ P_i $ a symmetric, non null matrix of size nxn, $ q_i $ a vector of size n and $ r_i $ a real.

Definition at line 32 of file QuadraticFunction.h.

Member Typedef Documentation

Definition at line 37 of file QuadraticFunction.h.

Constructor & Destructor Documentation

ocra::QuadraticFunction::QuadraticFunction ( Variable x,
int  dimension = 1 
)
protected

Light constructor to be used by derived classes.

Definition at line 5 of file QuadraticFunction.cpp.

template<class Derived , class VectorBase >
ocra::QuadraticFunction::QuadraticFunction ( Variable x,
const MatrixBase< Derived > &  P,
const VectorBase &  q,
double  r 
)
inline

Constructor for a unidimensional function

Definition at line 54 of file QuadraticFunction.h.

ocra::QuadraticFunction::~QuadraticFunction ( )
virtual

Definition at line 21 of file QuadraticFunction.cpp.

Member Function Documentation

void ocra::QuadraticFunction::changePi ( const MatrixXd &  Pi,
int  index = 0 
)

Definition at line 27 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::changeqi ( const VectorXd &  qi,
int  index = 0 
)

Definition at line 40 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::changeri ( double  ri,
int  index = 0 
)

Definition at line 51 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::desinhibitPropagationFrom_q_or_r ( ) const
protected

Definition at line 160 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::doChangePi ( const MatrixXd &  Pi,
int  index 
)
protectedvirtual

Reimplemented in ocra::WeightedSquareDistanceFunction.

Definition at line 60 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::doChangeqi ( const VectorXd &  qi,
int  index 
)
protectedvirtual

Reimplemented in ocra::WeightedSquareDistanceFunction.

Definition at line 66 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::doChangeri ( double  ri,
int  index 
)
protectedvirtual

Reimplemented in ocra::WeightedSquareDistanceFunction.

Definition at line 71 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::doUpdateDimensionEnd ( int  oldDimension)
protectedvirtual

Reimplemented from ocra::Function.

Definition at line 122 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::doUpdateInputSizeEnd ( void  )
protectedvirtual

Reimplemented from ocra::Function.

Reimplemented in ocra::WeightedSquareDistanceFunction.

Definition at line 115 of file QuadraticFunction.cpp.

const MatrixXd & ocra::QuadraticFunction::getPi ( int  index = 0) const
inline

Definition at line 126 of file QuadraticFunction.h.

const VectorXd & ocra::QuadraticFunction::getqi ( int  index = 0) const
inline

Definition at line 132 of file QuadraticFunction.h.

const VectorXd & ocra::QuadraticFunction::getr ( ) const
inline

Definition at line 148 of file QuadraticFunction.h.

double ocra::QuadraticFunction::getri ( int  index = 0) const
inline

Definition at line 143 of file QuadraticFunction.h.

void ocra::QuadraticFunction::inhibitPropagationFrom_q_or_r ( ) const
protected

Inhibit/desinhibit the fact that a call to invalidateq or invalidater triggers a EVT_CHANGE_VALUE event, which is done by default. This is meant to prevent multiple propagation of EVT_CHANGE_VALUE in case of complex update dependencies.

Definition at line 155 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::invalidateq ( int  timestamp)
protected

Definition at line 143 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::invalidater ( int  timestamp)
protected

Definition at line 149 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::updateHessian ( ) const
protectedvirtual

Reimplemented in ocra::SquaredLinearFunction, and ocra::FcQuadraticFunction.

Definition at line 100 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::updateJacobian ( ) const
protectedvirtual

Reimplemented in ocra::WeightedSquareDistanceFunction.

Definition at line 90 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::updateq ( ) const
protectedvirtual

Reimplemented in ocra::SquaredLinearFunction, and ocra::FcQuadraticFunction.

Definition at line 105 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::updater ( ) const
protectedvirtual

Reimplemented in ocra::SquaredLinearFunction, and ocra::FcQuadraticFunction.

Definition at line 110 of file QuadraticFunction.cpp.

void ocra::QuadraticFunction::updateValue ( ) const
protectedvirtual

Reimplemented in ocra::WeightedSquareDistanceFunction.

Definition at line 77 of file QuadraticFunction.cpp.

Member Data Documentation

std::vector<VectorXd*> ocra::QuadraticFunction::_q
mutableprotected

Definition at line 116 of file QuadraticFunction.h.

bool ocra::QuadraticFunction::_qIsUpToDate
mutableprotected

Definition at line 118 of file QuadraticFunction.h.

VectorXd ocra::QuadraticFunction::_r
mutableprotected

Definition at line 117 of file QuadraticFunction.h.

bool ocra::QuadraticFunction::_rIsUpToDate
mutableprotected

Definition at line 119 of file QuadraticFunction.h.


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