bpp-core3  3.0.0
bpp::NewtonBacktrackOneDimension Class Reference

Newton's backtrack nearly optimization for one parameter. More...

#include <Bpp/Numeric/Function/NewtonBacktrackOneDimension.h>

+ Inheritance diagram for bpp::NewtonBacktrackOneDimension:
+ Collaboration diagram for bpp::NewtonBacktrackOneDimension:

Classes

class  NBODStopCondition
 

Public Member Functions

 NewtonBacktrackOneDimension (std::shared_ptr< FunctionInterface > function, double slope, double test)
 Constructor. More...
 
virtual ~NewtonBacktrackOneDimension ()
 
NewtonBacktrackOneDimensionclone () const
 Create a copy of this object and send a pointer to it. More...
 
void doInit (const ParameterList &params)
 This function is called by the init() method and contains all calculations. More...
 
double doStep ()
 This function is called by the step() method and contains all calculations. More...
 
const FirstOrderDerivablefirstOrderDerivableFunction () const
 
FirstOrderDerivablefirstOrderDerivableFunction ()
 
std::shared_ptr< const FirstOrderDerivablegetFirstOrderDerivableFunction () const
 
std::shared_ptr< FirstOrderDerivablegetFirstOrderDerivableFunction ()
 
void updateParameters (bool yn) override
 Tell if we shall update all parameters after one optimization step. More...
 
bool updateParameters () const override
 Tell if we shall update all parameters after one optimization step. More...
 
void setOptimizationProgressCharacter (const std::string &c)
 Set the character to be displayed during optimization. More...
 
const std::string & getOptimizationProgressCharacter () const
 
The Optimizer interface.
void init (const ParameterList &params) override
 Basic implementation. More...
 
double step () override
 Basic implementation. More...
 
double optimize () override
 Basic implementation. More...
 
bool isInitialized () const override
 
const ParameterListgetParameters () const override
 
double getParameterValue (const std::string &name) const override
 
void setFunction (std::shared_ptr< FunctionInterface > function) override
 Set the function to optimize. More...
 
const FunctionInterfacefunction () const override
 Get the current function being optimized. More...
 
FunctionInterfacefunction () override
 Get the current function being optimized. More...
 
std::shared_ptr< const FunctionInterfacegetFunction () const override
 Get the current function being optimized. More...
 
std::shared_ptr< FunctionInterfacegetFunction () override
 Get the current function being optimized. More...
 
bool hasFunction () const override
 Tell if a funciton is associatied to this optimizer. More...
 
double getFunctionValue () const override
 Get the current function value. More...
 
void setMessageHandler (std::shared_ptr< OutputStream > mh) override
 Set the message handler for this optimizer. More...
 
std::shared_ptr< OutputStreamgetMessageHandler () const override
 
void setProfiler (std::shared_ptr< OutputStream > profiler) override
 Set the profiler for this optimizer. More...
 
std::shared_ptr< OutputStreamgetProfiler () const override
 
unsigned int getNumberOfEvaluations () const override
 Get the number of function evaluations performed since the call of the init function. More...
 
void setStopCondition (std::shared_ptr< OptimizationStopCondition > stopCondition) override
 Set the stop condition of the optimization algorithm. More...
 
std::shared_ptr< OptimizationStopConditiongetStopCondition () override
 Get the stop condition of the optimization algorithm. More...
 
std::shared_ptr< const OptimizationStopConditiongetStopCondition () const override
 Get the stop condition of the optimization algorithm. More...
 
std::shared_ptr< OptimizationStopConditiongetDefaultStopCondition () override
 Get the default stop condition of the optimization algorithm. More...
 
std::shared_ptr< const OptimizationStopConditiongetDefaultStopCondition () const override
 Get the default stop condition of the optimization algorithm. More...
 
bool isToleranceReached () const override
 Tell if the tolerance level is reached. More...
 
