bpp-phyl3
3.0.0
|
This Optimizer implements Newton's algorithm for finding a minimum of a function. This is in fact a modified version of the algorithm, as suggested by Nicolas Galtier, for the purpose of optimizing phylogenetic likelihoods. More...
#include <Bpp/Phyl/PseudoNewtonOptimizer.h>
Classes | |
class | PNStopCondition |
Public Member Functions | |
PseudoNewtonOptimizer (std::shared_ptr< SecondOrderDerivable > function) | |
virtual | ~PseudoNewtonOptimizer () |
PseudoNewtonOptimizer * | clone () const |
const SecondOrderDerivable & | secondOrderDerivableFunction () const |
SecondOrderDerivable & | secondOrderDerivableFunction () |
std::shared_ptr< const SecondOrderDerivable > | getSecondOrderDerivableFunction () const |
std::shared_ptr< SecondOrderDerivable > | getSecondOrderDerivableFunction () |
void | doInit (const ParameterList ¶ms) |
double | doStep () |
void | setMaximumNumberOfCorrections (unsigned int mx) |
void | disableCG () |
void | updateParameters (bool yn) override |
bool | updateParameters () const override |
void | setOptimizationProgressCharacter (const std::string &c) |
const std::string & | getOptimizationProgressCharacter () const |
void | init (const ParameterList ¶ms) override |
void | init (const ParameterList ¶ms) override |
double | step () override |
double | step () override |
double | optimize () override |
double | optimize () override |
bool | isInitialized () const override |
bool | isInitialized () const override |
const ParameterList & | getParameters () const override |
const ParameterList & | getParameters () const override |
double | getParameterValue (const std::string &name) const override |
double | getParameterValue (const std::string &name) const override |
void | setFunction (std::shared_ptr< FunctionInterface > function) override |
void | setFunction (std::shared_ptr< FunctionInterface > function) override |
const FunctionInterface & | function () const override |
FunctionInterface & | function () override |
const FunctionInterface & | function () const override |
FunctionInterface & | function () override |
std::shared_ptr< const FunctionInterface > | getFunction () const override |
std::shared_ptr< FunctionInterface > | getFunction () override |
std::shared_ptr< const FunctionInterface > | getFunction () const override |
std::shared_ptr< FunctionInterface > | getFunction () override |
bool | hasFunction () const override |
bool | hasFunction () const override |
void | setMessageHandler (std::shared_ptr< OutputStream > mh) override |
void | setMessageHandler (std::shared_ptr< OutputStream > mh) override |
std::shared_ptr< OutputStream > | getMessageHandler () const override |
std::shared_ptr< OutputStream > | getMessageHandler () const override |
void | setProfiler (std::shared_ptr< OutputStream > profiler) override |
void | setProfiler (std::shared_ptr< OutputStream > profiler) override |
std::shared_ptr< OutputStream > | getProfiler () const override |
std::shared_ptr< OutputStream > | getProfiler () const override |
unsigned int | getNumberOfEvaluations () const override |
unsigned int | getNumberOfEvaluations () const override |
void | setStopCondition (std::shared_ptr< OptimizationStopCondition > stopCondition) override |
void | setStopCondition (std::shared_ptr< OptimizationStopCondition > stopCondition) override |
std::shared_ptr< OptimizationStopCondition > | getStopCondition () override |
std::shared_ptr< const OptimizationStopCondition > | getStopCondition () const override |
std::shared_ptr< OptimizationStopCondition > | getStopCondition () override |
std::shared_ptr< const OptimizationStopCondition > | getStopCondition () const override |
std::shared_ptr< OptimizationStopCondition > | getDefaultStopCondition () override |
std::shared_ptr< const OptimizationStopCondition > | getDefaultStopCondition () const override |
std::shared_ptr< OptimizationStopCondition > | getDefaultStopCondition () override |
std::shared_ptr< const OptimizationStopCondition > | getDefaultStopCondition () const override |
bool | isToleranceReached () const override |
bool | isToleranceReached () const override |
bool | isMaximumNumberOfEvaluationsReached () const override |
bool | isMaximumNumberOfEvaluationsReached () const override |
void | setMaximumNumberOfEvaluations (unsigned int max) override |
void | setMaximumNumberOfEvaluations (unsigned int max) override |
void | setVerbose (unsigned int v) override |
void | setVerbose (unsigned int v) override |
unsigned int | getVerbose () const override |
unsigned int | getVerbose () const override |
void | setConstraintPolicy (const std::string &constraintPolicy) override |
void | setConstraintPolicy (const std::string &constraintPolicy) override |
std::string | getConstraintPolicy () const override |
std::string | getConstraintPolicy () const override |
void | addOptimizationListener (std::shared_ptr< OptimizationListener > listener) override |
void | addOptimizationListener (std::shared_ptr< OptimizationListener > listener) override |
The Optimizer interface. | |
double | getFunctionValue () const |
Protected Member Functions | |
ParameterList & | getParameters_ () |
Parameter & | getParameter_ (size_t i) |
std::shared_ptr< FunctionInterface > | getFunction_ () |
void | setDefaultStopCondition_ (std::shared_ptr< OptimizationStopCondition > osc) |
void | autoParameter () |
void | autoParameter () |
void | ignoreConstraints () |
void | ignoreConstraints () |
void | profile (double v) |
void | profile (unsigned int v) |
void | profile (const std::string &s) |
void | profile (double v) |
void | profile (unsigned int v) |
void | profile (const std::string &s) |
void | profileln (double v) |
void | profileln (unsigned int v) |
void | profileln (const std::string &s) |
void | profileln (double v) |
void | profileln (unsigned int v) |
void | profileln (const std::string &s) |
void | printPoint (const ParameterList ¶ms, double value) |
void | printPoint (const ParameterList ¶ms, double value) |
void | printMessage (const std::string &message) |
void | printMessage (const std::string &message) |
void | fireOptimizationInitializationPerformed (const OptimizationEvent &event) |
void | fireOptimizationInitializationPerformed (const OptimizationEvent &event) |
void | fireOptimizationStepPerformed (const OptimizationEvent &event) |
void | fireOptimizationStepPerformed (const OptimizationEvent &event) |
bool | listenerModifiesParameters () const |
bool | listenerModifiesParameters () const |
Protected Attributes | |
std::shared_ptr< FunctionInterface > | function_ |
ParameterList | parameters_ |
std::shared_ptr< OutputStream > | messageHandler_ |
std::shared_ptr< OutputStream > | profiler_ |
std::string | constraintPolicy_ |
std::shared_ptr< OptimizationStopCondition > | stopCondition_ |
std::shared_ptr< OptimizationStopCondition > | defaultStopCondition_ |
unsigned int | verbose_ |
bool | isInitialized_ |
time_t | startTime_ |
std::vector< std::shared_ptr< OptimizationListener > > | listeners_ |
bool | updateParameters_ |
std::string | stepChar_ |
unsigned int | nbEvalMax_ |
unsigned int | nbEval_ |
double | currentValue_ |
bool | tolIsReached_ |
Private Attributes | |
ParameterList | previousPoint_ |
double | previousValue_ |
size_t | n_ |
std::vector< std::string > | params_ |
unsigned int | maxCorrection_ |
bool | useCG_ |
Friends | |
class | PNStopCondition |
This Optimizer implements Newton's algorithm for finding a minimum of a function. This is in fact a modified version of the algorithm, as suggested by Nicolas Galtier, for the purpose of optimizing phylogenetic likelihoods.
Only second simple order derivative are computed, no cross derivative, following Galtier's algorithm. Felsenstein and Churchill's (1996) correction is applied when new trial as a likelihood lower than the starting point.
Definition at line 23 of file PseudoNewtonOptimizer.h.
PseudoNewtonOptimizer::PseudoNewtonOptimizer | ( | std::shared_ptr< SecondOrderDerivable > | function | ) |
Definition at line 38 of file PseudoNewtonOptimizer.cpp.
References bpp::AbstractOptimizer::getDefaultStopCondition(), bpp::AbstractOptimizer::setDefaultStopCondition_(), and bpp::AbstractOptimizer::setStopCondition().
Referenced by clone().
|
inlinevirtual |
Definition at line 60 of file PseudoNewtonOptimizer.h.
|
inlinevirtual |
Implements bpp::AbstractOptimizer.
Definition at line 62 of file PseudoNewtonOptimizer.h.
References PseudoNewtonOptimizer().
|
inline |
Definition at line 99 of file PseudoNewtonOptimizer.h.
References useCG_.
|
virtual |
Implements bpp::AbstractOptimizer.
Definition at line 53 of file PseudoNewtonOptimizer.cpp.
References bpp::SecondOrderDerivable::enableSecondOrderDerivatives(), bpp::ParameterList::getParameterNames(), bpp::AbstractOptimizer::getParameters(), n_, params_, secondOrderDerivableFunction(), bpp::SecondOrderDerivable::setParameters(), and bpp::ParameterList::size().
|
virtual |
Implements bpp::AbstractOptimizer.
Definition at line 63 of file PseudoNewtonOptimizer.cpp.
References count(), bpp::AbstractOptimizer::currentValue_, bpp::SecondOrderDerivable::enableSecondOrderDerivatives(), bpp::AbstractOptimizer::function_, bpp::AbstractOptimizer::getConstraintPolicy(), bpp::SecondOrderDerivable::getFirstOrderDerivative(), bpp::AbstractOptimizer::getFunction(), bpp::ConjugateGradientMultiDimensions::getFunctionValue(), bpp::AbstractOptimizer::getMessageHandler(), bpp::AbstractOptimizer::getParameters(), bpp::ConjugateGradientMultiDimensions::getParameters(), bpp::AbstractOptimizer::getParameters_(), bpp::AbstractOptimizer::getProfiler(), bpp::SecondOrderDerivable::getSecondOrderDerivative(), bpp::ConjugateGradientMultiDimensions::getStopCondition(), bpp::AbstractOptimizer::getStopCondition(), bpp::ConjugateGradientMultiDimensions::init(), maxCorrection_, n_, bpp::AbstractOptimizer::nbEvalMax_, bpp::ConjugateGradientMultiDimensions::optimize(), params_, previousPoint_, previousValue_, bpp::AbstractOptimizer::printMessage(), secondOrderDerivableFunction(), bpp::ConjugateGradientMultiDimensions::setConstraintPolicy(), bpp::ConjugateGradientMultiDimensions::setMaximumNumberOfEvaluations(), bpp::ConjugateGradientMultiDimensions::setMessageHandler(), bpp::SecondOrderDerivable::setParameters(), bpp::ConjugateGradientMultiDimensions::setProfiler(), bpp::ConjugateGradientMultiDimensions::setVerbose(), bpp::TextTools::toString(), bpp::AbstractOptimizer::updateParameters(), and useCG_.
|
inlinevirtual |
Reimplemented from bpp::AbstractOptimizer.
Definition at line 90 of file PseudoNewtonOptimizer.h.
References bpp::AbstractOptimizer::currentValue_.
|
inline |
Definition at line 80 of file PseudoNewtonOptimizer.h.
References bpp::AbstractOptimizer::function_.
|
inline |
Definition at line 75 of file PseudoNewtonOptimizer.h.
References bpp::AbstractOptimizer::function_.
|
inline |
Definition at line 70 of file PseudoNewtonOptimizer.h.
References bpp::AbstractOptimizer::function_.
|
inline |
Definition at line 65 of file PseudoNewtonOptimizer.h.
References bpp::AbstractOptimizer::function_.
|
inline |
Definition at line 97 of file PseudoNewtonOptimizer.h.
References maxCorrection_.
|
friend |
Definition at line 42 of file PseudoNewtonOptimizer.h.
|
private |
Definition at line 53 of file PseudoNewtonOptimizer.h.
Referenced by doStep(), and setMaximumNumberOfCorrections().
|
private |
Definition at line 49 of file PseudoNewtonOptimizer.h.
|
private |
Definition at line 51 of file PseudoNewtonOptimizer.h.
|
private |
Definition at line 45 of file PseudoNewtonOptimizer.h.
Referenced by doStep().
|
private |
Definition at line 47 of file PseudoNewtonOptimizer.h.
Referenced by doStep(), and bpp::PseudoNewtonOptimizer::PNStopCondition::getCurrentTolerance().
|
private |
Definition at line 55 of file PseudoNewtonOptimizer.h.
Referenced by disableCG(), and doStep().