bpp-core3  3.0.0
bpp::AbstractOptimizer Class Referenceabstract

Partial implementation of the Optimizer interface. More...

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

+ Inheritance diagram for bpp::AbstractOptimizer:
+ Collaboration diagram for bpp::AbstractOptimizer:

Public Member Functions

 AbstractOptimizer (std::shared_ptr< FunctionInterface > function=nullptr)
 
 AbstractOptimizer (const AbstractOptimizer &opt)
 
AbstractOptimizeroperator= (const AbstractOptimizer &opt)
 
virtual ~AbstractOptimizer ()
 
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
 
OptimizerInterfaceclone () const =0
 Create a copy of this object and send a pointer to it. More...
 
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

virtual void doInit (const ParameterList &params)=0
 This function is called by the init() method and contains all calculations. More...
 
virtual double doStep ()=0
 This function is called by the step() method and contains all calculations. More...
 
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...
 

Detailed Description

Partial implementation of the Optimizer interface.

This implementation is designed for unconstrained or simple-bounded optimization. You should not use it with global contraints. It also enables the gestion of listeners by maintaining a vector of pointers toward the listener. Important note: this list of listener is not duplicated in cas of copy of the Optimizer, as listeners are expected to be bounded ot a particular instance.:if expand("%") == ""|browse confirm w|else|confirm w|endif

Definition at line 22 of file AbstractOptimizer.h.

Constructor & Destructor Documentation

◆ AbstractOptimizer() [1/2]

AbstractOptimizer::AbstractOptimizer ( std::shared_ptr< FunctionInterface function = nullptr)

Definition at line 19 of file AbstractOptimizer.cpp.

◆ AbstractOptimizer() [2/2]

◆ ~AbstractOptimizer()

virtual bpp::AbstractOptimizer::~AbstractOptimizer ( )
inlinevirtual

Definition at line 119 of file AbstractOptimizer.h.

References init(), optimize(), and step().

Member Function Documentation

◆ addOptimizationListener()

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

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

void AbstractOptimizer::autoParameter ( )
protected

◆ clone()

OptimizerInterface* bpp::OptimizerInterface::clone ( ) const
pure virtualinherited

◆ doInit()

virtual void bpp::AbstractOptimizer::doInit ( const ParameterList params)
protectedpure virtual

◆ doStep()

virtual double bpp::AbstractOptimizer::doStep ( )
protectedpure virtual

◆ fireOptimizationInitializationPerformed()

void AbstractOptimizer::fireOptimizationInitializationPerformed ( const OptimizationEvent event)
protected

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 listeners_.

Referenced by getOptimizationProgressCharacter(), and init().

◆ fireOptimizationStepPerformed()

void AbstractOptimizer::fireOptimizationStepPerformed ( const OptimizationEvent event)
protected

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 listeners_.

Referenced by getOptimizationProgressCharacter(), and step().

◆ function() [1/2]

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

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 function_.

◆ function() [2/2]

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

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 function_.

◆ getConstraintPolicy()

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

Get the constraint policy for this optimizer.

Returns
The constraint policy.

Implements bpp::OptimizerInterface.

Definition at line 233 of file AbstractOptimizer.h.

References 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
inlineoverridevirtual

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 defaultStopCondition_.

◆ getFunction() [1/2]

◆ getFunction() [2/2]

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

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 function_.

◆ getFunction_()

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

Definition at line 389 of file AbstractOptimizer.h.

References function_.

◆ getFunctionValue()

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

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 currentValue_.

◆ getMessageHandler()

std::shared_ptr<OutputStream> bpp::AbstractOptimizer::getMessageHandler ( ) const
inlineoverridevirtual
Returns
The stream used for handling messages, if any.

Implements bpp::OptimizerInterface.

Definition at line 200 of file AbstractOptimizer.h.

References messageHandler_.

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

◆ getNumberOfEvaluations()

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

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 nbEval_.

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

◆ getOptimizationProgressCharacter()

const std::string& bpp::AbstractOptimizer::getOptimizationProgressCharacter ( ) const
inline

◆ getParameter_()

◆ getParameters()

◆ getParameters_()

◆ getParameterValue()

double bpp::AbstractOptimizer::getParameterValue ( const std::string &  name) const
inlineoverridevirtual
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
inlineoverridevirtual
Returns
The stream used for profiling, if any.

Implements bpp::OptimizerInterface.

Definition at line 204 of file AbstractOptimizer.h.

References 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
inlineoverridevirtual

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 stopCondition_.

◆ getVerbose()

◆ hasFunction()

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

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

Remove the constraints of all the arguments.

Definition at line 285 of file AbstractOptimizer.cpp.

References parameters_, and bpp::ParameterList::size().

Referenced by AbstractOptimizer(), getOptimizationProgressCharacter(), init(), and operator=().

◆ init()

◆ isInitialized()

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

Implements bpp::OptimizerInterface.

Definition at line 147 of file AbstractOptimizer.h.

References isInitialized_.

◆ isMaximumNumberOfEvaluationsReached()

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

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 nbEvalMax_.

◆ isToleranceReached()

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

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 tolIsReached_.

◆ listenerModifiesParameters()

bool AbstractOptimizer::listenerModifiesParameters ( ) const
protected

Definition at line 315 of file AbstractOptimizer.cpp.

References listeners_.