bool isMaximumNumberOfEvaluationsReached () const override
 Tell if the maximum number of function evaluations is reached. More...
 
void setMaximumNumberOfEvaluations (unsigned int max) override
 Set the maximum number of function evaluation to perform during optimization. More...
 
void setVerbose (unsigned int v) override
 Set the verbose level. More...
 
unsigned int getVerbose () const override
 Get the verbose level. More...
 
void setConstraintPolicy (const std::string &constraintPolicy) override
 Set the constraint policy for this optimizer. More...
 
std::string getConstraintPolicy () const override
 Get the constraint policy for this optimizer. More...
 
void addOptimizationListener (std::shared_ptr< OptimizationListener > listener) override
 Register a listener to this class. More...
 

Protected Member Functions

ParameterListgetParameters_ ()
 
ParametergetParameter_ (size_t i)
 
std::shared_ptr< FunctionInterfacegetFunction_ ()
 
void setDefaultStopCondition_ (std::shared_ptr< OptimizationStopCondition > osc)
 
Inner utilitary functions
void autoParameter ()
 Build a list of AutoParameter instead of Parameter. More...
 
void ignoreConstraints ()
 Remove the constraints of all the arguments. More...
 
void profile (double v)
 Print to the profile if there is one. More...
 
void profile (unsigned int v)
 Print to the profile if there is one. More...
 
void profile (const std::string &s)
 Print to the profile if there is one. More...
 
void profileln (double v)
 Print to the profile if there is one and end line. More...
 
void profileln (unsigned int v)
 Print to the profile if there is one and end line. More...
 
void profileln (const std::string &s)
 Print to the profile if there is one and end line. More...
 
void printPoint (const ParameterList &params, double value)
 Print parameters and corresponding function evaluation to profiler. More...
 
void printMessage (const std::string &message)
 Give a message to print to the message handler. More...
 
void fireOptimizationInitializationPerformed (const OptimizationEvent &event)
 Notify all listeners that optimizer initialization was performed. More...
 
void fireOptimizationStepPerformed (const OptimizationEvent &event)
 Notify all listeners that an optimization step was performed. More...
 
bool listenerModifiesParameters () const
 

Protected Attributes

std::shared_ptr< FunctionInterfacefunction_
 The function to optimize. More...
 
ParameterList parameters_
 The parameters that will be optimized. More...
 
std::shared_ptr< OutputStreammessageHandler_
 The message handler. More...
 
std::shared_ptr< OutputStreamprofiler_
 The profiler. More...
 
std::string constraintPolicy_
 The constraint policy. More...
 
std::shared_ptr< OptimizationStopConditionstopCondition_
 The stoping condition to use while optimizing. More...
 
std::shared_ptr< OptimizationStopConditiondefaultStopCondition_
 The default stoping condition to use while optimizing. More...
 
unsigned int verbose_
 State of the verbose mode: > 0 = enabled. More...
 
bool isInitialized_
 Check if the optimizer have been feeded with initial parameters values. More...
 
time_t startTime_
 
std::vector< std::shared_ptr< OptimizationListener > > listeners_
 
bool updateParameters_
 
std::string stepChar_
 
unsigned int nbEvalMax_
 The maximum number of function evaluations allowed. More...
 
unsigned int nbEval_
 The current number of function evaluations achieved. More...
 
double currentValue_
 The current value of the function. More...
 
bool tolIsReached_
 Tell if the tolerance level has been reached. More...
 

Private Attributes

double fold_
 
double f_
 
double a_
 
double alam_
 
double alamin_
 
double alam2_
 
double b_
 
double disc_
 
double f2_
 
double rhs1_
 
double rhs2_
 
double slope_
 
double test_
 
double tmplam_
 

Friends

class NBODStopCondition
 

Detailed Description

Newton's backtrack nearly optimization for one parameter.

This algorithm looks for a value that 'sufficiently low' enough near the minimum of the function, but does not look for the minimum. It needs the first derivative of a function.

