Public Member Functions | Protected Member Functions | List of all members
hpp::constraints::HybridSolver Class Reference

#include <hpp/constraints/hybrid-solver.hh>

Inheritance diagram for hpp::constraints::HybridSolver:
[legend]
Collaboration diagram for hpp::constraints::HybridSolver:
[legend]

Public Member Functions

 HybridSolver (const std::size_t &argSize, const std::size_t derSize)
 
virtual ~HybridSolver ()
 
ExplicitSolverexplicitSolver ()
 
const ExplicitSolverexplicitSolver () const
 
void explicitSolverHasChanged ()
 Should be called whenever explicit solver is modified. More...
 
template<typename LineSearchType >
Status solve (vectorOut_t arg, LineSearchType ls=LineSearchType()) const
 
Status solve (vectorOut_t arg) const
 
bool isSatisfied (vectorIn_t arg) const
 
bool isSatisfied (vectorIn_t arg, vectorOut_t error) const
 
void projectOnKernel (vectorIn_t arg, vectorIn_t darg, vectorOut_t result) const
 Project the point arg + darg onto the null space of the jacobian at arg. More...
 
template<typename LineSearchType >
bool oneStep (vectorOut_t arg, LineSearchType &lineSearch) const
 
void updateJacobian (vectorIn_t arg) const
 Computes the jacobian of the explicit functions and updates the jacobian of the problem using the chain rule. More...
 
void errorThreshold (const value_type &threshold)
 Set error threshold. More...
 
value_type errorThreshold () const
 Get error threshold. More...
 
segments_t implicitDof () const
 Returns the indices in the input vector which are solved implicitely. More...
 
virtual std::ostream & print (std::ostream &os) const
 
void integrate (vectorIn_t from, vectorIn_t velocity, vectorOut_t result) const
 
Right hand side accessors
vector_t rightHandSideFromInput (vectorIn_t arg)
 Compute a right hand side using the input arg. More...
 
bool rightHandSideFromInput (const DifferentiableFunctionPtr_t &fImplicit, const DifferentiableFunctionPtr_t &fExplicit, vectorIn_t arg)
 Set the right hand side for a given constraint. More...
 
bool rightHandSide (const DifferentiableFunctionPtr_t &fImplicit, const DifferentiableFunctionPtr_t &fExplicit, vectorIn_t rhs)
 Set the right hand side for a given constraint. More...
 
void rightHandSide (vectorIn_t rhs)
 Set the level set parameter. More...
 
vector_t rightHandSide () const
 Get the level set parameter. More...
 
size_type rightHandSideSize () const
 Get size of the level set parameter. More...
 
- Public Member Functions inherited from hpp::constraints::HierarchicalIterativeSolver
 HierarchicalIterativeSolver (const std::size_t &argSize, const std::size_t derSize)
 
virtual ~HierarchicalIterativeSolver ()
 
value_type residualError () const
 Returns the squared norm of the error vector. More...
 
void residualError (vectorOut_t error) const
 Returns the error vector. More...
 
void add (const DifferentiableFunctionPtr_t &f, const std::size_t &priority)
 Add an equality constraint to a priority. More...
 
void add (const DifferentiableFunctionPtr_t &f, const std::size_t &priority, const ComparisonTypes_t &comp)
 Add a constraint. More...
 
void integration (const Integration_t &integrate)
 Set the integration function. More...
 
const Integration_tintegration () const
 Get the integration function. More...
 
void saturation (const Saturation_t &saturate)
 Set the saturation function. More...
 
const Saturation_tsaturation () const
 Get the saturation function. More...
 
template<typename LineSearchType >
Status solve (vectorOut_t arg, LineSearchType ls=LineSearchType()) const
 
Status solve (vectorOut_t arg) const
 
bool isSatisfied (vectorIn_t arg) const
 
const value_typesigma () const
 Returns the lowest singular value. More...
 
void reduction (const segments_t intervals)
 Set the velocity variable that must be changed. More...
 
void reduction (const Reduction_t &reduction)
 Set the velocity variable that must be changed. More...
 
void maxIterations (size_type iterations)
 Set maximal number of iterations. More...
 
size_type maxIterations () const
 Get maximal number of iterations in config projector. More...
 
void errorThreshold (const value_type &threshold)
 Set error threshold. More...
 
value_type errorThreshold () const
 Get error threshold. More...
 
value_type squaredErrorThreshold () const
 Get error threshold. More...
 
value_type inequalityThreshold () const
 Get the inequality threshold. More...
 
void inequalityThreshold (const value_type &it)
 set the inequality threshold More...
 
