Class Aggregated
Defined in File Aggregated.h
Inheritance Relationships
Base Type
public OpenSoT::Task< Eigen::MatrixXd, Eigen::VectorXd >
(Template Class Task)
Class Documentation
-
class Aggregated : public OpenSoT::Task<Eigen::MatrixXd, Eigen::VectorXd>
The Aggregated class builds a new Task by piling up simpler tasks so that \(A = [A_1; A_2]\), \(b=[b_1;b_2]\) If the tasks are modified (through their methods, or constraints are added to the tasks), the Aggregated gets updated accordingly (after calling the _update() function), and during the update it will automatically call update() on every single task of which is comprised.
Updating an Aggregated calls the update method for the corresponding father task which it reduces, and recreates the reduced A,b and Weight matrices. It is possible to add constraints to the Aggregated task which are not constraints to the Tasks of which it is comprised. Take a look at getConstraints(), getAggregatedConstraints(), getOwnConstraints() for more infos. Notice that setLambda will change the lambda of all the internal tasks but if one of these lambda is changed outside this will be not visible in the aggregated
Public Functions
-
Aggregated(const std::list<TaskPtr> tasks, const unsigned int x_size)
-
- Parameters
bounds – a std::list of Tasks
x_size – the size of the input vector. Notice this constructor will NOT call update() on the base tasks
-
Aggregated(TaskPtr task1, TaskPtr task2, const unsigned int x_size)
-
Aggregated(TaskPtr task, const unsigned int x_size)
-
~Aggregated()
-
virtual void _update()
Updates the A, b, Aeq, beq, Aineq, b*Bound matrices.
-
inline std::list<ConstraintPtr> &getOwnConstraints()
getConstraints return a reference to the constraint list.
Use the standard list methods to add to the constraints list. i.e.: task.getConstraints().push_back(new_constraint) Notice that the constraints that getConstraints returns are regenerated after each call to the _update() function. A simple check is made before regenerating the constraints, so that if a new constraints gets added to the list before the update, if the constraint is added with a push_back (i.e., at the back of the list), it will be copied to the ownConstraints list of constraints permanently. Notice however that adding constraints in this way is not considered efficient, you should directly add them to the ownConstraints list, by calling, i.e.: task.getOwnConstraints().push_back(new_constraint) If you want to remove constraints which are not ownConstraints, please remove them from the Tasks of which the Aggregated
is composed from.
getOwnConstraints return a reference to the
Aggregated task own constraints list. The ownConstraints list is used together with all the constraints of every task to generate the final constraints list. Use the standard list methods to add, remove, clear, … the constraints list. e.g.: task.getConstraints().push_back(new_constraint)- Returns
a generated list of pointers to constraints
- Returns
the list of constraints for this task
-
inline const std::list<ConstraintPtr> &getAggregatedConstraints()
getAggregatedConstraints return a reference to the aggregation of the tasks constraint list.
The list cannot be modified, as it is generated starting from all the constraints. If you need to modify this list, you can do it indirectly by modifying the list of constraints of the tasks that compose this Aggregated, and calling _update() on the Aggregated
- Returns
the list composed of the constraints for all the tasks included in this Aggregated
-
inline const std::list<TaskPtr> &getTaskList()
-
virtual void setLambda(double lambda)
setLambda set the lambda to ALL the aggregated tasks to the same value lambda.
The lambda associated to the Aggregate and the lambda associated to the tasks are different if a Aggregated.setLambda(lambda) is not called.
- Parameters
lambda – a value for all the tasks in the aggregate
Public Static Functions
Protected Functions
-
void generateAll()
-
void generateConstraints()
-
void generateAggregatedConstraints()
-
void generateWeight()
-
HessianType computeHessianType()
computeHessianType compute the new Hessian type associated to the Aggregated version of the Tasks.
In OpenSoT, all the considered Hessians \(H\) are in particular Hermitians and positive semidefinite/definite. Let consider two matrices \(A\) and \(B\) with Hessians \(H_A = A^TA\) and \(H_B=B^TB\), the Aggregated Task \(C\) is computed as: \( \begin{equation} C = \left[A^T \quad B^T\right]^T \end{equation} \) and the associated Hessian \(H_C\) is computed as: \( \begin{equation} H_C = \left[A^T \quad B^T\right]\left[A^T \quad B^T\right]^T \\ = A^TA + B^TB = H_A + H_B \end{equation} \) In general for an arbitrary number of tasks we can say \(H_{Agg} = \displaystyle\sum_{i}^{n} H_i\). Therefore the problem of determine the new Hessian type for the Aggregated Task can be considered as the problem to determine the Hessian type of the sum of different matrices with known Hessian type. Observation: The sum of any two positive definite matrices of the same size is positive definite. More generally, any nonnegative linear combination of positive semidefinite matrices is positive semidefinite (Roger A. Horn and Charles R. Johnson, Matrix Analysis, Cambridge University Press, 1996, p.398). With these considerations in mind, the method will return: HST_UNKNOWN if at least one of the Hessians in HST_UNKNOWN HST_ZERO if all the Hessians are HST_ZERO HST_POSDEF if at least one Hessian is HST_POSDEF (and none HST_UNKNOWN) HST_SEMIDEF if all one Hessian is HST_SEMIDEF (and none HST_UNKNOWN)
TO DO: Take in consideration also \(\beta\) and \(\W\)!
- Returns
the Hessian type
-
void checkSizes()
Protected Attributes
-
std::list<TaskPtr> _tasks
-
std::list<ConstraintPtr> _ownConstraints
-
std::list<ConstraintPtr> _aggregatedConstraints
-
MatrixPiler _tmpA
-
VectorPiler _tmpb
-
unsigned int _aggregationPolicy
Protected Static Functions
-
static const std::string concatenateTaskIds(const std::list<TaskPtr> tasks)
-
Aggregated(const std::list<TaskPtr> tasks, const unsigned int x_size)