Search a 'sufficiently low' value for a function in a given direction.

This function implements the algorithm described for example in page 385 of

NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING
(ISBN 0-521-43108-5)

Definition at line 32 of file NewtonBacktrackOneDimension.h.

Constructor & Destructor Documentation

◆ NewtonBacktrackOneDimension()

NewtonBacktrackOneDimension::NewtonBacktrackOneDimension ( std::shared_ptr< FunctionInterface function,
double  slope,
double  test 
)

Constructor.

Parameters
functiona pointer to the function
slopethe slope of the backtrack
testthe inverse factor on the stop tolerance

Definition at line 13 of file NewtonBacktrackOneDimension.cpp.

References bpp::AbstractOptimizer::getDefaultStopCondition(), bpp::AbstractOptimizer::setDefaultStopCondition_(), bpp::AbstractOptimizer::setMaximumNumberOfEvaluations(), and bpp::AbstractOptimizer::setStopCondition().

Referenced by clone().

◆ ~NewtonBacktrackOneDimension()

virtual bpp::NewtonBacktrackOneDimension::~NewtonBacktrackOneDimension ( )
inlinevirtual

Definition at line 62 of file NewtonBacktrackOneDimension.h.

Member Function Documentation

◆ addOptimizationListener()

void bpp::AbstractOptimizer::addOptimizationListener ( std::shared_ptr< OptimizationListener listener)
inlineoverridevirtualinherited

Register a listener to this class.

All registered listeners will be informed when an optimization event occur. See the documentation of the class to know what kind of events are supported.

Parameters
listenerA listener to be registered with.

Implements bpp::OptimizerInterface.

Definition at line 235 of file AbstractOptimizer.h.

◆ autoParameter()

◆ clone()

NewtonBacktrackOneDimension* bpp::NewtonBacktrackOneDimension::clone ( ) const
inlinevirtual

Create a copy of this object and send a pointer to it.

Returns
A pointer toward the copy object.

Implements bpp::OptimizerInterface.

Definition at line 64 of file NewtonBacktrackOneDimension.h.

References NewtonBacktrackOneDimension().

◆ doInit()

void NewtonBacktrackOneDimension::doInit ( const ParameterList params)
virtual

This function is called by the init() method and contains all calculations.

Parameters
paramsThe parameters to use for initialization.

Implements bpp::AbstractOptimizer.

Definition at line 25 of file NewtonBacktrackOneDimension.cpp.

References alam_, alamin_, fold_, bpp::AbstractOptimizer::getFunction(), bpp::AbstractOptimizer::getParameters(), bpp::AbstractOptimizer::getStopCondition(), bpp::ParameterList::size(), and test_.

◆ doStep()

double NewtonBacktrackOneDimension::doStep ( )
virtual

This function is called by the step() method and contains all calculations.

Returns
The value of the function after the optimization step.

Implements bpp::AbstractOptimizer.

Definition at line 38 of file NewtonBacktrackOneDimension.cpp.

References a_, alam2_, alam_, alamin_, b_, disc_, f2_, f_, fold_, bpp::AbstractOptimizer::getFunction(), bpp::AbstractOptimizer::getParameter_(), bpp::AbstractOptimizer::getParameters(), rhs1_, rhs2_, bpp::Parameter::setValue(), slope_, tmplam_, and bpp::AbstractOptimizer::tolIsReached_.

◆ fireOptimizationInitializationPerformed()

void AbstractOptimizer::fireOptimizationInitializationPerformed ( const OptimizationEvent event)
protectedinherited

Notify all listeners that optimizer initialization was performed.

This method should be called by the init method.

Parameters
eventAn OptimizationEvent object.

Definition at line 295 of file AbstractOptimizer.cpp.

References bpp::AbstractOptimizer::listeners_.

Referenced by bpp::AbstractOptimizer::getOptimizationProgressCharacter(), and bpp::AbstractOptimizer::init().

