bpp-core3  3.0.0
bpp::MetaOptimizer Class Reference

Meta-optimizer. More...

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

+ Inheritance diagram for bpp::MetaOptimizer:
+ Collaboration diagram for bpp::MetaOptimizer:

Public Member Functions

 MetaOptimizer (std::shared_ptr< FunctionInterface > function, std::unique_ptr< MetaOptimizerInfos > desc, unsigned int n=1)
 Build a new MetaOptimizer object. More...
 
virtual ~MetaOptimizer ()
 
 MetaOptimizer (const MetaOptimizer &opt)
 
MetaOptimizeroperator= (const MetaOptimizer &opt)
 
MetaOptimizerclone () const override
 Create a copy of this object and send a pointer to it. More...
 
void setFunction (std::shared_ptr< FunctionInterface > function) override
 Set the function to optimize. More...
 
void doInit (const ParameterList &parameters) override
 This function is called by the init() method and contains all calculations. More...
 
double doStep () override
 This function is called by the step() method and contains all calculations. More...
 
MetaOptimizerInfosoptimizers ()
 
const MetaOptimizerInfos optimizers () const
 
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
 
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

std::unique_ptr< MetaOptimizerInfosoptDesc_
 
std::vector< ParameterListoptParameters_
 
std::vector< size_t > nbParameters_
 
unsigned int n_
 
double precisionStep_
 
unsigned int stepCount_
 
double initialValue_
 

Detailed Description

Meta-optimizer.

This optimizer uses a set of optimizers to applyied sequentially on distinct parameters. The set of optimizers is fully specified by a MetaOptimizerInfos object.

To decrease the optimization time, the precision of the optimizers can be increased progressively: if $\varepsilon$ is the final precision required, one may consider using a precision increment of $\sigma=\log_10(\varepsilon/n)$, where $n$ is the number of progressive steps. During the first step optimization step, the precisions of type 1 and 2 optimizers are set to $10^{\sigma}$, $10^{2\sigma}$ for step 2, ... until precision $10^{n\sigma}=\varepsilon$ at step $n$ and later. This saves some time spending in the first steps of the estimation. The number of steps $n$ is set in the constructor of the optimizer.

This optimizer can be used with numerical derivatives.

See also
MetaOptimizerInfos.

Definition at line 160 of file MetaOptimizer.h.

Constructor & Destructor Documentation

◆ MetaOptimizer() [1/2]

MetaOptimizer::MetaOptimizer ( std::shared_ptr< FunctionInterface function,
std::unique_ptr< MetaOptimizerInfos desc,
unsigned int  n = 1 
)

Build a new MetaOptimizer object.

Parameters
functionThe function to be optimized.
descA MetaOptimizerInfos object describing the optimizers to use. The optimizer will own the instance of the MetaOptimizerInfos object.
nThe number of progressive steps to use in optimization).

Definition at line 20 of file MetaOptimizer.cpp.

References bpp::AbstractOptimizer::getDefaultStopCondition(), bpp::AbstractOptimizer::getStopCondition(), n_, precisionStep_, bpp::AbstractOptimizer::setDefaultStopCondition_(), bpp::AbstractOptimizer::setOptimizationProgressCharacter(), and bpp::AbstractOptimizer::setStopCondition().

◆ ~MetaOptimizer()

MetaOptimizer::~MetaOptimizer ( )
virtual

Definition at line 67 of file MetaOptimizer.cpp.

◆ MetaOptimizer() [2/2]

MetaOptimizer::MetaOptimizer ( const MetaOptimizer opt)

Definition at line 37 of file MetaOptimizer.cpp.

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()

MetaOptimizer* bpp::MetaOptimizer::clone ( ) const
inlineoverridevirtual

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 189 of file MetaOptimizer.h.

◆ doInit()

◆ doStep()

◆ 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().

◆ 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 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_.

◆ 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 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

◆ operator=()

MetaOptimizer & MetaOptimizer::operator= ( const MetaOptimizer opt)

◆ optimize()

◆ optimizers() [1/2]

MetaOptimizerInfos& bpp::MetaOptimizer::optimizers ( )
inline
Returns
The MetaOptimizerInfos object associated to this optimizer.

Definition at line 208 of file MetaOptimizer.h.

◆ optimizers() [2/2]

const MetaOptimizerInfos bpp::MetaOptimizer::optimizers ( ) const
inline
Returns
The MetaOptimizerInfos object associated to this optimizer.

Definition at line 213 of file MetaOptimizer.h.

◆ 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::MetaOptimizer::setFunction ( std::shared_ptr< FunctionInterface function)
inlineoverridevirtual

Set the function to optimize.

Parameters
functionThe function to optimize.

Reimplemented from bpp::AbstractOptimizer.

Definition at line 192 of file MetaOptimizer.h.

References bpp::AbstractOptimizer::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 bpp::NewtonBacktrackOneDimension::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 doInit().

Member Data Documentation

◆ 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=().

◆ function_

◆ initialValue_

double bpp::MetaOptimizer::initialValue_
private

Definition at line 170 of file MetaOptimizer.h.

Referenced by doInit(), doStep(), and operator=().

◆ isInitialized_

bool bpp::AbstractOptimizer::isInitialized_
protectedinherited

◆ listeners_

◆ messageHandler_

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

◆ n_

unsigned int bpp::MetaOptimizer::n_
private

Definition at line 167 of file MetaOptimizer.h.

Referenced by doInit(), doStep(), MetaOptimizer(), and operator=().

◆ nbEval_

◆ nbEvalMax_

◆ nbParameters_

std::vector<size_t> bpp::MetaOptimizer::nbParameters_
private

Definition at line 166 of file MetaOptimizer.h.

Referenced by doInit(), doStep(), and operator=().

◆ optDesc_

std::unique_ptr<MetaOptimizerInfos> bpp::MetaOptimizer::optDesc_
private

Definition at line 164 of file MetaOptimizer.h.

Referenced by doInit(), doStep(), and operator=().

◆ optParameters_

std::vector<ParameterList> bpp::MetaOptimizer::optParameters_
private

Definition at line 165 of file MetaOptimizer.h.

Referenced by doInit(), doStep(), and operator=().

◆ parameters_

◆ precisionStep_

double bpp::MetaOptimizer::precisionStep_
private

Definition at line 168 of file MetaOptimizer.h.

Referenced by doInit(), doStep(), MetaOptimizer(), and operator=().

◆ profiler_

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

◆ startTime_

time_t bpp::AbstractOptimizer::startTime_
protectedinherited

◆ stepChar_

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

◆ stepCount_

unsigned int bpp::MetaOptimizer::stepCount_
private

Definition at line 169 of file MetaOptimizer.h.

Referenced by doInit(), doStep(), and operator=().

◆ stopCondition_

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

◆ 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: