humoto
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
humoto::constraints::ConstraintsASU< t_Base > Class Template Reference

Detailed Description

template<class t_Base>
class humoto::constraints::ConstraintsASU< t_Base >

Constraints 'A*S*x <= ub'.

Template Parameters
t_BaseBase class (humoto::constraints::ConstraintsBase or humoto::TaskBase)

Definition at line 386 of file constraints.h.

#include <constraints.h>

Inheritance diagram for humoto::constraints::ConstraintsASU< t_Base >:
Inheritance graph

Public Member Functions

void checkConsistency () const
 Check consistency of the constraints. More...
 
void computeViolations (ViolationsConstraints &violations, const Location &location, const Solution &solution) const
 Compute violations given a solution vector. More...
 
void copyBodyTo (Eigen::MatrixXd &A, const Location &location) const
 Copy body to the given matrix. More...
 
void copyBoundsTo (Eigen::VectorXd &lb, Eigen::VectorXd &ub, const Location &location) const
 Copy bounds to given vectors. More...
 
void copyNegativeBodyTo (Eigen::MatrixXd &A, const Location &location) const
 Copy body to the given matrix. More...
 
std::size_t copyTo (ContainerALU &container, const std::size_t constraints_offset) const
 Set constraints. More...
 
virtual std::size_t copyTo (ContainerAL &container, const std::size_t constraints_offset) const
 Set constraints. More...
 
void determineActiveSet (ActiveSetConstraints &active_set, const Location &location, const Solution &solution) const
 Determine active set given a solution vector. More...
 
Eigen::MatrixXd & getA ()
 Get matrix A from general constraints: 'A*x = b', 'lb <= A*x <= ub'. More...
 
const Eigen::MatrixXd & getA () const
 Get matrix A from general constraints: 'A*x = b', 'lb <= A*x <= ub'. More...
 
std::size_t getNumberOfConstraints () const
 Returns number of constraints in the task. More...
 
std::ptrdiff_t getOffset () const
 Get offset of body part in the constriaints. More...
 
double getProduct (const std::size_t i, const Eigen::VectorXd &vector) const
 Compute A(i,:) * vector. More...
 
ConstraintType::Type getType () const
 Returns type of the constraints. More...
 
Eigen::VectorXd & getUpperBounds ()
 Get upper bounds (ub vectors from 'A*x <= ub'). More...
 
const Eigen::VectorXd & getUpperBounds () const
 Get upper bounds (ub vectors from 'A*x <= ub'). More...
 
void setOffset (const std::ptrdiff_t offset)
 Set offset of body part in the constriaints. More...
 

Protected Member Functions

 ConstraintsASU ()
 
 ~ConstraintsASU ()
 Protected destructor: prevent destruction of the child classes through a base pointer. More...
 
void addATA (Eigen::MatrixXd &H) const
 Compute 'A^T * A' for general equality constaints and save or add the result to H. More...
 
void getATA (Eigen::MatrixXd &H) const
 Compute 'A^T * A' for general equality constaints and save or add the result to H. More...
 
void logBody (humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="constraints") const
 Log body. More...
 
void logBounds (humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="constraints") const
 Log bounds. More...
 
void resetBody (const std::size_t number_of_constraints, const bool initialize_matrices=false)
 Initialize A. More...
 
void resetBounds (const std::size_t number_of_constraints, const bool initialize_matrices=false)
 Reset bounds of constraints (b, lb, ub) More...
 

Protected Attributes

Eigen::MatrixXd A_
 
std::ptrdiff_t offset_
 
Eigen::VectorXd ub_
 

Constructor & Destructor Documentation

◆ ~ConstraintsASU()

template<class t_Base>
humoto::constraints::ConstraintsASU< t_Base >::~ConstraintsASU ( )
inlineprotected

Protected destructor: prevent destruction of the child classes through a base pointer.

Definition at line 393 of file constraints.h.

◆ ConstraintsASU()

template<class t_Base>
humoto::constraints::ConstraintsASU< t_Base >::ConstraintsASU ( )
inlineprotected

Definition at line 394 of file constraints.h.

Member Function Documentation

◆ addATA()

void humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::addATA ( Eigen::MatrixXd &  H) const
inlineprotectedinherited

Compute 'A^T * A' for general equality constaints and save or add the result to H.

Parameters
[in,out]Hleft lower triangular part of the result.
Attention
Only the left lower triangular part of H is formed. Apply appropriate conversion with etools::convertLLTtoSymmetric() before using H.

Definition at line 641 of file constraints_mixins.h.

◆ checkConsistency()

template<class t_Base>
void humoto::constraints::ConstraintsASU< t_Base >::checkConsistency ( ) const
inline

Check consistency of the constraints.

Definition at line 412 of file constraints.h.

◆ computeViolations()

void humoto::constraints::ViolationsComputationUMixin< ActiveSetDeterminationUMixin< BodyASMixin< BoundsUMixin< t_Base > > > >::computeViolations ( ViolationsConstraints violations,
const Location location,
const Solution solution 
) const
inlineinherited

Compute violations given a solution vector.

Parameters
[in,out]violationsviolations
[in]locationlocation of the constraints in the active set
[in]solutionsolution vector

Definition at line 1300 of file constraints_mixins.h.

◆ copyBodyTo()

void humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::copyBodyTo ( Eigen::MatrixXd &  A,
const Location location 
) const
inlineinherited

Copy body to the given matrix.

Parameters
[in]A
[in]locationoffset and length

Definition at line 689 of file constraints_mixins.h.

◆ copyBoundsTo()

template<class t_Base>
void humoto::constraints::BoundsUMixin< t_Base >::copyBoundsTo ( Eigen::VectorXd &  lb,
Eigen::VectorXd &  ub,
const Location location 
) const
inlineinherited

Copy bounds to given vectors.

Parameters
[in]lb
[in]ub
[in]locationoffset and length

Reimplemented in humoto::constraints::BoundsLUMixin< TaskBase >.

Definition at line 347 of file constraints_mixins.h.

◆ copyNegativeBodyTo()

void humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::copyNegativeBodyTo ( Eigen::MatrixXd &  A,
const Location location 
) const
inlineinherited

Copy body to the given matrix.

Parameters
[in]A
[in]locationoffset and length

Definition at line 705 of file constraints_mixins.h.

◆ copyTo() [1/2]

std::size_t humoto::constraints::CopyAnyToALUMixin< ViolationsComputationUMixin< ActiveSetDeterminationUMixin< BodyASMixin< BoundsUMixin< t_Base > > > > >::copyTo ( ContainerALU container,
const std::size_t  constraints_offset 
) const
inlineinherited

Set constraints.

Parameters
[in,out]containernew constraints
[in]constraints_offsetfirst row offset
Returns
offset of the end of added constraints

Definition at line 615 of file constraints_base.h.

◆ copyTo() [2/2]

virtual std::size_t humoto::constraints::CopyUpperInequalityToALMixin< CopyAnyToALUMixin< ViolationsComputationUMixin< ActiveSetDeterminationUMixin< BodyASMixin< BoundsUMixin< t_Base > > > > > >::copyTo ( ContainerAL container,
const std::size_t  constraints_offset 
) const
inlinevirtualinherited

Set constraints.

Parameters
[in,out]containernew constraints
[in]constraints_offsetfirst row offset
Returns
offset of the end of added constraints

Definition at line 680 of file constraints_base.h.

◆ determineActiveSet()

void humoto::constraints::ActiveSetDeterminationUMixin< BodyASMixin< BoundsUMixin< t_Base > > >::determineActiveSet ( ActiveSetConstraints active_set,
const Location location,
const Solution solution 
) const
inlineinherited

Determine active set given a solution vector.

Parameters
[in,out]active_setactive set
[in]locationlocation of the constraints in the active set
[in]solutionsolution vector

Definition at line 1151 of file constraints_mixins.h.

◆ getA() [1/2]

Eigen::MatrixXd& humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::getA ( )
inlineinherited

Get matrix A from general constraints: 'A*x = b', 'lb <= A*x <= ub'.

Returns
matrix A

Definition at line 654 of file constraints_mixins.h.

◆ getA() [2/2]

const Eigen::MatrixXd& humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::getA ( ) const
inlineinherited

Get matrix A from general constraints: 'A*x = b', 'lb <= A*x <= ub'.

Returns
matrix A

Definition at line 660 of file constraints_mixins.h.

◆ getATA()

void humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::getATA ( Eigen::MatrixXd &  H) const
inlineprotectedinherited

Compute 'A^T * A' for general equality constaints and save or add the result to H.

Parameters
[in,out]Hleft lower triangular part of the result.
Attention
Only the left lower triangular part of H is formed. Apply appropriate conversion with etools::convertLLTtoSymmetric() before using H.

Definition at line 634 of file constraints_mixins.h.