◆ fireOptimizationStepPerformed()

void AbstractOptimizer::fireOptimizationStepPerformed ( const OptimizationEvent event)
protectedinherited

Notify all listeners that an optimization step was performed.

This method should be called by the step method.

Parameters
eventAn OptimizationEvent object.

Definition at line 305 of file AbstractOptimizer.cpp.

References bpp::AbstractOptimizer::listeners_.

Referenced by bpp::AbstractOptimizer::getOptimizationProgressCharacter(), and bpp::AbstractOptimizer::step().

◆ firstOrderDerivableFunction() [1/2]

const FirstOrderDerivable& bpp::NewtonBacktrackOneDimension::firstOrderDerivableFunction ( ) const
inline

Definition at line 74 of file NewtonBacktrackOneDimension.h.

References bpp::AbstractOptimizer::function_.

◆ firstOrderDerivableFunction() [2/2]

FirstOrderDerivable& bpp::NewtonBacktrackOneDimension::firstOrderDerivableFunction ( )
inline

Definition at line 86 of file NewtonBacktrackOneDimension.h.

References bpp::AbstractOptimizer::function_.

◆ function() [1/2]

const FunctionInterface& bpp::AbstractOptimizer::function ( ) const
inlineoverridevirtualinherited

Get the current function being optimized.

Returns
A const reference toward the function being optimized.
Exceptions
NullPointerExceptionif no function is associated with the optimizer.

Implements bpp::OptimizerInterface.

Definition at line 162 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::function_.

◆ function() [2/2]

FunctionInterface& bpp::AbstractOptimizer::function ( )
inlineoverridevirtualinherited

Get the current function being optimized.

Returns
A const reference toward the function being optimized.
Exceptions
NullPointerExceptionif no function is associated with the optimizer.

Implements bpp::OptimizerInterface.

Definition at line 174 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::function_.

◆ getConstraintPolicy()

std::string bpp::AbstractOptimizer::getConstraintPolicy ( ) const
inlineoverridevirtualinherited

Get the constraint policy for this optimizer.

Returns
The constraint policy.

Implements bpp::OptimizerInterface.

Definition at line 233 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::constraintPolicy_.

Referenced by bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), and bpp::MetaOptimizer::doInit().

◆ getDefaultStopCondition() [1/2]

◆ getDefaultStopCondition() [2/2]

std::shared_ptr<const OptimizationStopCondition> bpp::AbstractOptimizer::getDefaultStopCondition ( ) const
inlineoverridevirtualinherited

Get the default stop condition of the optimization algorithm.

Returns
The default stop condition used while optimizing.

Implements bpp::OptimizerInterface.

Definition at line 219 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::defaultStopCondition_.

◆ getFirstOrderDerivableFunction() [1/2]

std::shared_ptr<const FirstOrderDerivable> bpp::NewtonBacktrackOneDimension::getFirstOrderDerivableFunction ( ) const
inline

Definition at line 98 of file NewtonBacktrackOneDimension.h.

References bpp::AbstractOptimizer::function_.

◆ getFirstOrderDerivableFunction() [2/2]

std::shared_ptr<FirstOrderDerivable> bpp::NewtonBacktrackOneDimension::getFirstOrderDerivableFunction ( )
inline

Definition at line 103 of file NewtonBacktrackOneDimension.h.

References bpp::AbstractOptimizer::function_.

◆ getFunction() [1/2]

◆ getFunction() [2/2]

std::shared_ptr<FunctionInterface> bpp::AbstractOptimizer::getFunction ( )
inlineoverridevirtualinherited

Get the current function being optimized.

Returns
A const pointer toward the function being optimized.

Implements bpp::OptimizerInterface.

Definition at line 188 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::function_.

◆ getFunction_()

std::shared_ptr<FunctionInterface> bpp::AbstractOptimizer::getFunction_ ( )
inlineprotectedinherited