Referenced by getOptimizationProgressCharacter(), and step().

◆ operator=()

◆ optimize()

◆ printMessage()

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

Give a message to print to the message handler.

Parameters
messageThe message to print.

Definition at line 265 of file AbstractOptimizer.cpp.

References messageHandler_.

Referenced by bpp::GoldenSectionSearch::doInit(), bpp::BrentOneDimension::doInit(), bpp::NewtonOneDimension::doStep(), bpp::BfgsMultiDimensions::doStep(), and getOptimizationProgressCharacter().

◆ printPoint()

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

Print parameters and corresponding function evaluation to profiler.

Parameters
paramsThe parameters to print.
valueThe function evaluation.

Definition at line 246 of file AbstractOptimizer.cpp.

References nbEval_, profile(), profileln(), bpp::ParameterList::size(), startTime_, and bpp::TextTools::toString().

Referenced by bpp::PowellMultiDimensions::doStep(), getOptimizationProgressCharacter(), init(), and step().

◆ profile() [1/3]

void AbstractOptimizer::profile ( double  v)
protected

Print to the profile if there is one.

Parameters
vThe double value to print.

Definition at line 199 of file AbstractOptimizer.cpp.

References profiler_.

Referenced by getOptimizationProgressCharacter(), init(), and printPoint().

◆ profile() [2/3]

void AbstractOptimizer::profile ( unsigned int  v)
protected

Print to the profile if there is one.

Parameters
vThe unsigned int value to print.

Definition at line 215 of file AbstractOptimizer.cpp.

References profiler_.

◆ profile() [3/3]

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

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 profiler_.

◆ profileln() [1/3]

void AbstractOptimizer::profileln ( double  v)
protected

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 profiler_.

Referenced by getOptimizationProgressCharacter(), init(), and printPoint().

◆ profileln() [2/3]

void AbstractOptimizer::profileln ( unsigned int  v)
protected

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 profiler_.

◆ profileln() [3/3]

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

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 profiler_.

◆ setConstraintPolicy()

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

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

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

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

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

◆ setProfiler()

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

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

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

Basic implementation.

Check if the optimizer is initialized, check if parameters need update because of listeners, call the doStep method, print the current point to the profiler, notify all listeners and return the current value of the function.

Implements bpp::OptimizerInterface.

Definition at line 163 of file AbstractOptimizer.cpp.

References currentValue_, doStep(), fireOptimizationStepPerformed(), function_, listenerModifiesParameters(), bpp::ParameterList::matchParametersValues(), parameters_, printPoint(), stopCondition_, tolIsReached_, and updateParameters_.

Referenced by optimize(), and ~AbstractOptimizer().

◆ updateParameters() [1/2]

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

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
inlineoverridevirtual

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 updateParameters_.

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

Member Data Documentation

◆ constraintPolicy_

std::string bpp::AbstractOptimizer::constraintPolicy_
protected

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 AbstractOptimizer(), getConstraintPolicy(), init(), and operator=().

◆ currentValue_

◆ defaultStopCondition_

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

The default stoping condition to use while optimizing.

Definition at line 66 of file AbstractOptimizer.h.

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

◆ function_

◆ isInitialized_

bool bpp::AbstractOptimizer::isInitialized_
protected

Check if the optimizer have been feeded with initial parameters values.

Definition at line 78 of file AbstractOptimizer.h.

Referenced by AbstractOptimizer(), init(), isInitialized(), operator=(), and optimize().

◆ listeners_

std::vector< std::shared_ptr<OptimizationListener> > bpp::AbstractOptimizer::listeners_
protected

◆ messageHandler_

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

The message handler.

Definition at line 39 of file AbstractOptimizer.h.

Referenced by autoParameter(), getMessageHandler(), operator=(), and printMessage().

◆ nbEval_

◆ nbEvalMax_

◆ parameters_

ParameterList bpp::AbstractOptimizer::parameters_
protected

The parameters that will be optimized.

Definition at line 34 of file AbstractOptimizer.h.

Referenced by autoParameter(), getParameters(), getParameters_(), ignoreConstraints(), init(), operator=(), and step().

◆ profiler_

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

The profiler.

Definition at line 44 of file AbstractOptimizer.h.

Referenced by getProfiler(), operator=(), profile(), and profileln().

◆ startTime_

time_t bpp::AbstractOptimizer::startTime_
protected

Definition at line 80 of file AbstractOptimizer.h.

Referenced by init(), operator=(), and printPoint().

◆ stepChar_

std::string bpp::AbstractOptimizer::stepChar_
protected

Definition at line 86 of file AbstractOptimizer.h.

Referenced by getOptimizationProgressCharacter(), and operator=().

◆ stopCondition_

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

The stoping condition to use while optimizing.

Definition at line 61 of file AbstractOptimizer.h.

Referenced by AbstractOptimizer(), getStopCondition(), init(), operator=(), and step().

◆ tolIsReached_

bool bpp::AbstractOptimizer::tolIsReached_
protected

◆ updateParameters_

bool bpp::AbstractOptimizer::updateParameters_
protected

Definition at line 84 of file AbstractOptimizer.h.

Referenced by operator=(), step(), and updateParameters().

◆ verbose_

unsigned int bpp::AbstractOptimizer::verbose_
protected

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 getVerbose(), operator=(), and optimize().


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