ocra-recipes
Doxygen documentation for the ocra-recipes repository
Public Member Functions | Protected Attributes | List of all members
ocra::Constraint< Function > Class Template Reference

#include <Constraint.h>

Inheritance diagram for ocra::Constraint< Function >:
[legend]
Collaboration diagram for ocra::Constraint< Function >:
[legend]

Public Member Functions

bool isRespected (int index=-1) const
 
 Constraint (Function *function, bool equality, const VectorXd &v=VectorXd())
 
 Constraint (Function *function, const VectorXd &l=VectorXd(), const VectorXd &u=VectorXd())
 
virtual FunctiongetFunction ()
 
virtual const FunctiongetFunction () const
 
bool isEquality () const
 
bool isInequality () const
 
void setB (const VectorXd &b)
 
void setL (const VectorXd &l)
 
void setU (const VectorXd &u)
 
void setLandU (const VectorXd &l, const VectorXd &u)
 
eConstraintType getType () const
 
const VectorXd & getB () const
 
const VectorXd & getL () const
 
const VectorXd & getU () const
 
void setViolationTolerance (double tol)
 
double getViolationTolerance () const
 
- Public Member Functions inherited from ocra::SubjectBase< EVT_CSTR_CHANGE_BOUNDS_NUMBER >
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
 

Protected Attributes

Function_function
 

Additional Inherited Members

- Protected Member Functions inherited from ocra::SubjectBase< EVT_CSTR_CHANGE_BOUNDS_NUMBER >
 SubjectBase ()
 
 ~SubjectBase ()
 

Detailed Description

template<>
class ocra::Constraint< Function >

Definition at line 174 of file Constraint.h.

Constructor & Destructor Documentation

ocra::Constraint< Function >::Constraint ( Function function,
bool  equality,
const VectorXd &  v = VectorXd() 
)
inline

Specializations of the generic Constraint<T> constructors

Definition at line 593 of file Constraint.h.

ocra::Constraint< Function >::Constraint ( Function function,
const VectorXd &  l = VectorXd(),
const VectorXd &  u = VectorXd() 
)
inline

Definition at line 618 of file Constraint.h.

Member Function Documentation

const VectorXd & ocra::Constraint< Function >::getB ( ) const
inline

Get the right member of an equality constraint.

Precondition
isEquality()==true.

Definition at line 543 of file Constraint.h.

virtual Function& ocra::Constraint< Function >::getFunction ( void  )
inlinevirtual

Returns the function associated with the constraint

Definition at line 231 of file Constraint.h.

virtual const Function& ocra::Constraint< Function >::getFunction ( void  ) const
inlinevirtual

Definition at line 232 of file Constraint.h.

const VectorXd & ocra::Constraint< Function >::getL ( ) const
inline

Get the lower bound of an inequality constraint.

Precondition
isEquality()==false.

Definition at line 549 of file Constraint.h.

eConstraintType ocra::Constraint< Function >::getType ( ) const
inline

getters on the datas of Constraint

Definition at line 538 of file Constraint.h.

const VectorXd & ocra::Constraint< Function >::getU ( ) const
inline

Get the upper bound of an inequality constraint.

Precondition
isEquality()==false.

Definition at line 555 of file Constraint.h.

double ocra::Constraint< Function >::getViolationTolerance ( ) const
inline

Definition at line 567 of file Constraint.h.

bool ocra::Constraint< Function >::isEquality ( ) const
inline

Equality/Inequality property accessor

Definition at line 396 of file Constraint.h.

bool ocra::Constraint< Function >::isInequality ( ) const
inline

Definition at line 401 of file Constraint.h.

bool ocra::Constraint< Function >::isRespected ( int  index = -1) const
inline

Return true if the ith component of the constraint is valid for the actual value of its function, false otherwise. If the parameter is non-positive, it will check for the validity of all the components. Validity of a component is check with respect to the violation tolerance. This tolerance is 1.e-7 by default and can be changed with setViolationTolerance()

Parameters
[in]index.Index of the constraint component. If non-positive (as with the default value), all components will be considered

Definition at line 360 of file Constraint.h.

void ocra::Constraint< Function >::setB ( const VectorXd &  b)
inline

All of the following methods do not change the equality/inequality property of the constraint. In particular, changing l and or u for an inequality constraint so as to have l = u will not make it become an equality constraint.Set the right member of an equality constraint. If b is null the constraint is considered as an equality to zero (type CSTR_EQUAL_ZERO). If not, it stays or becomes an equality to b (type CSTR_EQUAL_B).

Precondition
isEquality()==true
If b is not null then b.size==getDimension()

Definition at line 406 of file Constraint.h.

void ocra::Constraint< Function >::setL ( const VectorXd &  l)
inline

Set the lower bound of an inequality constraint. If l is null, the lower bound of the contraint is removed (if applicable). In case the constraint only had a lower bound, this bound is set to zero. If l is not null, the lower bound is changed to the value of l. If the constraint had no lower bound it is created and set to l.

Precondition
isInequality()==true
If l is not null then l.size==getDimension()
If l is not null, l<_u

Definition at line 419 of file Constraint.h.

void ocra::Constraint< Function >::setLandU ( const VectorXd &  l,
const VectorXd &  u 
)
inline

This method combines setL() and setU(). It is provided to avoid breaking the precondition l<u of setL() or setU(), which could happen by calling sequentially both methods while the new l and u are perfectly valid. In case l or u is null (including the case when both are null), the method calls setL() and setU() in the proper order.

Precondition
isInequality()==true.
If l and u are not null, l<u.
If l or u is null, the precondition of setL() and setU().
See also
setL(), setU().

Definition at line 497 of file Constraint.h.

void ocra::Constraint< Function >::setU ( const VectorXd &  u)
inline

Set the upper bound of an inequality constraint. If u is null, the upper bound of the contraint is removed (if applicable). In case the constraint only had an upper bound, this bound is set to zero. If u is not null, the upper bound is changed to the value of u. If the constraint had no upper bound it is created and set to u.

Precondition
isInequality()==true
If u is not null then u.size==getDimension()
If u is not null, _l<u

Definition at line 458 of file Constraint.h.

void ocra::Constraint< Function >::setViolationTolerance ( double  tol)
inline

getter and setter for the constraint violation tolerance

Precondition
tol>=0

Definition at line 561 of file Constraint.h.

Member Data Documentation

Function& ocra::Constraint< Function >::_function
protected

Definition at line 342 of file Constraint.h.


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