Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
subset_gauss_newton_solver.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
10#include <momentum/solver/fwd.h>
12
13namespace momentum {
14
27
33template <typename T>
35 public:
38
40 [[nodiscard]] std::string_view getName() const override;
41
43 void setOptions(const SolverOptions& options) final;
44
48 void setEnabledParameters(const ParameterSet& parameters) final;
49
50 protected:
55 void doIteration() final;
56
58 void initializeSolver() final;
59
60 private:
62 bool initialized_{};
63
65 Eigen::MatrixX<T> jacobian_;
66
68 Eigen::VectorX<T> residual_;
69
71 Eigen::MatrixX<T> subsetHessian_;
72
74 Eigen::VectorX<T> subsetGradient_;
75
77 Eigen::LLT<Eigen::MatrixX<T>> llt_;
78
80 float regularization_;
81
83 bool doLineSearch_;
84
86 Eigen::VectorX<T> delta_;
87
89 Eigen::VectorX<T> subsetDelta_;
90
92 std::vector<int> enabledParameters_;
93
97 void updateEnabledParameters();
98};
99
100} // namespace momentum
Abstract base class for optimization objective functions.
SolverT(const SolverOptions &options, SolverFunctionT< T > *solver)
Constructor with solver options and function to optimize.
Definition solver.cpp:20
void doIteration() final
Performs one iteration of the Subset Gauss-Newton algorithm.
void setOptions(const SolverOptions &options) final
Updates solver configuration, handling both base and Subset Gauss-Newton specific options.
std::string_view getName() const override
Returns "SubsetGaussNewton" as the solver name.
void setEnabledParameters(const ParameterSet &parameters) final
Specifies which parameters should be optimized.
SubsetGaussNewtonSolverT(const SolverOptions &options, SolverFunctionT< T > *solver)
Creates a solver with the specified options and function to optimize.
std::bitset< kMaxModelParams > ParameterSet
Bitset for model parameter enablement.
Definition types.h:430
GaussNewtonSolverBaseOptions()=default
Default constructor.
Common options for numerical optimization solvers.
Definition solver.h:19
SubsetGaussNewtonSolverOptions(const SolverOptions &baseOptions)
Construct from base solver options while preserving Subset Gauss-Newton defaults.
SubsetGaussNewtonSolverOptions()=default
Default constructor.