Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
gradient_descent_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
22 float learningRate = 0.01f;
23
26
28 /* implicit */ GradientDescentSolverOptions(const SolverOptions& baseOptions)
29 : SolverOptions(baseOptions) {}
30};
31
36template <typename T>
38 public:
41
43 [[nodiscard]] std::string_view getName() const override;
44
46 void setOptions(const SolverOptions& options) final;
47
48 protected:
52 void doIteration() final;
53
55 void initializeSolver() final;
56
57 private:
59 Eigen::VectorX<T> gradient_;
60
62 float learningRate_;
63};
64
65} // namespace momentum
GradientDescentSolverT(const SolverOptions &options, SolverFunctionT< T > *solver)
Creates a solver with the specified options and function to optimize.
void setOptions(const SolverOptions &options) final
Updates solver configuration, handling both base and Gradient Descent specific options.
void doIteration() final
Performs one iteration of the gradient descent algorithm.
std::string_view getName() const override
Returns "GradientDescent" as the solver name.
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
Definition types.h:28
Vector< T, Dynamic > VectorX
Dynamic-size column vector. Common return type for solver residuals and parameter vectors.
Definition types.h:207
GradientDescentSolverOptions()=default
Default constructor.
GradientDescentSolverOptions(const SolverOptions &baseOptions)
Construct from base solver options while preserving Gradient Descent defaults.
float learningRate
Step size for parameter updates during optimization.
Common options for numerical optimization solvers.
Definition solver.h:19