Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
multipose_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
13
14namespace momentum {
15
19 float regularization = 0.05f;
20
22
23 /* implicit */ MultiposeSolverOptions(const SolverOptions& baseOptions)
24 : SolverOptions(baseOptions) {
25 // Empty
26 }
27};
28
29template <typename T>
30class MultiposeSolverT : public SolverT<T> {
31 public:
34
37 MultiposeSolverT(MultiposeSolverT&&) noexcept = default;
38 MultiposeSolverT& operator=(MultiposeSolverT&&) noexcept = default;
39
40 [[nodiscard]] std::string_view getName() const override;
41
42 void setOptions(const SolverOptions& options) final;
43
44 void iter() {
46 this->iteration_++;
47 }
48
49 void init() {
50 this->iteration_ = 0;
52 }
53
54 Eigen::VectorX<T> getP() {
55 return this->parameters_;
56 }
57
58 protected:
59 void doIteration() final;
60 void initializeSolver() final;
61
62 private:
63 Eigen::MatrixX<T> jacobianBlock_;
64 Eigen::VectorX<T> residualBlock_;
65 std::unique_ptr<MeshStateT<T>> meshState_;
66
67 float regularization_;
68};
69
70} // namespace momentum
void initializeSolver() final
Initializes solver state before optimization begins.
MultiposeSolverT(const MultiposeSolverT &)=delete
Eigen::VectorX< T > getP()
std::string_view getName() const override
void doIteration() final
Performs a single iteration of the optimization algorithm.
MultiposeSolverT & operator=(const MultiposeSolverT &)=delete
MultiposeSolverT(const SolverOptions &options, MultiposeSolverFunctionT< T > *function)
MultiposeSolverT(MultiposeSolverT &&) noexcept=default
void setOptions(const SolverOptions &options) final
Eigen::VectorX< float > parameters_
Definition solver.h:109
SolverT(const SolverOptions &options, SolverFunctionT< T > *solver)
Constructor with solver options and function to optimize.
Definition solver.cpp:20
Definition types.h:28
Eigen::Matrix< T, Dynamic, Dynamic > MatrixX
Dynamic-size, column-major dense matrix.
Definition types.h:80
Vector< T, Dynamic > VectorX
Dynamic-size column vector. Common return type for solver residuals and parameter vectors.
Definition types.h:207
Represents the complete state of a model's mesh.
Definition mesh_state.h:24
float regularization
Regularization parameter for QR decomposition.
MultiposeSolverOptions(const SolverOptions &baseOptions)
Common options for numerical optimization solvers.
Definition solver.h:19