Definition at line 389 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::function_.

◆ getFunctionValue()

double bpp::AbstractOptimizer::getFunctionValue ( ) const
inlineoverridevirtualinherited

Get the current function value.

Returns
The value of the function at the point specified by the current parameters.
Exceptions
NullPointerExceptionIf no function is associated with this optimizer.

Implements bpp::OptimizerInterface.

Reimplemented in bpp::GoldenSectionSearch.

Definition at line 192 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::currentValue_.

◆ getMessageHandler()

std::shared_ptr<OutputStream> bpp::AbstractOptimizer::getMessageHandler ( ) const
inlineoverridevirtualinherited

◆ getNumberOfEvaluations()

unsigned int bpp::AbstractOptimizer::getNumberOfEvaluations ( ) const
inlineoverridevirtualinherited

Get the number of function evaluations performed since the call of the init function.

Returns
The number of function evaluations.

Implements bpp::OptimizerInterface.

Definition at line 206 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::nbEval_.

Referenced by bpp::SimpleNewtonMultiDimensions::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::OneDimensionOptimizationTools::lineMinimization(), and bpp::OneDimensionOptimizationTools::lineSearch().

◆ getOptimizationProgressCharacter()

◆ getParameter_()

Parameter& bpp::AbstractOptimizer::getParameter_ ( size_t  i)
inlineprotectedinherited

◆ getParameters()

◆ getParameters_()

◆ getParameterValue()

double bpp::AbstractOptimizer::getParameterValue ( const std::string &  name) const
inlineoverridevirtualinherited
Returns
The value associated with a given parameter name.

Implements bpp::OptimizerInterface.

Definition at line 151 of file AbstractOptimizer.h.

References bpp::ParameterList::getParameterValue().

◆ getProfiler()

std::shared_ptr<OutputStream> bpp::AbstractOptimizer::getProfiler ( ) const
inlineoverridevirtualinherited
Returns
The stream used for profiling, if any.

Implements bpp::OptimizerInterface.

Definition at line 204 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::profiler_.

Referenced by bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), and bpp::MetaOptimizer::doInit().

◆ getStopCondition() [1/2]

◆ getStopCondition() [2/2]

std::shared_ptr<const OptimizationStopCondition> bpp::AbstractOptimizer::getStopCondition ( ) const
inlineoverridevirtualinherited

Get the stop condition of the optimization algorithm.

Returns
The stop condition used while optimizing.

Implements bpp::OptimizerInterface.

Definition at line 215 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::stopCondition_.

◆ getVerbose()

◆ hasFunction()

bool bpp::AbstractOptimizer::hasFunction ( ) const
inlineoverridevirtualinherited

Tell if a funciton is associatied to this optimizer.

Returns
True if a function has been associated to this optimizer.

Implements bpp::OptimizerInterface.

Definition at line 190 of file AbstractOptimizer.h.

Referenced by bpp::GoldenSectionSearch::getFunctionValue().

◆ ignoreConstraints()

void AbstractOptimizer::ignoreConstraints ( )
protectedinherited

◆ init()

◆ isInitialized()

bool bpp::AbstractOptimizer::isInitialized ( ) const
inlineoverridevirtualinherited
Returns
'true' if this optimizer has been initialized.

Implements bpp::OptimizerInterface.

Definition at line 147 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::isInitialized_.

◆ isMaximumNumberOfEvaluationsReached()

bool bpp::AbstractOptimizer::isMaximumNumberOfEvaluationsReached ( ) const
inlineoverridevirtualinherited

Tell if the maximum number of function evaluations is reached.

Returns
Whether the maximum number of function evaluations is reached or not.

Implements bpp::OptimizerInterface.

Definition at line 223 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::nbEvalMax_.

◆ isToleranceReached()

bool bpp::AbstractOptimizer::isToleranceReached ( ) const
inlineoverridevirtualinherited

