Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::SequenceCholeskySolverT< T > Class Template Reference

Sequence solver based on banded normal equations and banded factorization. More...

#include <sequence_cholesky_solver.h>

Inheritance diagram for momentum::SequenceCholeskySolverT< T >:

Public Member Functions

 SequenceCholeskySolverT (const SolverOptions &options, SequenceSolverFunctionT< T > *function)
std::string_view getName () const override
 Returns the name of the solver implementation.
double getLastNormalEquationTimeMs () const
double getLastLinearSolveTimeMs () const
void setOptions (const SolverOptions &options) final
 Updates solver configuration with new options.
Public Member Functions inherited from momentum::SequenceSolverBaseT< T >
 SequenceSolverBaseT (const SolverOptions &options, SequenceSolverFunctionT< T > *function)
void setOptions (const SolverOptions &options) override
 Updates solver configuration with new options.
void setEnabledParameters (const ParameterSet &parameters) final
 Specifies which parameters should be optimized.
Public Member Functions inherited from momentum::SolverT< T >
 SolverT (const SolverOptions &options, SolverFunctionT< T > *solver)
 Constructor with solver options and function to optimize.
virtual ~SolverT ()=default
double solve (Eigen::VectorX< T > &params)
 Solves the optimization problem.
const ParameterSet & getActiveParameters () const
 Returns the current set of enabled parameters.
void setParameters (const Eigen::VectorX< T > &params)
 Sets the current parameter values without solving.
void setStoreHistory (bool b)
 Controls whether to store iteration history for debugging and analysis.
const std::unordered_map< std::string, Eigen::MatrixX< T > > & getHistory () const
 Returns the history of the solver's iterations.
size_t getMinIterations () const
 Returns the minimum number of iterations before checking convergence.
size_t getMaxIterations () const
 Returns the maximum number of iterations before terminating.
size_t getNumParameters () const
const std::vector< double > & getErrorHistory () const
 Returns the history of objective function values over the iterations of the solve.

Protected Member Functions

void doIteration () final
 Performs a single iteration of the optimization algorithm.
void initializeSolver () final
 Initializes solver state before optimization begins.

Additional Inherited Members

Protected Attributes inherited from momentum::SequenceSolverBaseT< T >
float regularization_ = 0.05f
bool doLineSearch_ = false
bool multithreaded_ = false
bool progressBar_ = false
size_t bandwidth_ = 0
Protected Attributes inherited from momentum::SolverT< T >
size_t numParameters_
 Total number of parameters in the optimization problem.
SolverFunctionT< T > * solverFunction_
 Function to be optimized.
Eigen::VectorX< T > parameters_
 Current parameter values.
ParameterSet activeParameters_
 Bitset indicating which parameters are enabled for optimization.
int actualParameters_
 Number of parameters currently enabled for optimization.
bool newParameterPattern_
 Flag indicating parameter structure has changed.
size_t iteration_ {}
 Current iteration count.
double error_ {}
 Current objective function value.
double lastError_ {}
 Previous iteration's objective function value.
bool storeHistory = false
 Whether to record optimization progress for analysis.
std::unordered_map< std::string, Eigen::MatrixX< T > > iterationHistory_
 Recorded data from optimization process.
std::vector< double > errorHistory_
 History of objective function values over the iterations.
bool verbose_ = false
 Whether to output detailed progress information.

Detailed Description

template<typename T>
class momentum::SequenceCholeskySolverT< T >

Sequence solver based on banded normal equations and banded factorization.

This solver evaluates each residual/Jacobian block once, immediately folds it into compact J^T J and J^T r storage, and then solves the resulting band-plus-universal system. It uses a block LDLT fast path when possible and falls back to scalar banded LDLT for better numerical robustness. In multithreaded mode, frame chunks accumulate local per-frame and intra-chunk sequence normal equations independently. Sequence error functions that cross chunk boundaries are accumulated afterward in deterministic frame order.

Definition at line 50 of file sequence_cholesky_solver.h.

Constructor & Destructor Documentation

◆ SequenceCholeskySolverT()

Member Function Documentation

◆ doIteration()

template<typename T>
void momentum::SequenceCholeskySolverT< T >::doIteration ( )
finalprotectedvirtual

Performs a single iteration of the optimization algorithm.

Implements momentum::SolverT< T >.

Definition at line 1018 of file sequence_cholesky_solver.cpp.

◆ getLastLinearSolveTimeMs()

template<typename T>
double momentum::SequenceCholeskySolverT< T >::getLastLinearSolveTimeMs ( ) const
inlinenodiscard

Definition at line 60 of file sequence_cholesky_solver.h.

◆ getLastNormalEquationTimeMs()

template<typename T>
double momentum::SequenceCholeskySolverT< T >::getLastNormalEquationTimeMs ( ) const
inlinenodiscard

Definition at line 56 of file sequence_cholesky_solver.h.

◆ getName()

template<typename T>
std::string_view momentum::SequenceCholeskySolverT< T >::getName ( ) const
nodiscardoverridevirtual

Returns the name of the solver implementation.

Implements momentum::SolverT< T >.

Definition at line 987 of file sequence_cholesky_solver.cpp.

◆ initializeSolver()

template<typename T>
void momentum::SequenceCholeskySolverT< T >::initializeSolver ( )
finalprotectedvirtual

Initializes solver state before optimization begins.

Implements momentum::SolverT< T >.

Definition at line 1004 of file sequence_cholesky_solver.cpp.

References momentum::SequenceSolverBaseT< T >::bandwidth_, MT_PROFILE_FUNCTION, and momentum::SolverT< T >::solverFunction_.

◆ setOptions()

template<typename T>
void momentum::SequenceCholeskySolverT< T >::setOptions ( const SolverOptions & options)
finalvirtual

Updates solver configuration with new options.

Reimplemented from momentum::SolverT< T >.

Definition at line 992 of file sequence_cholesky_solver.cpp.

References momentum::SequenceSolverBaseT< T >::setOptions().

Referenced by SequenceCholeskySolverT().


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