DART 6.13.2
Loading...
Searching...
No Matches
dart::constraint::PgsBoxedLcpSolver Class Reference

Implementation of projected Gauss-Seidel (PGS) LCP solver. More...

#include <PgsBoxedLcpSolver.hpp>

Inheritance diagram for dart::constraint::PgsBoxedLcpSolver:
dart::constraint::BoxedLcpSolver dart::common::Castable< BoxedLcpSolver >

Classes

struct  Option
 

Public Member Functions

const std::string & getType () const override
 Returns the type.
 
bool solve (int n, double *A, double *x, double *b, int nub, double *lo, double *hi, int *findex, bool earlyTermination) override
 Solves constriant impulses for a constrained group.
 
bool canSolve (int n, const double *A) override
 
void setOption (const Option &option)
 Sets options.
 
const OptiongetOption () const
 Returns options.
 
bool is () const
 Returns true if the types of this Base and the template parameter (a base class) are identical.
 
const Derived * as () const
 Casts to pointer of Derived if Base is its base class.
 
Derived * as ()
 Casts to pointer of Derived if Base is its base class.
 
const Derived & asRef () const
 Casts to reference of Derived if Base is its base class. UB otherwise.
 
Derived & asRef ()
 Casts to reference of Derived if Base is its base class. UB otherwise.
 

Static Public Member Functions

static const std::string & getStaticType ()
 Returns type for this class.
 

Protected Attributes

Option mOption
 
std::vector< int > mCacheOrder
 
std::vector< double > mCacheD
 
Eigen::VectorXd mCachedNormalizedA
 
Eigen::MatrixXd mCachedNormalizedB
 
Eigen::VectorXd mCacheZ
 
Eigen::VectorXd mCacheOldX
 

Private Member Functions

const BoxedLcpSolverbase () const
 Casts to Base const-reference.
 
BoxedLcpSolverbase ()
 Casts to Base reference.
 

Detailed Description

Implementation of projected Gauss-Seidel (PGS) LCP solver.

Member Function Documentation

◆ as() [1/2]

Derived * dart::common::Castable< BoxedLcpSolver >::as ( )
inherited

Casts to pointer of Derived if Base is its base class.

Returns nullptr otherwise.

◆ as() [2/2]

const Derived * dart::common::Castable< BoxedLcpSolver >::as ( ) const
inherited

Casts to pointer of Derived if Base is its base class.

Returns nullptr otherwise.

◆ asRef() [1/2]

Derived & dart::common::Castable< BoxedLcpSolver >::asRef ( )
inherited

Casts to reference of Derived if Base is its base class. UB otherwise.

◆ asRef() [2/2]

const Derived & dart::common::Castable< BoxedLcpSolver >::asRef ( ) const
inherited

Casts to reference of Derived if Base is its base class. UB otherwise.

◆ base() [1/2]

BoxedLcpSolver & dart::common::Castable< BoxedLcpSolver >::base ( )
privateinherited

Casts to Base reference.

◆ base() [2/2]

const BoxedLcpSolver & dart::common::Castable< BoxedLcpSolver >::base ( ) const
privateinherited

Casts to Base const-reference.

◆ canSolve()

bool dart::constraint::PgsBoxedLcpSolver::canSolve ( int  n,
const double *  A 
)
overridevirtual

◆ getOption()

const PgsBoxedLcpSolver::Option & dart::constraint::PgsBoxedLcpSolver::getOption ( ) const

Returns options.

◆ getStaticType()

const std::string & dart::constraint::PgsBoxedLcpSolver::getStaticType ( )
static

Returns type for this class.

◆ getType()

const std::string & dart::constraint::PgsBoxedLcpSolver::getType ( ) const
overridevirtual

Returns the type.

Implements dart::constraint::BoxedLcpSolver.

◆ is()

bool dart::common::Castable< BoxedLcpSolver >::is ( ) const
inherited

Returns true if the types of this Base and the template parameter (a base class) are identical.

This function is a syntactic sugar, which is identical to: (getType() == ShapeType::getStaticType()).

Example code:

if (shape->is<Sphere>())
std::cout << "The shape type is sphere!\n";

◆ setOption()

void dart::constraint::PgsBoxedLcpSolver::setOption ( const Option option)

Sets options.

◆ solve()

bool dart::constraint::PgsBoxedLcpSolver::solve ( int  n,
double *  A,
double *  x,
double *  b,
int  nub,
double *  lo,
double *  hi,
int *  findex,
bool  earlyTermination 
)
overridevirtual

Solves constriant impulses for a constrained group.

The LCP formulation setting that this function solve is A*x = b + w where each x[i], w[i] satisfies one of (1) x = lo, w >= 0 (2) x = hi, w <= 0 (3) lo < x < hi, w = 0

Parameters
[in]nDimension of constraints.
[in]AA term of the LCP formulation.
[in]xx term of the LCP formulation.
[in]bb term of the LCP formulation.
[in]nubNumber of the first unbounded constraints.
[in]loLower bound of x where it's restricted to be lo <= 0.
[in]hiUpper bound of x where it's enforced to be hi >= 0.
[in]findexIndices to corresponding normal contact constraint. Set the index to itself (e.g., findex[k] = k) for normal contacts or non-contact constraints. For friction constraint, set the cooresponding normal contact constraint.
[in]earlyTerminationSet true to return false as soon as the solver find the solution doesn't exist. Otherwise, the solver will continue to push hard to solve the problem using some hacks.
Returns
Success.

Implements dart::constraint::BoxedLcpSolver.

Member Data Documentation

◆ mCacheD

std::vector<double> dart::constraint::PgsBoxedLcpSolver::mCacheD
mutableprotected

◆ mCachedNormalizedA

Eigen::VectorXd dart::constraint::PgsBoxedLcpSolver::mCachedNormalizedA
mutableprotected

◆ mCachedNormalizedB

Eigen::MatrixXd dart::constraint::PgsBoxedLcpSolver::mCachedNormalizedB
mutableprotected

◆ mCacheOldX

Eigen::VectorXd dart::constraint::PgsBoxedLcpSolver::mCacheOldX
mutableprotected

◆ mCacheOrder

std::vector<int> dart::constraint::PgsBoxedLcpSolver::mCacheOrder
mutableprotected

◆ mCacheZ

Eigen::VectorXd dart::constraint::PgsBoxedLcpSolver::mCacheZ
mutableprotected

◆ mOption

Option dart::constraint::PgsBoxedLcpSolver::mOption
protected