atomicrex  0.1
An advanced atomistic model building tool
Public Member Functions | List of all members
atomicrex::SplitBregmanMinimizer Class Reference

#include <SplitBregmanMinimizer.h>

Inheritance diagram for atomicrex::SplitBregmanMinimizer:
atomicrex::Minimizer

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.
 
- Public Member Functions inherited from atomicrex::Minimizer
 Minimizer (FitJob *job)
 Constructor.
 
FitJobjob () 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

- Public Types inherited from atomicrex::Minimizer
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 Public Member Functions inherited from atomicrex::Minimizer
static std::shared_ptr< MinimizercreateAndParse (XML::Element minimizerElement, FitJob *job)
 Factory function that creates an instance of the minimizer type that is defined in the XML file.
 
- Protected Member Functions inherited from atomicrex::Minimizer
double numericGradient (const std::vector< double > &x, std::vector< double > &g)
 Computes the gradient of the objective function using finite differences.
 
- Protected Attributes inherited from atomicrex::Minimizer
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
 

Detailed Description

Does Split Bregman iterations.

Member Function Documentation

◆ prepare()

void atomicrex::SplitBregmanMinimizer::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>&)>() 
)
overridevirtual

Initializes the minimizer by setting the objective function and the starting vector. Must be called once before entering the minimization loop.

Parameters
x0An 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.
funcThe object that computes the value of the objective function at a given point x.
gradientAn 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.

◆ setConstraints()

void atomicrex::SplitBregmanMinimizer::setConstraints ( std::vector< BoundConstraints > &&  constraintTypes,
std::vector< double > &&  lowerBounds,
std::vector< double > &&  upperBounds 
)
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.


The documentation for this class was generated from the following files: