|
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. More... | |
| void | ResetIndices (void) |
| Clear all indices. More... | |
| void | Allocate (void) |
| Allocate memory indicated by indices. More... | |
| 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. More... | |
| void | ReserveSpace (const size_t CRows, const size_t ARows, const size_t ERows, const size_t num_slacks) |
| Reserves space in the tableau. More... | |
| void | SetRefs (const size_t CRows, const size_t ARows, const size_t ERows, const size_t num_slacks, const vctDoubleVec &limits, vctDynamicMatrixRef< double > &CData, vctDynamicMatrixRef< double > &CSlacks, vctDynamicVectorRef< double > &dData, vctDynamicMatrixRef< double > &AData, vctDynamicMatrixRef< double > &ASlacks, vctDynamicVectorRef< double > &bData, vctDynamicMatrixRef< double > &EData, vctDynamicMatrixRef< double > &ESlacks, vctDynamicVectorRef< double > &fData) |
| Returns references to spaces in the tableau. More... | |
| size_t | GetNumVars (void) const |
| Returns the number of variables. More... | |
| size_t | GetSlackIndex (void) const |
| Gets the current slack index. More... | |
| size_t | GetSlacks (void) const |
| Gets the number of slacks. More... | |
| size_t | GetObjectiveRows (void) const |
| Gets the number of rows for the objective expression. More... | |
| size_t | GetObjectiveIndex (void) const |
| Gets the objective index. More... | |
| size_t | GetIneqConstraintRows (void) const |
| Gets the number of rows for the inequality constraint. More... | |
| size_t | GetIneqConstraintIndex (void) const |
| Gets the inequality constraint index. More... | |
| size_t | GetEqConstraintRows (void) const |
| Gets the number of rows for the equality constraint. More... | |
| size_t | GetEqConstraintIndex (void) const |
| Gets the equality constraint index. More... | |
| const vctDoubleMat & | GetObjectiveMatrix (void) const |
| Gets the objective matrix. More... | |
| const vctDoubleVec & | GetObjectiveVector (void) const |
| Gets the objective vector. More... | |
| const vctDoubleMat & | GetIneqConstraintMatrix (void) const |
| Gets the inequality constraint matrix. More... | |
| const vctDoubleVec & | GetIneqConstraintVector (void) const |
| Gets the inequality constraint vector. More... | |
| const vctDoubleMat & | GetEqConstraintMatrix (void) const |
| Gets the equality constraint matrix. More... | |
| const vctDoubleVec & | GetEqConstraintVector (void) const |
| Gets the equality constraint vector. More... | |
| const std::string | GetStatusString (STATUS status) const |
| Helper function for converting status enum to a string message. More... | |
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 | ( | void | ) |
Allocate memory indicated by indices.
allocate
| 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
| 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 |
Gets the objective matrix.
GetObjectiveMatrix
| size_t nmrConstraintOptimizer::GetObjectiveRows | ( | void | ) | const |
Gets the number of rows for the objective expression.
GetObjectiveRows
| const vctDoubleVec& nmrConstraintOptimizer::GetObjectiveVector | ( | void | ) | const |
Gets the objective vector.
GetObjectiveVector
| 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 |
Helper function for converting status enum to a string message.
GetStatusString
| status | A STATUS enum variable |
| 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 | num_slacks, | ||
| const vctDoubleVec & | limits, | ||
| vctDynamicMatrixRef< double > & | CData, | ||
| vctDynamicMatrixRef< double > & | CSlacks, | ||
| vctDynamicVectorRef< double > & | dData, | ||
| vctDynamicMatrixRef< double > & | AData, | ||
| vctDynamicMatrixRef< double > & | ASlacks, | ||
| vctDynamicVectorRef< double > & | bData, | ||
| vctDynamicMatrixRef< double > & | EData, | ||
| vctDynamicMatrixRef< double > & | ESlacks, | ||
| 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 |
| num_slacks | 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 |
| d | A reference to the objective vector |
| AData | A reference to the data portion of the inequality constraint matrix |
| ASlacks | A reference to the slack portion of the inequality constraint matrix |
| b | A reference to the inequality constraint vector |
| EData | A reference to the data portion of the equality constraint matrix |
| ESlacks | A reference to the slack portion of the equality constraint matrix |
| f | 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 |
1.8.6