cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | List of all members
nmrConstraintOptimizer Class Reference

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 vctDoubleMatGetObjectiveMatrix (void) const
 Gets the objective matrix. More...
 
const vctDoubleVecGetObjectiveVector (void) const
 Gets the objective vector. More...
 
const vctDoubleMatGetIneqConstraintMatrix (void) const
 Gets the inequality constraint matrix. More...
 
const vctDoubleVecGetIneqConstraintVector (void) const
 Gets the inequality constraint vector. More...
 
const vctDoubleMatGetEqConstraintMatrix (void) const
 Gets the equality constraint matrix. More...
 
const vctDoubleVecGetEqConstraintVector (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...
 

Detailed Description

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.

Member Enumeration Documentation

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 

Constructor & Destructor Documentation

nmrConstraintOptimizer::nmrConstraintOptimizer ( )
inline

Constructor

nmrConstraintOptimizer::~nmrConstraintOptimizer ( )
inline

Destructor

nmrConstraintOptimizer::nmrConstraintOptimizer ( const size_t  n)

Initialize control optimizer

Parameters
nNumber of variables

Member Function Documentation

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

Returns
size_t The equality constraint index
const vctDoubleMat& nmrConstraintOptimizer::GetEqConstraintMatrix ( void  ) const

Gets the equality constraint matrix.

GetEqConstraintMatrix

Returns
vctDoubleMat The equality constraint matrix
size_t nmrConstraintOptimizer::GetEqConstraintRows ( void  ) const

Gets the number of rows for the equality constraint.

GetEqConstraintRows

Returns
size_t The number of rows for the equality constraint
const vctDoubleVec& nmrConstraintOptimizer::GetEqConstraintVector ( void  ) const

Gets the equality constraint vector.

GetEqConstraintVector

Returns
vctDoubleVec The equality constraint vector
size_t nmrConstraintOptimizer::GetIneqConstraintIndex ( void  ) const

Gets the inequality constraint index.

GetIneqConstraintIndex

Returns
size_t The inequality constraint index
const vctDoubleMat& nmrConstraintOptimizer::GetIneqConstraintMatrix ( void  ) const

Gets the inequality constraint matrix.

GetIneqConstraintMatrix

Returns
vctDoubleMat The inequality constraint matrix
size_t nmrConstraintOptimizer::GetIneqConstraintRows ( void  ) const

Gets the number of rows for the inequality constraint.

GetIneqConstraintRows

Returns
size_t The number of inequality constraint rows
const vctDoubleVec& nmrConstraintOptimizer::GetIneqConstraintVector ( void  ) const

Gets the inequality constraint vector.

GetIneqConstraintVector

Returns
vctDoubleVec The inequality constraint vector
size_t nmrConstraintOptimizer::GetNumVars ( void  ) const

Returns the number of variables.

GetNumVars

Returns
size_t Number of variables
size_t nmrConstraintOptimizer::GetObjectiveIndex ( void  ) const

Gets the objective index.

GetObjectiveIndex

Returns
size_t The objective index
const vctDoubleMat& nmrConstraintOptimizer::GetObjectiveMatrix ( void  ) const

Gets the objective matrix.

GetObjectiveMatrix

Returns
vctDoubleMat The objective matrix
size_t nmrConstraintOptimizer::GetObjectiveRows ( void  ) const

Gets the number of rows for the objective expression.

GetObjectiveRows

Returns
size_t The number of objective rows
const vctDoubleVec& nmrConstraintOptimizer::GetObjectiveVector ( void  ) const

Gets the objective vector.

GetObjectiveVector

Returns
vctDoubleVec The objective vector
size_t nmrConstraintOptimizer::GetSlackIndex ( void  ) const

Gets the current slack index.

GetSlackIndex

Returns
size_t The slack index
size_t nmrConstraintOptimizer::GetSlacks ( void  ) const

Gets the number of slacks.

GetSlacks

Returns
size_t The number of slacks
const std::string nmrConstraintOptimizer::GetStatusString ( STATUS  status) const

Helper function for converting status enum to a string message.

GetStatusString

Parameters
statusA STATUS enum variable
Returns
A string representation of that STATUS
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

Parameters
CRowsNumber of rows needed for the objective
ARowsNumber of rows needed for the inequality constraint
ERowsNumber of rows needed for the equality constraint
num_slacksThe 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

Parameters
CRowsNumber of rows needed for the objective data
ARowsNumber of rows needed for the inequality constraint data
ERowsNumber of rows needed for the equality constraint data
num_slacksThe number of slacks
CDataA reference to the data portion of the objective matrix
CSlacksA reference to the slack portion of the objective matrix
dA reference to the objective vector
ADataA reference to the data portion of the inequality constraint matrix
ASlacksA reference to the slack portion of the inequality constraint matrix
bA reference to the inequality constraint vector
EDataA reference to the data portion of the equality constraint matrix
ESlacksA reference to the slack portion of the equality constraint matrix
fA reference to the equality constraint vector
STATUS nmrConstraintOptimizer::Solve ( vctDoubleVec dq)

Calls the solver and stores the result in dq.

Solve

Parameters
dqVector of current joint values
Returns
STATUS enum that dictates whether the solver worked or there was a problem

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