Template Class Constraint
Defined in File Constraint.h
Class Documentation
-
template<class Matrix_type, class Vector_type>
class Constraint The Constraint class describes all the different types of constraints:
bounds & bilateral
equalities
unilateral
Public Types
-
typedef Constraint<Matrix_type, Vector_type> ConstraintType
-
typedef std::shared_ptr<ConstraintType> ConstraintPtr
Public Functions
-
inline Constraint(const std::string constraint_id, const unsigned int x_size)
-
inline virtual ~Constraint()
-
inline const unsigned int getXSize()
-
inline virtual const Vector_type &getLowerBound()
-
inline virtual const Vector_type &getUpperBound()
-
inline virtual const Matrix_type &getAeq()
-
inline virtual const Vector_type &getbeq()
-
inline virtual const Matrix_type &getAineq()
-
inline virtual const Vector_type &getbLowerBound()
-
inline virtual const Vector_type &getbUpperBound()
-
inline virtual bool isEqualityConstraint()
isEqualityConstraint
- Returns
true if Constraint enforces an equality constraint
-
inline virtual bool isInequalityConstraint()
isEqualityConstraint
- Returns
true if Constraint enforces an inequality constraint
-
inline virtual bool isUnilateralConstraint()
isUnilateralConstraint
- Returns
true if the Constraint is an unilateral inequality
-
inline virtual bool isBilateralConstraint()
isBilateralConstraint
- Returns
true if the Constraint is a bilateral inequality
-
inline virtual bool hasBounds()
hasBounds checks whether this Constraint contains a bound (or box constraint), meaning the constraint matrix $A^T=\left(I \quad \tilde{A}^T\right)$
- Returns
true if Constraint if this constraint contains a bound
-
inline virtual bool isBound()
isBound checks whether this Constraint is a bound in the form lowerBound <= x <= upperBound, meaning the constraint matrix $A = I$ is a box constraint
- Returns
true if Constraint is a bound
-
inline virtual bool isConstraint()
isConstraint checks whether this Constraint is a constraint (i.e., it is not a bound)
- Returns
true if the Constraint is not a bound
-
inline std::string getConstraintID()
getTaskID return the task id
- Returns
a string with the task id
-
inline virtual void update()
Updates the A, b, Aeq, beq, Aineq, b*Bound matrices.
-
inline virtual void log(XBot::MatLogger2::Ptr logger)
log logs common Constraint internal variables
- Parameters
logger – a shared pointer to a MathLogger
-
inline bool checkConsistency()
checkConsistency checks if all internal matrices and vectors are correctly instantiated and the right size
- Returns
true if everything is ok
Protected Functions
-
inline virtual void _log(XBot::MatLogger2::Ptr logger)
_log can be used to log internal Constraint variables
- Parameters
logger – a shared pointer to a MatLogger
Protected Attributes
-
std::string _constraint_id
_constraint_id unique name of the constraint
-
unsigned int _x_size
_x_size size of the controlled variables
-
Vector_type _lowerBound
_lowerBound lower bounds on controlled variables e.g.
: _lowerBound <= x
-
Vector_type _upperBound
_upperBound upper bounds on controlled variables e.g.
: x <= _upperBound
-
Matrix_type _Aeq
_Aeq Matrix for equality constraint e.g.
: _Aeq*x = _beq
-
Vector_type _beq
_beq constraint vector for equality constraint e.g.
: _Aeq*x = _beq
-
Matrix_type _Aineq
_Aineq Matrix for inequality constraint e.g.
: _bLowerBound <= _Aineq*x <= _bUpperBound
-
Vector_type _bLowerBound
_bLowerBound lower bounds in generic inequality constraints e.g.
: _bLowerBound <= _Aineq*x
-
Vector_type _bUpperBound
_bUpperBound upper bounds in generic inequality constraints e.g.
: _Aineq*x <= _bUpperBound