Tell if the tolerance level is reached.

Returns
Whether the tolerance is reached or not.
See also
OptimizationStopCondition

Implements bpp::OptimizerInterface.

Definition at line 221 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::tolIsReached_.

◆ listenerModifiesParameters()

bool AbstractOptimizer::listenerModifiesParameters ( ) const
protectedinherited

◆ optimize()

◆ printMessage()

void AbstractOptimizer::printMessage ( const std::string &  message)
protectedinherited

◆ printPoint()

void AbstractOptimizer::printPoint ( const ParameterList params,
double  value 
)
protectedinherited

◆ profile() [1/3]

void AbstractOptimizer::profile ( double  v)
protectedinherited

Print to the profile if there is one.

Parameters
vThe double value to print.

Definition at line 199 of file AbstractOptimizer.cpp.

References bpp::AbstractOptimizer::profiler_.

Referenced by bpp::AbstractOptimizer::getOptimizationProgressCharacter(), bpp::AbstractOptimizer::init(), and bpp::AbstractOptimizer::printPoint().

◆ profile() [2/3]

void AbstractOptimizer::profile ( unsigned int  v)
protectedinherited

Print to the profile if there is one.

Parameters
vThe unsigned int value to print.

Definition at line 215 of file AbstractOptimizer.cpp.

References bpp::AbstractOptimizer::profiler_.

◆ profile() [3/3]

void AbstractOptimizer::profile ( const std::string &  s)
protectedinherited

Print to the profile if there is one.

Parameters
sThe string to print to the profile.

Definition at line 230 of file AbstractOptimizer.cpp.

References bpp::AbstractOptimizer::profiler_.

◆ profileln() [1/3]

void AbstractOptimizer::profileln ( double  v)
protectedinherited

Print to the profile if there is one and end line.

Parameters
vThe double value to print.

Definition at line 207 of file AbstractOptimizer.cpp.

References bpp::AbstractOptimizer::profiler_.

Referenced by bpp::AbstractOptimizer::getOptimizationProgressCharacter(), bpp::AbstractOptimizer::init(), and bpp::AbstractOptimizer::printPoint().

◆ profileln() [2/3]

void AbstractOptimizer::profileln ( unsigned int  v)
protectedinherited

Print to the profile if there is one and end line.

Parameters
vThe unsigned int value to print.

Definition at line 222 of file AbstractOptimizer.cpp.

References bpp::AbstractOptimizer::profiler_.

◆ profileln() [3/3]

void AbstractOptimizer::profileln ( const std::string &  s)
protectedinherited

Print to the profile if there is one and end line.

Parameters
sThe string to print to the profile.

Definition at line 238 of file AbstractOptimizer.cpp.

References bpp::AbstractOptimizer::profiler_.

◆ setConstraintPolicy()

void bpp::AbstractOptimizer::setConstraintPolicy ( const std::string &  constraintPolicy)
inlineoverridevirtualinherited

Set the constraint policy for this optimizer.

Parameters
constraintPolicyThe constraint policy.

Implements bpp::OptimizerInterface.

Definition at line 231 of file AbstractOptimizer.h.

Referenced by bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::OneDimensionOptimizationTools::lineMinimization(), and bpp::OneDimensionOptimizationTools::lineSearch().

◆ setDefaultStopCondition_()

◆ setFunction()

void bpp::AbstractOptimizer::setFunction ( std::shared_ptr< FunctionInterface function)
inlineoverridevirtualinherited

Set the function to optimize.

Parameters
functionThe function to optimize.

Implements bpp::OptimizerInterface.

Reimplemented in bpp::MetaOptimizer, bpp::SimpleMultiDimensions, and bpp::SimpleNewtonMultiDimensions.

Definition at line 156 of file AbstractOptimizer.h.

Referenced by bpp::SimpleNewtonMultiDimensions::setFunction(), bpp::SimpleMultiDimensions::setFunction(), and bpp::MetaOptimizer::setFunction().

