pele
Python energy landscape explorer
 All Classes Namespaces Functions Variables Typedefs
Public Member Functions | Protected Member Functions | Protected Attributes
pele::GradientOptimizer Class Reference

#include <optimizer.h>

Inheritance diagram for pele::GradientOptimizer:
pele::Optimizer pele::LBFGS pele::MODIFIED_FIRE

List of all members.

Public Member Functions

 GradientOptimizer (std::shared_ptr< pele::BasePotential > potential, const pele::Array< double > x0, double tol=1e-4)
virtual ~GradientOptimizer ()
virtual void one_iteration ()=0
void run (int const niter)
void run ()
virtual void set_func_gradient (double f, Array< double > grad)
virtual void reset (pele::Array< double > &x0)
void set_tol (double tol)
void set_maxstep (double maxstep)
void set_max_iter (int max_iter)
void set_iprint (int iprint)
void set_verbosity (int verbosity)
Array< double > get_x () const
Array< double > get_g () const
double get_f () const
double get_rms () const
int get_nfev () const
int get_niter () const
int get_maxiter () const
double get_maxstep ()
double get_tol () const
bool success ()
virtual bool stop_criterion_satisfied ()

Protected Member Functions

void compute_func_gradient (Array< double > x, double &func, Array< double > gradient)
virtual void initialize_func_gradient ()

Protected Attributes

std::shared_ptr
< pele::BasePotential
potential_
double tol_
double maxstep_
int maxiter_
int iprint_
int verbosity_
int iter_number_
int nfev_
Array< double > x_
double f_
Array< double > g_
double rms_
bool func_initialized_

Detailed Description

This defines the basic interface for optimizers. All pele optimizers should derive from this class.

Definition at line 56 of file optimizer.h.


Constructor & Destructor Documentation

pele::GradientOptimizer::GradientOptimizer ( std::shared_ptr< pele::BasePotential potential,
const pele::Array< double >  x0,
double  tol = 1e-4 
) [inline]

Definition at line 91 of file optimizer.h.

virtual pele::GradientOptimizer::~GradientOptimizer ( ) [inline, virtual]

Definition at line 108 of file optimizer.h.


Member Function Documentation

void pele::GradientOptimizer::compute_func_gradient ( Array< double >  x,
double &  func,
Array< double >  gradient 
) [inline, protected]

Compute the func and gradient of the objective function

Definition at line 203 of file optimizer.h.

double pele::GradientOptimizer::get_f ( ) const [inline, virtual]

Implements pele::Optimizer.

Definition at line 180 of file optimizer.h.

Array<double> pele::GradientOptimizer::get_g ( ) const [inline, virtual]

Implements pele::Optimizer.

Definition at line 179 of file optimizer.h.

int pele::GradientOptimizer::get_maxiter ( ) const [inline]

Definition at line 184 of file optimizer.h.

Definition at line 185 of file optimizer.h.

int pele::GradientOptimizer::get_nfev ( ) const [inline, virtual]

Implements pele::Optimizer.

Definition at line 182 of file optimizer.h.

int pele::GradientOptimizer::get_niter ( ) const [inline, virtual]

Implements pele::Optimizer.

Definition at line 183 of file optimizer.h.

double pele::GradientOptimizer::get_rms ( ) const [inline, virtual]

Implements pele::Optimizer.

Definition at line 181 of file optimizer.h.

double pele::GradientOptimizer::get_tol ( ) const [inline]

Definition at line 186 of file optimizer.h.

Array<double> pele::GradientOptimizer::get_x ( ) const [inline, virtual]

accessors

Implements pele::Optimizer.

Definition at line 178 of file optimizer.h.

virtual void pele::GradientOptimizer::initialize_func_gradient ( ) [inline, protected, virtual]

compute the initial func and gradient

Reimplemented in pele::MODIFIED_FIRE.

Definition at line 215 of file optimizer.h.

virtual void pele::GradientOptimizer::one_iteration ( ) [pure virtual]

Do one iteration iteration of the optimization algorithm

Implements pele::Optimizer.

Implemented in pele::MODIFIED_FIRE, and pele::LBFGS.

virtual void pele::GradientOptimizer::reset ( pele::Array< double > &  x0) [inline, virtual]

Reimplemented in pele::LBFGS, and pele::MODIFIED_FIRE.

Definition at line 164 of file optimizer.h.

void pele::GradientOptimizer::run ( int const  niter) [inline, virtual]

Run the optimization algorithm until the stop criterion is satisfied or until the maximum number of iterations is reached

Implements pele::Optimizer.

Definition at line 119 of file optimizer.h.

void pele::GradientOptimizer::run ( ) [inline, virtual]

Run the optimzation algorithm for niter iterations or until the stop criterion is satisfied

Implements pele::Optimizer.

Definition at line 140 of file optimizer.h.

virtual void pele::GradientOptimizer::set_func_gradient ( double  f,
Array< double >  grad 
) [inline, virtual]

Set the initial func and gradient. This can be used to avoid one potential call

Reimplemented in pele::MODIFIED_FIRE.

Definition at line 149 of file optimizer.h.

void pele::GradientOptimizer::set_iprint ( int  iprint) [inline]

Definition at line 173 of file optimizer.h.

void pele::GradientOptimizer::set_max_iter ( int  max_iter) [inline]

Definition at line 172 of file optimizer.h.

void pele::GradientOptimizer::set_maxstep ( double  maxstep) [inline]

Definition at line 171 of file optimizer.h.

void pele::GradientOptimizer::set_tol ( double  tol) [inline]

Definition at line 170 of file optimizer.h.

void pele::GradientOptimizer::set_verbosity ( int  verbosity) [inline]

Definition at line 174 of file optimizer.h.

virtual bool pele::GradientOptimizer::stop_criterion_satisfied ( ) [inline, virtual]

Return true if the termination condition is satisfied, false otherwise

Definition at line 192 of file optimizer.h.

bool pele::GradientOptimizer::success ( ) [inline, virtual]

Implements pele::Optimizer.

Definition at line 187 of file optimizer.h.


Member Data Documentation

double pele::GradientOptimizer::f_ [protected]

The current function value

Definition at line 76 of file optimizer.h.

This flag keeps track of whether the function and gradient have been initialized. This allows the initial function and gradient to be computed outside of the constructor and also allows the function and gradient to be passed rather than computed. The downside is that it complicates the logic because this flag must be checked at all places where the gradient, function value, or rms can be first accessed.

Definition at line 88 of file optimizer.h.

Array<double> pele::GradientOptimizer::g_ [protected]

The current gradient

Definition at line 77 of file optimizer.h.

how often to print status information

Definition at line 68 of file optimizer.h.

The current iteration number

Definition at line 71 of file optimizer.h.

The maximum number of iterations

Definition at line 67 of file optimizer.h.

The maximum step size

Definition at line 65 of file optimizer.h.

The number of function evaluations

Definition at line 72 of file optimizer.h.

A pointer to the object that computes the function and gradient

Definition at line 62 of file optimizer.h.

double pele::GradientOptimizer::rms_ [protected]

The root mean square of the gradient

Definition at line 78 of file optimizer.h.

double pele::GradientOptimizer::tol_ [protected]

The tolerance for the rms gradient

Definition at line 64 of file optimizer.h.

How much information to print

Definition at line 69 of file optimizer.h.

Array<double> pele::GradientOptimizer::x_ [protected]

The current coordinates

Definition at line 75 of file optimizer.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs