#include <QMCLineSearch.h>
Public Member Functions | |
QMCLineSearch (QMCObjectiveFunction *function, QMCLineSearchStepLengthSelectionAlgorithm *stepAlg, int maxSteps, double tol) | |
Constructs and initializes an instance of this class. | |
virtual | ~QMCLineSearch () |
Virtual destructor. | |
Array1D< double > | optimize (Array1D< double > &initialGuess, QMCDerivativeProperties &dp, double a_diag_factor, int optStep) |
Optimize the function starting from the provided initial guess parameters. | |
Protected Member Functions | |
QMCObjectiveFunction * | getObjectiveFunction () |
Gets the objective function for the calculation. | |
Protected Attributes | |
int | dim |
vector< double > | f |
vector< Array1D< double > > | x |
vector< Array1D< double > > | gradient |
vector< Array2D< double > > | inverseHessian |
Private Member Functions | |
Array1D< double > | searchDirection () |
virtual void | calculateHessian ()=0 |
Calculates the search direction at x. | |
double | stepLength (Array1D< double > &x, Array1D< double > &p, Array1D< double > &g, double f) |
Calculates the step length at x. | |
Private Attributes | |
QMCObjectiveFunction * | OF |
Objective function to optimize. | |
QMCLineSearchStepLengthSelectionAlgorithm * | stepLengthAlg |
Step length determining algorithm to use. | |
double | epsilon |
Tolerance to converge the solution to. | |
int | maximumSteps |
Maximum number of steps allowed for the search. |
As is standard in the field, the optimization is a minimization.
Definition at line 28 of file QMCLineSearch.h.
QMCLineSearch::QMCLineSearch | ( | QMCObjectiveFunction * | function, | |
QMCLineSearchStepLengthSelectionAlgorithm * | stepAlg, | |||
int | maxSteps, | |||
double | tol | |||
) |
Constructs and initializes an instance of this class.
function | objective function to optimize. | |
stepAlg | algorithm to use claculate the step length. | |
maxSteps | maximum number of steps to be performed during the line search. | |
tol | tolerance to converge the solution to. Calculation is converged when . |
Definition at line 17 of file QMCLineSearch.cpp.
References dim, epsilon, maximumSteps, OF, and stepLengthAlg.
virtual QMCLineSearch::~QMCLineSearch | ( | ) | [inline, virtual] |
Array1D< double > QMCLineSearch::optimize | ( | Array1D< double > & | initialGuess, | |
QMCDerivativeProperties & | dp, | |||
double | , | |||
int | ||||
) | [virtual] |
Optimize the function starting from the provided initial guess parameters.
initialGuess | initial guess parameters for the optimization. |
Implements QMCOptimizationAlgorithm.
Definition at line 60 of file QMCLineSearch.cpp.
References QMCFlags::a_diag, Array2D< T >::determinant_and_inverse(), dim, Array2D< T >::dim1(), Array1D< T >::dim1(), Array2D< T >::dim2(), Array2D< T >::eigenvaluesRS(), epsilon, QMCObjectiveFunction::evaluate(), f, QMCInput::flags, getObjectiveFunction(), QMCDerivativeProperties::getParameterGradient(), QMCDerivativeProperties::getParameterHessian(), QMCDerivativeProperties::getParameterValue(), QMCObjectiveFunctionResult::getScore(), globalInput, gradient, inverseHessian, maximumSteps, Array2D< T >::nonSymmetry(), OF, QMCFlags::optimize_Psi_method, QMCInput::printAIParameters(), Array2D< T >::printArray2D(), searchDirection(), Array2D< T >::setToIdentity(), stepLength(), and x.
QMCObjectiveFunction * QMCLineSearch::getObjectiveFunction | ( | ) | [protected] |
Gets the objective function for the calculation.
Definition at line 272 of file QMCLineSearch.cpp.
References OF.
Referenced by optimize().
Array1D< double > QMCLineSearch::searchDirection | ( | ) | [private] |
Definition at line 38 of file QMCLineSearch.cpp.
References calculateHessian(), dim, gradient, and inverseHessian.
Referenced by optimize().
virtual void QMCLineSearch::calculateHessian | ( | ) | [private, pure virtual] |
Calculates the search direction at x.
x' = x + StepLength * SearchDirection
x | current parameter values. | |
g | current gradient value. |
Implemented in QMCBFGSQuasiNewtonLineSearch, and QMCSteepestDescent.
Referenced by searchDirection().
double QMCLineSearch::stepLength | ( | Array1D< double > & | x, | |
Array1D< double > & | p, | |||
Array1D< double > & | g, | |||
double | f | |||
) | [private] |
Calculates the step length at x.
x' = x + StepLength * SearchDirection
x | current parameter values. | |
p | current search direction. | |
g | current gradient value. | |
f | current objective function value. |
Definition at line 29 of file QMCLineSearch.cpp.
References OF, QMCLineSearchStepLengthSelectionAlgorithm::stepLength(), and stepLengthAlg.
Referenced by optimize().
int QMCLineSearch::dim [protected] |
Definition at line 62 of file QMCLineSearch.h.
Referenced by QMCBFGSQuasiNewtonLineSearch::calculateHessian(), optimize(), QMCLineSearch(), and searchDirection().
vector<double> QMCLineSearch::f [protected] |
vector< Array1D<double> > QMCLineSearch::x [protected] |
Definition at line 64 of file QMCLineSearch.h.
Referenced by QMCBFGSQuasiNewtonLineSearch::calculateHessian(), and optimize().
vector< Array1D<double> > QMCLineSearch::gradient [protected] |
Definition at line 65 of file QMCLineSearch.h.
Referenced by QMCBFGSQuasiNewtonLineSearch::calculateHessian(), optimize(), and searchDirection().
vector< Array2D<double> > QMCLineSearch::inverseHessian [protected] |
Definition at line 66 of file QMCLineSearch.h.
Referenced by QMCBFGSQuasiNewtonLineSearch::calculateHessian(), optimize(), and searchDirection().
QMCObjectiveFunction* QMCLineSearch::OF [private] |
Objective function to optimize.
Definition at line 93 of file QMCLineSearch.h.
Referenced by getObjectiveFunction(), optimize(), QMCLineSearch(), and stepLength().
Step length determining algorithm to use.
Definition at line 98 of file QMCLineSearch.h.
Referenced by QMCLineSearch(), and stepLength().
double QMCLineSearch::epsilon [private] |
Tolerance to converge the solution to.
Definition at line 103 of file QMCLineSearch.h.
Referenced by optimize(), and QMCLineSearch().
int QMCLineSearch::maximumSteps [private] |
Maximum number of steps allowed for the search.
Definition at line 108 of file QMCLineSearch.h.
Referenced by optimize(), and QMCLineSearch().