atomicrex
0.1
An advanced atomistic model building tool
|
#include <SplitBregmanMinimizer.h>
Public Member Functions | |
SplitBregmanMinimizer (FitJob *job) | |
Constructor. | |
virtual void | prepare (std::vector< double > &&x0, const std::function< double(const std::vector< double > &)> &func, const std::function< double(const std::vector< double > &, std::vector< double > &)> &gradient=std::function< double(const std::vector< double > &, std::vector< double > &)>()) override |
virtual void | setConstraints (std::vector< BoundConstraints > &&constraintTypes, std::vector< double > &&lowerBounds, std::vector< double > &&upperBounds) override |
virtual MinimizerResult | iterate () override |
Performs one Split Bregman iteration. | |
double | diff () const |
Returns the last diff. | |
double | xNorm () const |
Returns the last norm of x. | |
virtual void | parse (XML::Element minimizerElement) override |
Parses the minimizer's parameters from the XML file. | |
![]() | |
Minimizer (FitJob *job) | |
Constructor. | |
FitJob * | job () const |
Returns the job to which this object belongs. | |
int | itercount () const |
Returns the number of iterations performed so far. | |
double | value () const |
Returns the value of the objective function at the current x. | |
double | gradientNorm2 () const |
Returns the 2-norm of the gradient of the objective function at the current x. | |
double | convergenceThreshold () const |
Returns the limit for which the minimizer converges. | |
int | maximumNumberOfIterations () const |
Returns the maximum number of iterations for the minimizer. | |
void | setMaximumNumberOfIterations (int num) |
Set the maximum number of iterations for the minimizer. | |
Additional Inherited Members | |
![]() | |
enum | MinimizerResult { MINIMIZATION_CONTINUE, MINIMIZATION_CONVERGED, MINIMIZATION_ABNORMAL, MINIMIZATION_ERROR } |
enum | BoundConstraints { NO_BOUNDS = 0, LOWER_BOUNDS = 1, BOTH_BOUNDS = 2, UPPER_BOUNDS = 3 } |
![]() | |
static std::shared_ptr< Minimizer > | createAndParse (XML::Element minimizerElement, FitJob *job) |
Factory function that creates an instance of the minimizer type that is defined in the XML file. | |
![]() | |
double | numericGradient (const std::vector< double > &x, std::vector< double > &g) |
Computes the gradient of the objective function using finite differences. | |
![]() | |
FitJob * | _job |
Pointer to the job this object belongs to. | |
std::function< double(const std::vector< double > &)> | _func |
Calculates the value of the objective function to be minimized. | |
std::function< double(const std::vector< double > &, std::vector< double > &)> | _gradientFunc |
Calculates the gradient of the objective function. | |
double | f = 0.0 |
The value of the objective function;. | |
double | _gradNorm2 = 0.0 |
The 2-norm of the gradient. | |
int | _itercount = 0 |
Number of iterations performed so far. | |
double | _convergenceThreshold = 1e-5 |
The limit for which the minimizer converges. | |
int | _maximumNumberOfIterations = 100 |
Maximum number of iterations for the minimizer. | |
double | _gradientEpsilon = 1e-6 |
Does Split Bregman iterations.
|
overridevirtual |
Initializes the minimizer by setting the objective function and the starting vector. Must be called once before entering the minimization loop.
x0 | An R-value reference to the starting vector. The length of this vector determines the number of dimensions. The function transfers the vector to internal storage. That means the passed-in vector will no longer be valid after the function returns. |
func | The object that computes the value of the objective function at a given point x. |
gradient | An optional function object that computes the (analytic) gradient of the objective function at a given point x (and also the value of the objective function). If no gradient function is provided, and the minimization algorithm requires the gradient, the minimizer will compute it using finite differences by evaluating func several times. |
Reimplemented from atomicrex::Minimizer.
|
overridevirtual |
Sets constraints for the variation of the parameters. Must be called after prepare() and before the minimization loop is entered. All arguments passed to this function will be transferred into internal storage of this class. The input vectors become invalid when the function returns.
Reimplemented from atomicrex::Minimizer.