void lastIsOptional (bool optional)
 
bool lastIsOptional () const
 
const DifferentiableFunctionStackstack (const std::size_t priority)
 
std::size_t numberStacks () const
 
const size_typedimension () const
 
const size_typereducedDimension () const
 Dimension of the problem after removing the rows of the jacobian which do not influence the error (only zeros along those lines). More...
 
ArrayXb activeParameters () const
 Configuration parameters involved in the constraint resolution. More...
 
ArrayXb activeDerivativeParameters () const
 Velocity parameters involved in the constraint resolution. More...
 
vector_t rightHandSideFromInput (vectorIn_t arg)
 Compute a right hand side using the input arg. More...
 
bool rightHandSideFromInput (const DifferentiableFunctionPtr_t &f, vectorIn_t arg)
 
bool rightHandSide (const DifferentiableFunctionPtr_t &f, vectorIn_t rhs)
 
void rightHandSide (vectorIn_t rhs)
 Set the level set parameter. More...
 
vector_t rightHandSide () const
 Get the level set parameter. More...
 
size_type rightHandSideSize () const
 Get size of the level set parameter. More...
 
template<bool ComputeJac>
void computeValue (vectorIn_t arg) const
 Compute the value of each level, and the jacobian if ComputeJac is true. More...
 
void computeSaturation (vectorIn_t arg) const
 
void getValue (vectorOut_t v) const
 
void getReducedJacobian (matrixOut_t J) const
 
void computeError () const
 If lastIsOptional() is true, then the last level is ignored. More...
 
const vector_tlastStep () const
 Accessor to the last step done. More...
 

Protected Member Functions

void computeActiveRowsOfJ (std::size_t iStack)
 Compute which rows of the jacobian of stack_[iStack] are not zero, using the activeDerivativeParameters of the functions. More...
 
- Protected Member Functions inherited from hpp::constraints::HierarchicalIterativeSolver
void update ()
 Allocate datas and update sizes of the problem Should be called whenever the stack is modified. More...
 
void computeDescentDirection () const
 Compute a SVD decomposition of each level and find the best descent direction at the first order. More...
 
void expandDqSmall () const
 
void saturate (vectorOut_t arg) const
 

Additional Inherited Members

- Public Types inherited from hpp::constraints::HierarchicalIterativeSolver
enum  Status {
  ERROR_INCREASED,
  MAX_ITERATION_REACHED,
  INFEASIBLE,
  SUCCESS
}
 
typedef Eigen::ColBlockIndices Reduction_t
 
typedef lineSearch::FixedSequence DefaultLineSearch
 
typedef boost::function< void(vectorIn_t from, vectorIn_t velocity, vectorOut_t result)> Integration_t
 This function integrates velocity during unit time, from argument. More...
 
typedef boost::function< bool(vectorIn_t result, Eigen::VectorXi &saturation)> Saturation_t
 This function checks what DoF are saturated. More...
 
- Protected Types inherited from hpp::constraints::HierarchicalIterativeSolver
typedef Eigen::JacobiSVD< matrix_tSVD_t
 
- Protected Attributes inherited from hpp::constraints::HierarchicalIterativeSolver
value_type squaredErrorThreshold_
 
value_type inequalityThreshold_
 
size_type maxIterations_
 
std::vector< DifferentiableFunctionStackstacks_
 
size_type argSize_
 
size_type derSize_
 
size_type dimension_
 
size_type reducedDimension_
 
bool lastIsOptional_
 
Reduction_t reduction_
 
Integration_t integrate_
 
Saturation_t saturate_
 
value_type sigma_
 The smallest non-zero singular value. More...
 
vector_t dq_
 
vector_t dqSmall_
 
matrix_t projector_
 
matrix_t reducedJ_
 
Eigen::VectorXi saturation_
 
Eigen::VectorXi reducedSaturation_
 
ArrayXb tmpSat_
 
value_type squaredNorm_
 
std::vector< Datadatas_
 
SVD_t svd_
 
mutable ::hpp::statistics::SuccessStatistics statistics_
 

Constructor & Destructor Documentation

◆ HybridSolver()

hpp::constraints::HybridSolver::HybridSolver ( const std::size_t &  argSize,
const std::size_t  derSize 
)
inline

◆ ~HybridSolver()

virtual hpp::constraints::HybridSolver::~HybridSolver ( )
inlinevirtual

Member Function Documentation

◆ computeActiveRowsOfJ()

void hpp::constraints::HybridSolver::computeActiveRowsOfJ ( std::size_t  iStack)
protectedvirtual

