MADNESS  0.10.1
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
madness::QuasiNewton Class Reference

Optimization via quasi-Newton (BFGS or SR1 update) More...

#include <solvers.h>

Inheritance diagram for madness::QuasiNewton:
Inheritance graph
[legend]
Collaboration diagram for madness::QuasiNewton:
Collaboration graph
[legend]

Public Member Functions

 QuasiNewton (const std::shared_ptr< OptimizationTargetInterface > &tar, int maxiter=20, double tol=1e-6, double value_precision=1e-12, double gradient_precision=1e-12)
 
virtual ~QuasiNewton ()
 
bool converged () const
 After running the optimizer returns true if converged. More...
 
double gradient_norm () const
 Value of gradient norm. More...
 
Tensor< double > new_search_direction (const Tensor< double > &g) const
 
bool optimize (Tensor< double > &x)
 Runs the optimizer. More...
 
void reset_hessian ()
 Resets Hessian to default guess. More...
 
void set_hessian (const Tensor< double > &matrix)
 Sets Hessian to given matrix. More...
 
void set_test (const bool &test_level)
 Choose update method (currently only "BFGS" or "SR1") More...
 
void set_update (const std::string &method)
 Choose update method (currently only "BFGS" or "SR1") More...
 
double value () const
 Value of objective function. More...
 
- Public Member Functions inherited from madness::OptimizerInterface
virtual ~OptimizerInterface ()
 

Static Public Member Functions

static void hessian_update_bfgs (const Tensor< double > &dx, const Tensor< double > &dg, Tensor< double > &hessian)
 make this static for other QN classed to have access to it More...
 
static void hessian_update_sr1 (const Tensor< double > &s, const Tensor< double > &y, Tensor< double > &hessian)
 make this static for other QN classed to have access to it More...
 
static double line_search (double a1, double f0, double dxgrad, const Tensor< double > &x, const Tensor< double > &dx, std::shared_ptr< OptimizationTargetInterface > target, double value_precision)
 make this static for other QN classed to have access to it More...
 

Protected Attributes

double f
 
double gnorm
 
const double gradient_precision
 
Tensor< double > h
 
const int maxiter
 
int n
 
bool printtest
 
std::shared_ptr< OptimizationTargetInterfacetarget
 
const double tol
 
std::string update
 
const double value_precision
 

Detailed Description

Optimization via quasi-Newton (BFGS or SR1 update)

This is presently not a low memory algorithm ... we really need one!

Constructor & Destructor Documentation

◆ QuasiNewton()

QuasiNewton::QuasiNewton ( const std::shared_ptr< OptimizationTargetInterface > &  tar,
int  maxiter = 20,
double  tol = 1e-6,
double  value_precision = 1e-12,
double  gradient_precision = 1e-12 
)

References target.

◆ ~QuasiNewton()

virtual madness::QuasiNewton::~QuasiNewton ( )
inlinevirtual

Member Function Documentation

◆ converged()

bool QuasiNewton::converged ( ) const
virtual

After running the optimizer returns true if converged.

Returns
True if converged

Implements madness::OptimizerInterface.

References gnorm, and tol.

Referenced by optimize().

◆ gradient_norm()

double QuasiNewton::gradient_norm ( ) const
virtual

Value of gradient norm.

Returns
Norm of gradient of objective function

Implements madness::OptimizerInterface.

References gnorm.

◆ hessian_update_bfgs()

void QuasiNewton::hessian_update_bfgs ( const Tensor< double > &  dx,
const Tensor< double > &  dg,
Tensor< double > &  hessian 
)
static

make this static for other QN classed to have access to it

References std::abs(), madness::BaseTensor::dim(), madness::inner(), n, and madness::Tensor< T >::trace().

Referenced by optimize(), and madness::MolecularOptimizer::optimize_quasi_newton().

◆ hessian_update_sr1()

void QuasiNewton::hessian_update_sr1 ( const Tensor< double > &  s,
const Tensor< double > &  y,
Tensor< double > &  hessian 
)
static

make this static for other QN classed to have access to it

References std::abs(), e(), madness::inner(), madness::outer(), and q().

Referenced by optimize(), and madness::MolecularOptimizer::optimize_quasi_newton().

◆ line_search()

double QuasiNewton::line_search ( double  a1,
double  f0,
double  dxgrad,
const Tensor< double > &  x,
const Tensor< double > &  dx,
std::shared_ptr< OptimizationTargetInterface target,
double  value_precision 
)
static

make this static for other QN classed to have access to it

References a1, a2, std::abs(), f1, madness::print(), and value_precision.

Referenced by optimize(), and madness::MolecularOptimizer::optimize_quasi_newton().

◆ new_search_direction()

Tensor< double > QuasiNewton::new_search_direction ( const Tensor< double > &  g) const

◆ optimize()

bool QuasiNewton::optimize ( Tensor< double > &  x)
virtual

◆ reset_hessian()

void madness::QuasiNewton::reset_hessian ( )
inline

Resets Hessian to default guess.

References h.

◆ set_hessian()

void madness::QuasiNewton::set_hessian ( const Tensor< double > &  matrix)
inline

Sets Hessian to given matrix.

References madness::copy(), and h.

◆ set_test()

void QuasiNewton::set_test ( const bool &  test_level)

Choose update method (currently only "BFGS" or "SR1")

References printtest.

◆ set_update()

void QuasiNewton::set_update ( const std::string &  method)

Choose update method (currently only "BFGS" or "SR1")

References update.

Referenced by main().

◆ value()

double QuasiNewton::value ( ) const
virtual

Value of objective function.

Returns
Value of objective function

Implements madness::OptimizerInterface.

References f.

Member Data Documentation

◆ f

double madness::QuasiNewton::f
protected

Referenced by optimize(), and value().

◆ gnorm

double madness::QuasiNewton::gnorm
protected

Referenced by converged(), gradient_norm(), and optimize().

◆ gradient_precision

const double madness::QuasiNewton::gradient_precision
protected

Referenced by new_search_direction().

◆ h

Tensor<double> madness::QuasiNewton::h
protected

◆ maxiter

const int madness::QuasiNewton::maxiter
protected

Referenced by optimize().

◆ n

int madness::QuasiNewton::n
protected

◆ printtest

bool madness::QuasiNewton::printtest
protected

◆ target

std::shared_ptr<OptimizationTargetInterface> madness::QuasiNewton::target
protected

Referenced by QuasiNewton(), and optimize().

◆ tol

const double madness::QuasiNewton::tol
protected

Referenced by converged(), and new_search_direction().

◆ update

std::string madness::QuasiNewton::update
protected

Referenced by optimize(), and set_update().

◆ value_precision

const double madness::QuasiNewton::value_precision
protected

Referenced by line_search(), and optimize().


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