|
cisst-saw
|
nmrConstraintOptimizer: A class that makes using the constraint control algorithm more efficient More...
#include <nmrConstraintOptimizer.h>
Public Types | |
| enum | STATUS { NMR_OK , NMR_EQ_CONTRADICTION , NMR_INEQ_CONTRADICTION , NMR_BOTH_CONTRADICTION , NMR_MALFORMED , NMR_EMPTY } |
Public Member Functions | |
| nmrConstraintOptimizer () | |
| ~nmrConstraintOptimizer () | |
| nmrConstraintOptimizer (const size_t n) | |
| STATUS | Solve (vctDoubleVec &dq) |
| Calls the solver and stores the result in dq. | |
| void | ResetIndices (void) |
| Clear all indices. | |
| void | Allocate (void) |
| Allocate memory indicated by indices. | |
| void | Allocate (const size_t CRows, const size_t CCols, const size_t ARows, const size_t ACols, const size_t ERows, const size_t ECols) |
| Allocate memory indicated by input. | |
| void | ReserveSpace (const size_t CRows, const size_t ARows, const size_t ERows, const size_t num_slacks) |
| Reserves space in the tableau. | |
| void | SetRefs (const size_t CRows, const size_t ARows, const size_t ERows, const size_t NumSlacks, vctDynamicMatrixRef< double > &CData, vctDynamicMatrixRef< double > &CSlacks, vctDynamicVectorRef< double > &dData, vctDynamicMatrixRef< double > &AData, vctDynamicMatrixRef< double > &ASlacks, vctDynamicVectorRef< double > &bData, vctDynamicVectorRef< double > &bSlacks, vctDynamicMatrixRef< double > &EData, vctDynamicVectorRef< double > &fData) |
| Returns references to spaces in the tableau. | |
| size_t | GetNumVars (void) const |
| Returns the number of variables. | |
| size_t | GetSlackIndex (void) const |
| Gets the current slack index. | |
| size_t | GetSlacks (void) const |
| Gets the number of slacks. | |
| size_t | GetObjectiveRows (void) const |
| Gets the number of rows for the objective expression. | |
| size_t | GetObjectiveIndex (void) const |
| Gets the objective index. | |
| size_t | GetIneqConstraintRows (void) const |
| Gets the number of rows for the inequality constraint. | |
| size_t | GetIneqConstraintIndex (void) const |
| Gets the inequality constraint index. | |
| size_t | GetEqConstraintRows (void) const |
| Gets the number of rows for the equality constraint. | |
| size_t | GetEqConstraintIndex (void) const |
| Gets the equality constraint index. | |
| const vctDoubleMat & | GetObjectiveMatrix (void) const |
| Gets the objective matrix. | |
| const vctDoubleVec & | GetObjectiveVector (void) const |
| Gets the objective vector. | |
| const vctDoubleMat & | GetIneqConstraintMatrix (void) const |
| Gets the inequality constraint matrix. | |
| const vctDoubleVec & | GetIneqConstraintVector (void) const |
| Gets the inequality constraint vector. | |
| const vctDoubleMat & | GetEqConstraintMatrix (void) const |
| Gets the equality constraint matrix. | |
| const vctDoubleVec & | GetEqConstraintVector (void) const |
| Gets the equality constraint vector. | |
| const std::string | GetStatusString (STATUS status) const |
| Helper function for converting status enum to a string message. | |
nmrConstraintOptimizer: A class that makes using the constraint control algorithm more efficient
This is a container for constrained control optimizer. It provides high level functions to add common functionality. Solves the LSI problem arg min || C x - d ||, s.t. E x = f and A x >= b.
enum used for solver results. 0 Both equality and inequality constraints are compatible and have been satisfied. 1 Equality constraints are contradictory. A generalized inverse solution of EX=F was used to minimize the residual vector length F-EX. In this sense, the solution is still meaningful. 2 Inequality constraints are contradictory. 3 Both equality and inequality constraints are contradictory. 4 Input has a NaN or INF
| Enumerator | |
|---|---|
| NMR_OK | |
| NMR_EQ_CONTRADICTION | |
| NMR_INEQ_CONTRADICTION | |
| NMR_BOTH_CONTRADICTION | |
| NMR_MALFORMED | |
| NMR_EMPTY | |
|
inline |
Constructor
|
inline |
Destructor
| nmrConstraintOptimizer::nmrConstraintOptimizer | ( | const size_t | n | ) |
Initialize control optimizer
| n | Number of variables |
| void nmrConstraintOptimizer::Allocate | ( | const size_t | CRows, |
| const size_t | CCols, | ||
| const size_t | ARows, | ||
| const size_t | ACols, | ||
| const size_t | ERows, | ||
| const size_t | ECols ) |
Allocate memory indicated by input.
allocate
| void nmrConstraintOptimizer::Allocate | ( | void | ) |
Allocate memory indicated by indices.
allocate
| size_t nmrConstraintOptimizer::GetEqConstraintIndex | ( | void | ) | const |
Gets the equality constraint index.
GetEqConstraintIndex
| const vctDoubleMat & nmrConstraintOptimizer::GetEqConstraintMatrix | ( | void | ) | const |
Gets the equality constraint matrix.
GetEqConstraintMatrix
| size_t nmrConstraintOptimizer::GetEqConstraintRows | ( | void | ) | const |
Gets the number of rows for the equality constraint.
GetEqConstraintRows
| const vctDoubleVec & nmrConstraintOptimizer::GetEqConstraintVector | ( | void | ) | const |
Gets the equality constraint vector.
GetEqConstraintVector
| size_t nmrConstraintOptimizer::GetIneqConstraintIndex | ( | void | ) | const |
Gets the inequality constraint index.
GetIneqConstraintIndex
| const vctDoubleMat & nmrConstraintOptimizer::GetIneqConstraintMatrix | ( | void | ) | const |
Gets the inequality constraint matrix.
GetIneqConstraintMatrix
| size_t nmrConstraintOptimizer::GetIneqConstraintRows | ( | void | ) | const |
Gets the number of rows for the inequality constraint.
GetIneqConstraintRows
| const vctDoubleVec & nmrConstraintOptimizer::GetIneqConstraintVector | ( | void | ) | const |
Gets the inequality constraint vector.
GetIneqConstraintVector
| size_t nmrConstraintOptimizer::GetNumVars | ( | void | ) | const |
Returns the number of variables.
GetNumVars
| size_t nmrConstraintOptimizer::GetObjectiveIndex | ( | void | ) | const |
Gets the objective index.
GetObjectiveIndex
| const vctDoubleMat & nmrConstraintOptimizer::GetObjectiveMatrix | ( | void | ) | const |
| size_t nmrConstraintOptimizer::GetObjectiveRows | ( | void | ) | const |
Gets the number of rows for the objective expression.
GetObjectiveRows
| const vctDoubleVec & nmrConstraintOptimizer::GetObjectiveVector | ( | void | ) | const |
| size_t nmrConstraintOptimizer::GetSlackIndex | ( | void | ) | const |
Gets the current slack index.
GetSlackIndex
| size_t nmrConstraintOptimizer::GetSlacks | ( | void | ) | const |
Gets the number of slacks.
GetSlacks
| const std::string nmrConstraintOptimizer::GetStatusString | ( | STATUS | status | ) | const |
| void nmrConstraintOptimizer::ReserveSpace | ( | const size_t | CRows, |
| const size_t | ARows, | ||
| const size_t | ERows, | ||
| const size_t | num_slacks ) |
Reserves space in the tableau.
ReserveSpace
| CRows | Number of rows needed for the objective |
| ARows | Number of rows needed for the inequality constraint |
| ERows | Number of rows needed for the equality constraint |
| num_slacks | The number of slacks needed |
| void nmrConstraintOptimizer::ResetIndices | ( | void | ) |
Clear all indices.
Reset
| void nmrConstraintOptimizer::SetRefs | ( | const size_t | CRows, |
| const size_t | ARows, | ||
| const size_t | ERows, | ||
| const size_t | NumSlacks, | ||
| vctDynamicMatrixRef< double > & | CData, | ||
| vctDynamicMatrixRef< double > & | CSlacks, | ||
| vctDynamicVectorRef< double > & | dData, | ||
| vctDynamicMatrixRef< double > & | AData, | ||
| vctDynamicMatrixRef< double > & | ASlacks, | ||
| vctDynamicVectorRef< double > & | bData, | ||
| vctDynamicVectorRef< double > & | bSlacks, | ||
| vctDynamicMatrixRef< double > & | EData, | ||
| vctDynamicVectorRef< double > & | fData ) |
Returns references to spaces in the tableau.
GetObjectiveSpace
| CRows | Number of rows needed for the objective data |
| ARows | Number of rows needed for the inequality constraint data |
| ERows | Number of rows needed for the equality constraint data |
| SlackRows | The number of slacks |
| CData | A reference to the data portion of the objective matrix |
| CSlacks | A reference to the slack portion of the objective matrix |
| dData | A reference to the objective vector |
| AData | A reference to the data portion of the inequality constraint matrix |
| bData | A reference to the inequality constraint vector |
| bSlacks | A reference to the inequality constraint vector for slack portion (slack limit) |
| EData | A reference to the data portion of the equality constraint matrix |
| fData | A reference to the equality constraint vector |
| STATUS nmrConstraintOptimizer::Solve | ( | vctDoubleVec & | dq | ) |
Calls the solver and stores the result in dq.
Solve
| dq | Vector of current joint values |