Classes | Public Types | Public Member Functions | List of all members
hpp::constraints::ExplicitSolver Class Reference

Solve system of explicit functions. More...

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

Public Types

typedef Eigen::RowBlockIndices RowBlockIndices
 
typedef Eigen::ColBlockIndices ColBlockIndices
 
typedef Eigen::MatrixBlockView< matrix_t, Eigen::Dynamic, Eigen::Dynamic, false, false > MatrixBlockView
 

Public Member Functions

MatrixBlockView viewJacobian (matrix_t &jacobian) const
 
void jacobian (matrixOut_t jacobian, vectorIn_t arg) const
 
std::ostream & print (std::ostream &os) const
 
Resolution
bool solve (vectorOut_t arg) const
 
bool isSatisfied (vectorIn_t arg) const
 
bool isSatisfied (vectorIn_t arg, vectorOut_t error) const
 
Construction of the problem
size_type add (const DifferentiableFunctionPtr_t &f, const RowBlockIndices &inArg, const RowBlockIndices &outArg, const ColBlockIndices &inDer, const RowBlockIndices &outDer)
 Returns the index of the function if the function was added, -1 otherwise A function can be added iif its outputs do not interfere with the output of another function. More...
 
size_type add (const DifferentiableFunctionPtr_t &f, const RowBlockIndices &inArg, const RowBlockIndices &outArg, const ColBlockIndices &inDer, const RowBlockIndices &outDer, const ComparisonTypes_t &comp)
 Returns the index of the function if the function was added, -1 otherwise A function can be added iif its outputs do not interfere with the output of another function. More...
 
bool setG (const DifferentiableFunctionPtr_t &f, const DifferentiableFunctionPtr_t &g, const DifferentiableFunctionPtr_t &ginv)
 Set \(g\) and \(g^{-1}\) functions. More...
 
bool replace (const DifferentiableFunctionPtr_t &oldf, const DifferentiableFunctionPtr_t &newd)
 
 ExplicitSolver (const std::size_t &argSize, const std::size_t derSize)
 
Parameters
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...
 
Input and outputs
const RowBlockIndicesinArgs () const
 The set of variable indices which affects the output. More...
 
const ColBlockIndicesinDers () const
 The set of derivative variable indices which affects the output. More...
 
const RowBlockIndicesfreeArgs () const
 The set of variable indices which are not affected by the resolution. More...
 
const ColBlockIndicesfreeDers () const
 The set of derivative variable indices which are not affected by the resolution. More...
 
ColBlockIndices activeParameters () const
 Same as inArgs. More...
 
const ColBlockIndicesactiveDerivativeParameters () const
 Same as inDers. More...
 
const Eigen::MatrixXi & inOutDependencies () const
 Returns a matrix of integer whose: More...
 
Eigen::MatrixXi inOutDofDependencies () const
 Same as inOutDependencies except that cols correpond to DoFs. More...
 
const Eigen::VectorXi & derFunction () const
 
const RowBlockIndicesoutArgs () const
 The set of variable indices which are computed. More...
 
const RowBlockIndicesoutDers () const
 The set of derivative variable indices which are computed. More...
 
const std::size_t & argSize () const
 The number of variables. More...
 
const std::size_t & derSize () const
 The number of derivative variables. More...
 
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 &f, vectorIn_t arg)
 
void rightHandSideFromInput (const size_type &fidx, vectorIn_t rhs)
 
void rightHandSide (vectorIn_t rhs)
 Set the level set parameter. More...
 
bool rightHandSide (const DifferentiableFunctionPtr_t &f, vectorIn_t rhs)
 
void rightHandSide (const size_type &fidx, vectorIn_t rhs)
 
vector_t rightHandSide () const
 Get the level set parameter. More...
 
size_type rightHandSideSize () const
 Get size of the level set parameter. More...
 

Detailed Description

Solve system of explicit functions.

The solver works on a given set of variables \( X = (x_i) \). It contains a set of functions \( f_j \) that takes as input a subset of \( X \) and outputs values corresponding to another subset of \( X \). The equations are then of the following form: \( X_{output} = f (X_{input}) + rhs \) where the addition is the addition of the outputSpace() of \( f \).

Eventually, a invertible function \( g \) (of known inverse \( g^{-1} \)) can be specified. The equation then becomes: \( g(X_{output}) = f (X_{input}) + rhs \)

There can be no cycles in the dependencies. Moreover, a variable cannot be the output of two different functions. For instance, \( (x_0, x_2) = f_0( x_1, x_3 ) \) and \( (x_3) = f_1( x_4 ) \) is a valid input. It would not be possible to add \( (x_0) = f_2( x_2 ) \) because it would introduce a cycle, or \( (x_3) = f_3( x_1 ) \) because \( x_3 \) would be computed by two different functions.

The resolution consists in modyfing the output values of each function, while respecting the dependendy order. Considering \( f_0, f_1 \) above, \( f_1 \) must be computed first.

Member Typedef Documentation

◆ ColBlockIndices

◆ MatrixBlockView

typedef Eigen::MatrixBlockView<matrix_t, Eigen::Dynamic, Eigen::Dynamic, false, false> hpp::constraints::ExplicitSolver::MatrixBlockView

◆ RowBlockIndices

Constructor & Destructor Documentation

◆ ExplicitSolver()

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

Member Function Documentation

◆ activeDerivativeParameters()

const ColBlockIndices& hpp::constraints::ExplicitSolver::activeDerivativeParameters ( ) const

Same as inDers.

◆ activeParameters()

ColBlockIndices hpp::constraints::ExplicitSolver::activeParameters ( ) const

Same as inArgs.

◆ add() [1/2]