Compute which rows of the jacobian of stack_[iStack] are not zero, using the activeDerivativeParameters of the functions.

The result is stored in datas_[i].activeRowsOfJ

Reimplemented from hpp::constraints::HierarchicalIterativeSolver.

◆ errorThreshold() [1/2]

void hpp::constraints::HybridSolver::errorThreshold ( const value_type threshold)
inline

◆ errorThreshold() [2/2]

value_type hpp::constraints::HybridSolver::errorThreshold ( ) const
inline

◆ explicitSolver() [1/2]

ExplicitSolver& hpp::constraints::HybridSolver::explicitSolver ( )
inline

◆ explicitSolver() [2/2]

const ExplicitSolver& hpp::constraints::HybridSolver::explicitSolver ( ) const
inline

◆ explicitSolverHasChanged()

void hpp::constraints::HybridSolver::explicitSolverHasChanged ( )

Should be called whenever explicit solver is modified.

◆ implicitDof()

segments_t hpp::constraints::HybridSolver::implicitDof ( ) const

Returns the indices in the input vector which are solved implicitely.

The other dof which are modified are solved explicitely.

◆ integrate()

void hpp::constraints::HybridSolver::integrate ( vectorIn_t  from,
vectorIn_t  velocity,
vectorOut_t  result 
) const
inlinevirtual

◆ isSatisfied() [1/2]

bool hpp::constraints::HybridSolver::isSatisfied ( vectorIn_t  arg) const
inline

◆ isSatisfied() [2/2]

bool hpp::constraints::HybridSolver::isSatisfied ( vectorIn_t  arg,
vectorOut_t  error 
) const
inline

◆ oneStep()

template<typename LineSearchType >
bool hpp::constraints::HybridSolver::oneStep ( vectorOut_t  arg,
LineSearchType &  lineSearch 
) const
inline

◆ print()

virtual std::ostream& hpp::constraints::HybridSolver::print ( std::ostream &  os) const
virtual

◆ projectOnKernel()

void hpp::constraints::HybridSolver::projectOnKernel ( vectorIn_t  arg,
vectorIn_t  darg,
vectorOut_t  result 
) const

Project the point arg + darg onto the null space of the jacobian at arg.

◆ rightHandSide() [1/3]

bool hpp::constraints::HybridSolver::rightHandSide ( const DifferentiableFunctionPtr_t fImplicit,
const DifferentiableFunctionPtr_t fExplicit,
vectorIn_t  rhs 
)
inline

Set the right hand side for a given constraint.

Parameters
fImplicitimplicit formulation of the constraint. Can be NULL
fExplicitexplicit formulation of the constraint. Can be NULL
rhsthe desired right hand side
Warning
At least one of fImplicit and fExplicit must be non-NULL.

References Eigen::assert().

◆ rightHandSide() [2/3]

void hpp::constraints::HybridSolver::rightHandSide ( vectorIn_t  rhs)
inline

Set the level set parameter.

Parameters
rhsthe level set parameter.

◆ rightHandSide() [3/3]

vector_t hpp::constraints::HybridSolver::rightHandSide ( ) const
inline

Get the level set parameter.

Returns
the parameter.

◆ rightHandSideFromInput() [1/2]

vector_t hpp::constraints::HybridSolver::rightHandSideFromInput ( vectorIn_t  arg)
inline

Compute a right hand side using the input arg.

◆ rightHandSideFromInput() [2/2]

bool hpp::constraints::HybridSolver::rightHandSideFromInput ( const DifferentiableFunctionPtr_t fImplicit,
const DifferentiableFunctionPtr_t fExplicit,
vectorIn_t  arg 
)
inline

Set the right hand side for a given constraint.

Parameters
fImplicitimplicit formulation of the constraint. Can be NULL
fExplicitexplicit formulation of the constraint. Can be NULL
arga vector of size argSize_
Warning
At least one of fImplicit and fExplicit must be non-NULL.

References Eigen::assert().

◆ rightHandSideSize()

size_type hpp::constraints::HybridSolver::rightHandSideSize ( ) const
inline

Get size of the level set parameter.

◆ solve() [1/2]

template<typename LineSearchType >
Status hpp::constraints::HybridSolver::solve ( vectorOut_t  arg,
LineSearchType  ls = LineSearchType() 
) const
inline

◆ solve() [2/2]

Status hpp::constraints::HybridSolver::solve ( vectorOut_t  arg) const
inline

◆ updateJacobian()

void hpp::constraints::HybridSolver::updateJacobian ( vectorIn_t  arg) const

Computes the jacobian of the explicit functions and updates the jacobian of the problem using the chain rule.