◆ setMaximumNumberOfEvaluations()

void bpp::AbstractOptimizer::setMaximumNumberOfEvaluations ( unsigned int  max)
inlineoverridevirtualinherited

Set the maximum number of function evaluation to perform during optimization.

Parameters
maxThe maximum number of evaluations to perform.

Implements bpp::OptimizerInterface.

Definition at line 225 of file AbstractOptimizer.h.

Referenced by bpp::BrentOneDimension::BrentOneDimension(), bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), and NewtonBacktrackOneDimension().

◆ setMessageHandler()

void bpp::AbstractOptimizer::setMessageHandler ( std::shared_ptr< OutputStream mh)
inlineoverridevirtualinherited

Set the message handler for this optimizer.

The message handler keeps all messages that the optimizer may send. The default handler is set to standard output, but you can pass any ostream object (cerr, ofstream, etc.).

A null pointer disables message output.

Parameters
mhThe message handler to use.

Implements bpp::OptimizerInterface.

Definition at line 198 of file AbstractOptimizer.h.

Referenced by bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::OneDimensionOptimizationTools::lineMinimization(), and bpp::OneDimensionOptimizationTools::lineSearch().

◆ setOptimizationProgressCharacter()

void bpp::AbstractOptimizer::setOptimizationProgressCharacter ( const std::string &  c)
inlineinherited

◆ setProfiler()

void bpp::AbstractOptimizer::setProfiler ( std::shared_ptr< OutputStream profiler)
inlineoverridevirtualinherited

Set the profiler for this optimizer.

The profiler keeps all the intermediate values taken by the parameters. The default profiler is set to standard output, but you can pass any ostream object (cerr, ofstream, etc.).

A NULL pointer disables message output.

Parameters
profilerThe profiler to use.

Implements bpp::OptimizerInterface.

Definition at line 202 of file AbstractOptimizer.h.

Referenced by bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::OneDimensionOptimizationTools::lineMinimization(), and bpp::OneDimensionOptimizationTools::lineSearch().

◆ setStopCondition()

◆ setVerbose()

void bpp::AbstractOptimizer::setVerbose ( unsigned int  v)
inlineoverridevirtualinherited

Set the verbose level.

0 = off 1 = on 2 = more verbose 3 = even more, etc.

In most cases, only the 0 and 1 levels are implemented.

Parameters
vverbose level.

Implements bpp::OptimizerInterface.

Definition at line 227 of file AbstractOptimizer.h.

Referenced by bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::OneDimensionOptimizationTools::lineMinimization(), and bpp::OneDimensionOptimizationTools::lineSearch().

◆ step()

double AbstractOptimizer::step ( )
overridevirtualinherited

◆ updateParameters() [1/2]

void bpp::AbstractOptimizer::updateParameters ( bool  yn)
inlineoverridevirtualinherited

Tell if we shall update all parameters after one optimization step.

This is required only for functions that have non-independent parameters, which means that setting one parameter value may modify one or several other parameters. Depending on the optimizer, this may have no effect.

Parameters
yntrue/false

Implements bpp::OptimizerInterface.

Definition at line 251 of file AbstractOptimizer.h.

◆ updateParameters() [2/2]

bool bpp::AbstractOptimizer::updateParameters ( ) const
inlineoverridevirtualinherited

Tell if we shall update all parameters after one optimization step.

This is required only for functions that have non-independent parameters, which means that setting one parameter value may modify one or several other parameters. Depending on the optimizer, this may have no effect.

Returns
yn true/false

Implements bpp::OptimizerInterface.

Definition at line 262 of file AbstractOptimizer.h.

References bpp::AbstractOptimizer::updateParameters_.

Referenced by bpp::MetaOptimizer::doInit().

Friends And Related Function Documentation

◆ NBODStopCondition

friend class NBODStopCondition
friend