◆ getNumberOfConstraints()

std::size_t humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::getNumberOfConstraints ( ) const
inlineinherited

Returns number of constraints in the task.

Returns
number of constraints

Definition at line 721 of file constraints_mixins.h.

◆ getOffset()

std::ptrdiff_t humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::getOffset ( ) const
inlineinherited

Get offset of body part in the constriaints.

Returns
offset

Definition at line 671 of file constraints_mixins.h.

◆ getProduct()

double humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::getProduct ( const std::size_t  i,
const Eigen::VectorXd &  vector 
) const
inlineinherited

Compute A(i,:) * vector.

Parameters
[in]irow index
[in]vectorvector
Returns
result of multiplication

Definition at line 728 of file constraints_mixins.h.

◆ getType()

template<class t_Base>
ConstraintType::Type humoto::constraints::ConstraintsASU< t_Base >::getType ( ) const
inline

Returns type of the constraints.

Returns
type of the constraints

Definition at line 405 of file constraints.h.

◆ getUpperBounds() [1/2]

template<class t_Base>
Eigen::VectorXd& humoto::constraints::BoundsUMixin< t_Base >::getUpperBounds ( )
inlineinherited

Get upper bounds (ub vectors from 'A*x <= ub').

Returns
upper bounds.

Definition at line 333 of file constraints_mixins.h.

◆ getUpperBounds() [2/2]

template<class t_Base>
const Eigen::VectorXd& humoto::constraints::BoundsUMixin< t_Base >::getUpperBounds ( ) const
inlineinherited

Get upper bounds (ub vectors from 'A*x <= ub').

Returns
upper bounds.

Definition at line 340 of file constraints_mixins.h.

◆ logBody()

void humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::logBody ( humoto::Logger logger,
const LogEntryName parent = LogEntryName(),
const std::string &  name = "constraints" 
) const
inlineprotectedinherited

Log body.

Parameters
[in,out]loggerlogger
[in]parentparent
[in]namename

Definition at line 623 of file constraints_mixins.h.

◆ logBounds()

template<class t_Base>
void humoto::constraints::BoundsUMixin< t_Base >::logBounds ( humoto::Logger logger,
const LogEntryName parent = LogEntryName(),
const std::string &  name = "constraints" 
) const
inlineprotectedinherited

Log bounds.

Parameters
[in,out]loggerlogger
[in]parentparent
[in]namename

Reimplemented in humoto::constraints::BoundsLUMixin< TaskBase >, and humoto::constraints::BoundsLUMixin< ContainerBase >.

Definition at line 318 of file constraints_mixins.h.

◆ resetBody()

void humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::resetBody ( const std::size_t  number_of_constraints,
const bool  initialize_matrices = false 
)
inlineprotectedinherited

Initialize A.

Parameters
[in]number_of_constraintsnumber of constraints
[in]initialize_matricesinitialize matrices using defaults

Initialization:

  • A is filled with zeros

Definition at line 608 of file constraints_mixins.h.

◆ resetBounds()

template<class t_Base>
void humoto::constraints::BoundsUMixin< t_Base >::resetBounds ( const std::size_t  number_of_constraints,
const bool  initialize_matrices = false 
)
inlineprotectedinherited

Reset bounds of constraints (b, lb, ub)

Parameters
[in]number_of_constraintsnumber of constraints
[in]initialize_matricesinitialize matrices using defaults
Note
Initialization: ub is set to humoto::g_infinity

Reimplemented in humoto::constraints::BoundsLUMixin< TaskBase >, and humoto::constraints::BoundsLUMixin< ContainerBase >.

Definition at line 304 of file constraints_mixins.h.

◆ setOffset()

void humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::setOffset ( const std::ptrdiff_t  offset)
inlineinherited

Set offset of body part in the constriaints.

Parameters
[in]offset

Definition at line 682 of file constraints_mixins.h.

Member Data Documentation

◆ A_

Eigen::MatrixXd humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::A_
protectedinherited

Definition at line 583 of file constraints_mixins.h.

◆ offset_

std::ptrdiff_t humoto::constraints::BodyASMixin< BoundsUMixin< t_Base > >::offset_
protectedinherited

Definition at line 584 of file constraints_mixins.h.

◆ ub_

template<class t_Base>
Eigen::VectorXd humoto::constraints::BoundsUMixin< t_Base >::ub_
protectedinherited

Definition at line 288 of file constraints_mixins.h.


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