File SteepestDescent.h¶
- Copyright
This code is licensed under the 3-clause BSD license.
Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.
See LICENSE.txt for details.
-
namespace
Scine
This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.
This header contains alias definitions defining which classes to use for the different degrees of derivatives.
-
namespace
Utils
-
class
SteepestDescent
: public Scine::Utils::Optimizer - #include <SteepestDescent.h>
An implementation of a steepest descent optimization algorithm.
The steepest descent algorithm is on of the most simple gradient based optimization algorithms. In each step the parameters are adjusted by subtracting the scaled negative gradient. The gradient is usually scaled by a factor that is smaller than 1.0 .
Public Functions
-
SteepestDescent
() Default constructor.
-
template<class
UpdateFunction
>
intoptimize
(Eigen::VectorXd ¶meters, UpdateFunction &&function, GradientBasedCheck &check) The main routine of the optimizer that carries out the actual optimization.
- Return
int Returns the number of optimization cycles carried out until the conclusion of the optimization function.
- Template Parameters
UpdateFunction
: A lambda function with a void return value, and the arguments:const Eigen::VectorXd& parameters
double& value
Eigen::VectorXd& gradients
- Parameters
parameters
: The parameters to be optimized.function
: The function to be evaluated in order to get values and gradients for a given set of parameters.check
: The ConvergenceCheck to be used in order to determine when the optimization is finished or should stop for other reasons.
-
virtual void
addSettingsDescriptors
(UniversalSettings::DescriptorCollection &collection) const Adds all relevant options to the given UniversalSettings::DescriptorCollection thus expanding it to include the steepest descent options.
- Parameters
collection
: The DescriptorCollection to which new fields shall be added.
Public Members
-
double
factor
= 0.1 The scaling factor alpha to be used in the steepest descent algorithm.
The parameters \(\{x_i\}\) are generated as:
\[ x_{i,n+1} = x_i - \alpha * g_i \]
Public Static Attributes
-
constexpr const char *
sdFactorKey
= "sd_factor"¶
-
-
class
-
namespace