Definition at line 52 of file NewtonBacktrackOneDimension.h.

Member Data Documentation

◆ a_

double bpp::NewtonBacktrackOneDimension::a_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ alam2_

double bpp::NewtonBacktrackOneDimension::alam2_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ alam_

double bpp::NewtonBacktrackOneDimension::alam_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doInit(), and doStep().

◆ alamin_

double bpp::NewtonBacktrackOneDimension::alamin_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doInit(), and doStep().

◆ b_

double bpp::NewtonBacktrackOneDimension::b_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ constraintPolicy_

std::string bpp::AbstractOptimizer::constraintPolicy_
protectedinherited

The constraint policy.

Must be one the following:

  • CONSTRAINTS_KEEP: keep the constraint associated to the parameters (default).
  • CONSTRAINTS_IGNORE: remove all constraints.
  • CONSTRAINTS_AUTO: use AutoParameters to deal with constraints.
See also
AutoParameter

Definition at line 56 of file AbstractOptimizer.h.

Referenced by bpp::AbstractOptimizer::AbstractOptimizer(), bpp::AbstractOptimizer::getConstraintPolicy(), bpp::AbstractOptimizer::init(), and bpp::AbstractOptimizer::operator=().

◆ currentValue_

◆ defaultStopCondition_

std::shared_ptr<OptimizationStopCondition> bpp::AbstractOptimizer::defaultStopCondition_
protectedinherited

The default stoping condition to use while optimizing.

Definition at line 66 of file AbstractOptimizer.h.

Referenced by bpp::AbstractOptimizer::AbstractOptimizer(), bpp::AbstractOptimizer::getDefaultStopCondition(), and bpp::AbstractOptimizer::operator=().

◆ disc_

double bpp::NewtonBacktrackOneDimension::disc_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ f2_

double bpp::NewtonBacktrackOneDimension::f2_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ f_

double bpp::NewtonBacktrackOneDimension::f_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ fold_

double bpp::NewtonBacktrackOneDimension::fold_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doInit(), and doStep().

◆ function_

◆ isInitialized_

bool bpp::AbstractOptimizer::isInitialized_
protectedinherited

◆ listeners_

◆ messageHandler_

std::shared_ptr<OutputStream> bpp::AbstractOptimizer::messageHandler_
protectedinherited

◆ nbEval_

◆ nbEvalMax_

◆ parameters_

◆ profiler_

std::shared_ptr<OutputStream> bpp::AbstractOptimizer::profiler_
protectedinherited

◆ rhs1_

double bpp::NewtonBacktrackOneDimension::rhs1_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ rhs2_

double bpp::NewtonBacktrackOneDimension::rhs2_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ slope_

double bpp::NewtonBacktrackOneDimension::slope_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ startTime_

time_t bpp::AbstractOptimizer::startTime_
protectedinherited

◆ stepChar_

std::string bpp::AbstractOptimizer::stepChar_
protectedinherited

◆ stopCondition_

std::shared_ptr<OptimizationStopCondition> bpp::AbstractOptimizer::stopCondition_
protectedinherited

◆ test_

double bpp::NewtonBacktrackOneDimension::test_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doInit().

◆ tmplam_

double bpp::NewtonBacktrackOneDimension::tmplam_
private

Definition at line 67 of file NewtonBacktrackOneDimension.h.

Referenced by doStep().

◆ tolIsReached_

◆ updateParameters_

bool bpp::AbstractOptimizer::updateParameters_
protectedinherited

◆ verbose_

unsigned int bpp::AbstractOptimizer::verbose_
protectedinherited

State of the verbose mode: > 0 = enabled.

This may not be used by the Optimizer.

Definition at line 73 of file AbstractOptimizer.h.

Referenced by bpp::AbstractOptimizer::getVerbose(), bpp::AbstractOptimizer::operator=(), and bpp::AbstractOptimizer::optimize().


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