size_type hpp::constraints::ExplicitSolver::add ( const DifferentiableFunctionPtr_t f,
const RowBlockIndices inArg,
const RowBlockIndices outArg,
const ColBlockIndices inDer,
const RowBlockIndices outDer 
)

Returns the index of the function if the function was added, -1 otherwise A function can be added iif its outputs do not interfere with the output of another function.

◆ add() [2/2]

size_type hpp::constraints::ExplicitSolver::add ( const DifferentiableFunctionPtr_t f,
const RowBlockIndices inArg,
const RowBlockIndices outArg,
const ColBlockIndices inDer,
const RowBlockIndices outDer,
const ComparisonTypes_t comp 
)

Returns the index of the function if the function was added, -1 otherwise A function can be added iif its outputs do not interfere with the output of another function.

◆ argSize()

const std::size_t& hpp::constraints::ExplicitSolver::argSize ( ) const
inline

The number of variables.

◆ derFunction()

const Eigen::VectorXi& hpp::constraints::ExplicitSolver::derFunction ( ) const
inline

◆ derSize()

const std::size_t& hpp::constraints::ExplicitSolver::derSize ( ) const
inline

The number of derivative variables.

◆ errorThreshold() [1/2]

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

Set error threshold.

◆ errorThreshold() [2/2]

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

Get error threshold.

◆ freeArgs()

const RowBlockIndices& hpp::constraints::ExplicitSolver::freeArgs ( ) const
inline

The set of variable indices which are not affected by the resolution.

◆ freeDers()

const ColBlockIndices& hpp::constraints::ExplicitSolver::freeDers ( ) const
inline

The set of derivative variable indices which are not affected by the resolution.

◆ inArgs()

const RowBlockIndices& hpp::constraints::ExplicitSolver::inArgs ( ) const
inline

The set of variable indices which affects the output.

This is a subset of freeArgs

◆ inDers()

const ColBlockIndices& hpp::constraints::ExplicitSolver::inDers ( ) const
inline

The set of derivative variable indices which affects the output.

This is a subset of freeDers

◆ inOutDependencies()

const Eigen::MatrixXi& hpp::constraints::ExplicitSolver::inOutDependencies ( ) const
inline

Returns a matrix of integer whose:

  • rows correspond to functions
  • cols correspond to DoF
  • values correspond to the dependency degree of a function wrt to a DoF

◆ inOutDofDependencies()

Eigen::MatrixXi hpp::constraints::ExplicitSolver::inOutDofDependencies ( ) const

Same as inOutDependencies except that cols correpond to DoFs.

◆ isSatisfied() [1/2]

bool hpp::constraints::ExplicitSolver::isSatisfied ( vectorIn_t  arg) const

◆ isSatisfied() [2/2]

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

◆ jacobian()

void hpp::constraints::ExplicitSolver::jacobian ( matrixOut_t  jacobian,
vectorIn_t  arg 
) const
Parameters
jacobianmust be of dimensions (derSize, derSize) but only a subsegment will be used.
Warning
it is assumed solve(arg) has been called before.

◆ outArgs()

const RowBlockIndices& hpp::constraints::ExplicitSolver::outArgs ( ) const
inline

The set of variable indices which are computed.

◆ outDers()

const RowBlockIndices& hpp::constraints::ExplicitSolver::outDers ( ) const
inline

The set of derivative variable indices which are computed.

◆ print()

std::ostream& hpp::constraints::ExplicitSolver::print ( std::ostream &  os) const

◆ replace()

bool hpp::constraints::ExplicitSolver::replace ( const DifferentiableFunctionPtr_t oldf,
const DifferentiableFunctionPtr_t newd 
)
Warning
the two functions must have the same input and output indices.

◆ rightHandSide() [1/4]

void hpp::constraints::ExplicitSolver::rightHandSide ( vectorIn_t  rhs)

Set the level set parameter.

Parameters
rhsthe level set parameter.

◆ rightHandSide() [2/4]

bool hpp::constraints::ExplicitSolver::rightHandSide ( const DifferentiableFunctionPtr_t f,
vectorIn_t  rhs 
)

◆ rightHandSide() [3/4]

void hpp::constraints::ExplicitSolver::rightHandSide ( const size_type fidx,
vectorIn_t  rhs 
)

◆ rightHandSide() [4/4]

vector_t hpp::constraints::ExplicitSolver::rightHandSide ( ) const

Get the level set parameter.

Returns
the parameter.

◆ rightHandSideFromInput() [1/3]

vector_t hpp::constraints::ExplicitSolver::rightHandSideFromInput ( vectorIn_t  arg)

Compute a right hand side using the input arg.

◆ rightHandSideFromInput() [2/3]

bool hpp::constraints::ExplicitSolver::rightHandSideFromInput ( const DifferentiableFunctionPtr_t f,
vectorIn_t  arg 
)

◆ rightHandSideFromInput() [3/3]

void hpp::constraints::ExplicitSolver::rightHandSideFromInput ( const size_type fidx,
vectorIn_t  rhs 
)

◆ rightHandSideSize()

size_type hpp::constraints::ExplicitSolver::rightHandSideSize ( ) const

Get size of the level set parameter.

◆ setG()

bool hpp::constraints::ExplicitSolver::setG ( const DifferentiableFunctionPtr_t f,
const DifferentiableFunctionPtr_t g,
const DifferentiableFunctionPtr_t ginv 
)

Set \(g\) and \(g^{-1}\) functions.

◆ solve()

bool hpp::constraints::ExplicitSolver::solve ( vectorOut_t  arg) const

◆ squaredErrorThreshold()

value_type hpp::constraints::ExplicitSolver::squaredErrorThreshold ( ) const
inline

Get error threshold.

◆ viewJacobian()

MatrixBlockView hpp::constraints::ExplicitSolver::viewJacobian ( matrix_t jacobian) const
inline