bpp-core3
3.0.0
|
Meta-optimizer. More...
#include <Bpp/Numeric/Function/MetaOptimizer.h>
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) | |
MetaOptimizer & | operator= (const MetaOptimizer &opt) |
MetaOptimizer * | clone () 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 ¶meters) 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... | |
MetaOptimizerInfos & | optimizers () |
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 ¶ms) override |
Basic implementation. More... | |
double | step () override |
Basic implementation. More... | |
double | optimize () override |
Basic implementation. More... | |
bool | isInitialized () const override |
const ParameterList & | getParameters () const override |
double | getParameterValue (const std::string &name) const override |
const FunctionInterface & | function () const override |
Get the current function being optimized. More... | |
FunctionInterface & | function () override |
Get the current function being optimized. More... | |
std::shared_ptr< const FunctionInterface > | getFunction () const override |
Get the current function being optimized. More... | |
std::shared_ptr< FunctionInterface > | getFunction () 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< OutputStream > | getMessageHandler () const override |
void | setProfiler (std::shared_ptr< OutputStream > profiler) override |
Set the profiler for this optimizer. More... | |
std::shared_ptr< OutputStream > | getProfiler () 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< OptimizationStopCondition > | getStopCondition () override |
Get the stop condition of the optimization algorithm. More... | |
std::shared_ptr< const OptimizationStopCondition > | getStopCondition () const override |
Get the stop condition of the optimization algorithm. More... | |
std::shared_ptr< OptimizationStopCondition > | getDefaultStopCondition () override |
Get the default stop condition of the optimization algorithm. More... | |
std::shared_ptr< const OptimizationStopCondition > | getDefaultStopCondition () 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 | |
ParameterList & | getParameters_ () |
Parameter & | getParameter_ (size_t i) |
std::shared_ptr< FunctionInterface > | getFunction_ () |
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 ¶ms, 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< FunctionInterface > | function_ |
The function to optimize. More... | |
ParameterList | parameters_ |
The parameters that will be optimized. More... | |
std::shared_ptr< OutputStream > | messageHandler_ |
The message handler. More... | |
std::shared_ptr< OutputStream > | profiler_ |
The profiler. More... | |
std::string | constraintPolicy_ |
The constraint policy. More... | |
std::shared_ptr< OptimizationStopCondition > | stopCondition_ |
The stoping condition to use while optimizing. More... | |
std::shared_ptr< OptimizationStopCondition > | defaultStopCondition_ |
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< MetaOptimizerInfos > | optDesc_ |
std::vector< ParameterList > | optParameters_ |
std::vector< size_t > | nbParameters_ |
unsigned int | n_ |
double | precisionStep_ |
unsigned int | stepCount_ |
double | initialValue_ |
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 is the final precision required, one may consider using a precision increment of , where is the number of progressive steps. During the first step optimization step, the precisions of type 1 and 2 optimizers are set to , for step 2, ... until precision at step and later. This saves some time spending in the first steps of the estimation. The number of steps is set in the constructor of the optimizer.
This optimizer can be used with numerical derivatives.
Definition at line 160 of file MetaOptimizer.h.
MetaOptimizer::MetaOptimizer | ( | std::shared_ptr< FunctionInterface > | function, |
std::unique_ptr< MetaOptimizerInfos > | desc, | ||
unsigned int | n = 1 |
||
) |
Build a new MetaOptimizer object.
function | The function to be optimized. |
desc | A MetaOptimizerInfos object describing the optimizers to use. The optimizer will own the instance of the MetaOptimizerInfos object. |
n | The 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().
|
virtual |
Definition at line 67 of file MetaOptimizer.cpp.
MetaOptimizer::MetaOptimizer | ( | const MetaOptimizer & | opt | ) |
Definition at line 37 of file MetaOptimizer.cpp.
|
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.
listener | A listener to be registered with. |
Implements bpp::OptimizerInterface.
Definition at line 235 of file AbstractOptimizer.h.
|
protectedinherited |
Build a list of AutoParameter instead of Parameter.
Definition at line 273 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::messageHandler_, bpp::AbstractOptimizer::parameters_, bpp::AutoParameter::setMessageHandler(), bpp::ParameterList::setParameter(), and bpp::ParameterList::size().
Referenced by bpp::AbstractOptimizer::AbstractOptimizer(), bpp::AbstractOptimizer::getOptimizationProgressCharacter(), bpp::AbstractOptimizer::init(), and bpp::AbstractOptimizer::operator=().
|
inlineoverridevirtual |
Create a copy of this object and send a pointer to it.
Implements bpp::OptimizerInterface.
Definition at line 189 of file MetaOptimizer.h.
|
overridevirtual |
This function is called by the init() method and contains all calculations.
params | The parameters to use for initialization. |
Implements bpp::AbstractOptimizer.
Definition at line 71 of file MetaOptimizer.cpp.
References bpp::AbstractOptimizer::getConstraintPolicy(), bpp::AbstractOptimizer::getFunction(), bpp::AbstractOptimizer::getMessageHandler(), bpp::AbstractOptimizer::getParameters(), bpp::AbstractOptimizer::getParameters_(), bpp::AbstractOptimizer::getProfiler(), bpp::AbstractOptimizer::getStopCondition(), bpp::AbstractOptimizer::getVerbose(), bpp::ParameterList::hasParameter(), initialValue_, bpp::ParameterList::matchParametersValues(), n_, nbParameters_, optDesc_, optParameters_, bpp::ParameterList::parameter(), precisionStep_, bpp::OptimizerInterface::setConstraintPolicy(), bpp::OptimizerInterface::setMessageHandler(), bpp::OptimizerInterface::setProfiler(), bpp::OptimizerInterface::setVerbose(), stepCount_, bpp::AbstractOptimizer::updateParameters(), and bpp::OptimizerInterface::updateParameters().
|
overridevirtual |
This function is called by the step() method and contains all calculations.
Implements bpp::AbstractOptimizer.
Definition at line 115 of file MetaOptimizer.cpp.
References bpp::AbstractOptimizer::getFunction(), bpp::OptimizerInterface::getNumberOfEvaluations(), bpp::OptimizerInterface::getParameters(), bpp::AbstractOptimizer::getParameters(), bpp::AbstractOptimizer::getParameters_(), bpp::AbstractOptimizer::getStopCondition(), bpp::OptimizerInterface::getStopCondition(), bpp::AbstractOptimizer::getVerbose(), bpp::OptimizerInterface::init(), initialValue_, bpp::MetaOptimizerInfos::IT_TYPE_FULL, bpp::MetaOptimizerInfos::IT_TYPE_STEP, bpp::ParameterList::matchParametersValues(), bpp::ApplicationTools::message, n_, bpp::AbstractOptimizer::nbEval_, nbParameters_, optDesc_, bpp::OptimizerInterface::optimize(), optParameters_, precisionStep_, bpp::OptimizerInterface::step(), stepCount_, and bpp::AbstractOptimizer::tolIsReached_.
|
protectedinherited |
Notify all listeners that optimizer initialization was performed.
This method should be called by the init method.
event | An OptimizationEvent object. |
Definition at line 295 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::listeners_.
Referenced by bpp::AbstractOptimizer::getOptimizationProgressCharacter(), and bpp::AbstractOptimizer::init().
|
protectedinherited |
Notify all listeners that an optimization step was performed.
This method should be called by the step method.
event | An OptimizationEvent object. |
Definition at line 305 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::listeners_.
Referenced by bpp::AbstractOptimizer::getOptimizationProgressCharacter(), and bpp::AbstractOptimizer::step().
|
inlineoverridevirtualinherited |
Get the current function being optimized.
NullPointerException | if no function is associated with the optimizer. |
Implements bpp::OptimizerInterface.
Definition at line 162 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::function_.
|
inlineoverridevirtualinherited |
Get the current function being optimized.
NullPointerException | if no function is associated with the optimizer. |
Implements bpp::OptimizerInterface.
Definition at line 174 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::function_.
|
inlineoverridevirtualinherited |
Get the constraint policy for this optimizer.
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().
|
inlineoverridevirtualinherited |
Get the default stop condition of the optimization algorithm.
Implements bpp::OptimizerInterface.
Definition at line 217 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::defaultStopCondition_.
Referenced by bpp::BfgsMultiDimensions::BfgsMultiDimensions(), bpp::BrentOneDimension::BrentOneDimension(), bpp::ConjugateGradientMultiDimensions::ConjugateGradientMultiDimensions(), bpp::DownhillSimplexMethod::DownhillSimplexMethod(), bpp::GoldenSectionSearch::GoldenSectionSearch(), MetaOptimizer(), bpp::NewtonBacktrackOneDimension::NewtonBacktrackOneDimension(), bpp::NewtonOneDimension::NewtonOneDimension(), bpp::PowellMultiDimensions::PowellMultiDimensions(), bpp::SimpleMultiDimensions::SimpleMultiDimensions(), and bpp::SimpleNewtonMultiDimensions::SimpleNewtonMultiDimensions().
|
inlineoverridevirtualinherited |
Get the default stop condition of the optimization algorithm.
Implements bpp::OptimizerInterface.
Definition at line 219 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::defaultStopCondition_.
|
inlineoverridevirtualinherited |
Get the current function being optimized.
Implements bpp::OptimizerInterface.
Definition at line 186 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::function_.
Referenced by bpp::NewtonOneDimension::doInit(), bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::PowellMultiDimensions::doInit(), bpp::NewtonBacktrackOneDimension::doInit(), bpp::GoldenSectionSearch::doInit(), bpp::BrentOneDimension::doInit(), bpp::DownhillSimplexMethod::doInit(), doInit(), bpp::NewtonOneDimension::doStep(), bpp::SimpleNewtonMultiDimensions::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::ConjugateGradientMultiDimensions::doStep(), bpp::BfgsMultiDimensions::doStep(), bpp::PowellMultiDimensions::doStep(), bpp::NewtonBacktrackOneDimension::doStep(), bpp::GoldenSectionSearch::doStep(), bpp::BrentOneDimension::doStep(), bpp::DownhillSimplexMethod::doStep(), doStep(), bpp::PowellMultiDimensions::optimize(), bpp::BrentOneDimension::optimize(), bpp::DownhillSimplexMethod::optimize(), and bpp::DownhillSimplexMethod::tryExtrapolation().
|
inlineoverridevirtualinherited |
Get the current function being optimized.
Implements bpp::OptimizerInterface.
Definition at line 188 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::function_.
|
inlineprotectedinherited |
Definition at line 389 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::function_.
|
inlineoverridevirtualinherited |
Get the current function value.
NullPointerException | If 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_.
|
inlineoverridevirtualinherited |
Implements bpp::OptimizerInterface.
Definition at line 200 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::messageHandler_.
Referenced by bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), doInit(), and bpp::PowellMultiDimensions::doStep().
|
inlineoverridevirtualinherited |
Get the number of function evaluations performed since the call of the init function.
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().
|
inlineinherited |
Definition at line 273 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::autoParameter(), bpp::AbstractOptimizer::doInit(), bpp::AbstractOptimizer::doStep(), bpp::AbstractOptimizer::fireOptimizationInitializationPerformed(), bpp::AbstractOptimizer::fireOptimizationStepPerformed(), bpp::AbstractOptimizer::ignoreConstraints(), bpp::AbstractOptimizer::listenerModifiesParameters(), bpp::AbstractOptimizer::printMessage(), bpp::AbstractOptimizer::printPoint(), bpp::AbstractOptimizer::profile(), bpp::AbstractOptimizer::profileln(), and bpp::AbstractOptimizer::stepChar_.
|
inlineprotectedinherited |
Definition at line 387 of file AbstractOptimizer.h.
Referenced by bpp::GoldenSectionSearch::doInit(), bpp::BrentOneDimension::doInit(), bpp::NewtonBacktrackOneDimension::doStep(), bpp::GoldenSectionSearch::doStep(), and bpp::BrentOneDimension::doStep().
|
inlineoverridevirtualinherited |
Implements bpp::OptimizerInterface.
Definition at line 149 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::parameters_.
Referenced by bpp::NewtonOneDimension::doInit(), bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::BfgsMultiDimensions::doInit(), bpp::NewtonBacktrackOneDimension::doInit(), bpp::PowellMultiDimensions::doInit(), bpp::GoldenSectionSearch::doInit(), bpp::BrentOneDimension::doInit(), bpp::DownhillSimplexMethod::doInit(), doInit(), bpp::NewtonOneDimension::doStep(), bpp::SimpleNewtonMultiDimensions::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::ConjugateGradientMultiDimensions::doStep(), bpp::BfgsMultiDimensions::doStep(), bpp::NewtonBacktrackOneDimension::doStep(), bpp::PowellMultiDimensions::doStep(), bpp::GoldenSectionSearch::doStep(), bpp::BrentOneDimension::doStep(), doStep(), bpp::ConjugateGradientMultiDimensions::getGradient(), bpp::BfgsMultiDimensions::getGradient(), bpp::DownhillSimplexMethod::getPSum(), bpp::PowellMultiDimensions::optimize(), bpp::BrentOneDimension::optimize(), bpp::BfgsMultiDimensions::setDirection(), and bpp::DownhillSimplexMethod::tryExtrapolation().
|
inlineprotectedinherited |
Definition at line 385 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::parameters_.
Referenced by doInit(), bpp::NewtonOneDimension::doStep(), bpp::SimpleNewtonMultiDimensions::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::ConjugateGradientMultiDimensions::doStep(), bpp::BfgsMultiDimensions::doStep(), bpp::PowellMultiDimensions::doStep(), bpp::DownhillSimplexMethod::doStep(), and doStep().
|
inlineoverridevirtualinherited |
Implements bpp::OptimizerInterface.
Definition at line 151 of file AbstractOptimizer.h.
References bpp::ParameterList::getParameterValue().
|
inlineoverridevirtualinherited |
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().
|
inlineoverridevirtualinherited |
Get the stop condition of the optimization algorithm.
Implements bpp::OptimizerInterface.
Definition at line 213 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::stopCondition_.
Referenced by bpp::NewtonOneDimension::doInit(), bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::NewtonBacktrackOneDimension::doInit(), doInit(), bpp::SimpleMultiDimensions::doStep(), bpp::ConjugateGradientMultiDimensions::doStep(), bpp::PowellMultiDimensions::doStep(), bpp::GoldenSectionSearch::doStep(), bpp::BrentOneDimension::doStep(), doStep(), bpp::OneDimensionOptimizationTools::lineMinimization(), bpp::OneDimensionOptimizationTools::lineSearch(), MetaOptimizer(), and bpp::SimpleMultiDimensions::setFunction().
|
inlineoverridevirtualinherited |
Get the stop condition of the optimization algorithm.
Implements bpp::OptimizerInterface.
Definition at line 215 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::stopCondition_.
|
inlineoverridevirtualinherited |
Get the verbose level.
Implements bpp::OptimizerInterface.
Definition at line 229 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::verbose_.
Referenced by bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::GoldenSectionSearch::doInit(), bpp::BrentOneDimension::doInit(), doInit(), bpp::SimpleNewtonMultiDimensions::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::ConjugateGradientMultiDimensions::doStep(), bpp::BfgsMultiDimensions::doStep(), bpp::PowellMultiDimensions::doStep(), and doStep().
|
inlineoverridevirtualinherited |
Tell if a funciton is associatied to this optimizer.
Implements bpp::OptimizerInterface.
Definition at line 190 of file AbstractOptimizer.h.
Referenced by bpp::GoldenSectionSearch::getFunctionValue().
|
protectedinherited |
Remove the constraints of all the arguments.
Definition at line 285 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::parameters_, and bpp::ParameterList::size().
Referenced by bpp::AbstractOptimizer::AbstractOptimizer(), bpp::AbstractOptimizer::getOptimizationProgressCharacter(), bpp::AbstractOptimizer::init(), and bpp::AbstractOptimizer::operator=().
|
overridevirtualinherited |
Basic implementation.
Store all parameters, call the doInit method, print to profiler, initialize timer and notify all listeners.
Implements bpp::OptimizerInterface.
Definition at line 125 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::autoParameter(), bpp::AbstractOptimizer::constraintPolicy_, bpp::AutoParameter::CONSTRAINTS_AUTO, bpp::AutoParameter::CONSTRAINTS_IGNORE, bpp::AbstractOptimizer::currentValue_, bpp::AbstractOptimizer::doInit(), bpp::AbstractOptimizer::fireOptimizationInitializationPerformed(), bpp::AbstractOptimizer::function_, bpp::AbstractOptimizer::ignoreConstraints(), bpp::AbstractOptimizer::isInitialized_, bpp::AbstractOptimizer::nbEval_, bpp::AbstractOptimizer::parameters_, bpp::AbstractOptimizer::printPoint(), bpp::AbstractOptimizer::profile(), bpp::AbstractOptimizer::profileln(), bpp::ParameterList::size(), bpp::AbstractOptimizer::startTime_, bpp::AbstractOptimizer::stopCondition_, and bpp::AbstractOptimizer::tolIsReached_.
Referenced by bpp::SimpleNewtonMultiDimensions::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::OneDimensionOptimizationTools::lineMinimization(), bpp::OneDimensionOptimizationTools::lineSearch(), and bpp::AbstractOptimizer::~AbstractOptimizer().
|
inlineoverridevirtualinherited |
Implements bpp::OptimizerInterface.
Definition at line 147 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::isInitialized_.
|
inlineoverridevirtualinherited |
Tell if the maximum number of function evaluations is reached.
Implements bpp::OptimizerInterface.
Definition at line 223 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::nbEvalMax_.
|
inlineoverridevirtualinherited |
Tell if the tolerance level is reached.
Implements bpp::OptimizerInterface.
Definition at line 221 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::tolIsReached_.
|
protectedinherited |
Definition at line 315 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::listeners_.
Referenced by bpp::AbstractOptimizer::getOptimizationProgressCharacter(), and bpp::AbstractOptimizer::step().
MetaOptimizer & MetaOptimizer::operator= | ( | const MetaOptimizer & | opt | ) |
Definition at line 51 of file MetaOptimizer.cpp.
References initialValue_, n_, nbParameters_, bpp::AbstractOptimizer::operator=(), optDesc_, optParameters_, precisionStep_, and stepCount_.
|
overridevirtualinherited |
Basic implementation.
Call the step method untill tolerance is reached.
Implements bpp::OptimizerInterface.
Reimplemented in bpp::DownhillSimplexMethod, bpp::BrentOneDimension, and bpp::PowellMultiDimensions.
Definition at line 183 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::currentValue_, bpp::ApplicationTools::displayUnlimitedGauge(), bpp::AbstractOptimizer::isInitialized_, bpp::AbstractOptimizer::nbEval_, bpp::AbstractOptimizer::nbEvalMax_, bpp::AbstractOptimizer::step(), bpp::AbstractOptimizer::tolIsReached_, and bpp::AbstractOptimizer::verbose_.
Referenced by bpp::SimpleNewtonMultiDimensions::doStep(), bpp::OneDimensionOptimizationTools::lineSearch(), bpp::PowellMultiDimensions::optimize(), bpp::BrentOneDimension::optimize(), bpp::DownhillSimplexMethod::optimize(), and bpp::AbstractOptimizer::~AbstractOptimizer().
|
inline |
Definition at line 208 of file MetaOptimizer.h.
|
inline |
Definition at line 213 of file MetaOptimizer.h.
|
protectedinherited |
Give a message to print to the message handler.
message | The message to print. |
Definition at line 265 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::messageHandler_.
Referenced by bpp::GoldenSectionSearch::doInit(), bpp::BrentOneDimension::doInit(), bpp::NewtonOneDimension::doStep(), bpp::BfgsMultiDimensions::doStep(), and bpp::AbstractOptimizer::getOptimizationProgressCharacter().
|
protectedinherited |
Print parameters and corresponding function evaluation to profiler.
params | The parameters to print. |
value | The function evaluation. |
Definition at line 246 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::nbEval_, bpp::AbstractOptimizer::profile(), bpp::AbstractOptimizer::profileln(), bpp::ParameterList::size(), bpp::AbstractOptimizer::startTime_, and bpp::TextTools::toString().
Referenced by bpp::PowellMultiDimensions::doStep(), bpp::AbstractOptimizer::getOptimizationProgressCharacter(), bpp::AbstractOptimizer::init(), and bpp::AbstractOptimizer::step().
|
protectedinherited |
Print to the profile if there is one.
v | The 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().
|
protectedinherited |
Print to the profile if there is one.
v | The unsigned int value to print. |
Definition at line 215 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::profiler_.
|
protectedinherited |
Print to the profile if there is one.
s | The string to print to the profile. |
Definition at line 230 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::profiler_.
|
protectedinherited |
Print to the profile if there is one and end line.
v | The 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().
|
protectedinherited |
Print to the profile if there is one and end line.
v | The unsigned int value to print. |
Definition at line 222 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::profiler_.
|
protectedinherited |
Print to the profile if there is one and end line.
s | The string to print to the profile. |
Definition at line 238 of file AbstractOptimizer.cpp.
References bpp::AbstractOptimizer::profiler_.
|
inlineoverridevirtualinherited |
Set the constraint policy for this optimizer.
constraintPolicy | The 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().
|
inlineprotectedinherited |
Definition at line 391 of file AbstractOptimizer.h.
Referenced by bpp::BfgsMultiDimensions::BfgsMultiDimensions(), bpp::BrentOneDimension::BrentOneDimension(), bpp::ConjugateGradientMultiDimensions::ConjugateGradientMultiDimensions(), bpp::DownhillSimplexMethod::DownhillSimplexMethod(), bpp::GoldenSectionSearch::GoldenSectionSearch(), MetaOptimizer(), bpp::NewtonBacktrackOneDimension::NewtonBacktrackOneDimension(), bpp::NewtonOneDimension::NewtonOneDimension(), bpp::PowellMultiDimensions::PowellMultiDimensions(), bpp::SimpleMultiDimensions::SimpleMultiDimensions(), and bpp::SimpleNewtonMultiDimensions::SimpleNewtonMultiDimensions().
|
inlineoverridevirtual |
Set the function to optimize.
function | The function to optimize. |
Reimplemented from bpp::AbstractOptimizer.
Definition at line 192 of file MetaOptimizer.h.
References bpp::AbstractOptimizer::setFunction().
|
inlineoverridevirtualinherited |
Set the maximum number of function evaluation to perform during optimization.
max | The 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().
|
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.
mh | The 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().
|
inlineinherited |
Set the character to be displayed during optimization.
c | A character. |
Definition at line 269 of file AbstractOptimizer.h.
Referenced by bpp::BfgsMultiDimensions::BfgsMultiDimensions(), bpp::OneDimensionOptimizationTools::lineMinimization(), bpp::OneDimensionOptimizationTools::lineSearch(), MetaOptimizer(), bpp::SimpleMultiDimensions::SimpleMultiDimensions(), and bpp::SimpleNewtonMultiDimensions::SimpleNewtonMultiDimensions().
|
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.
profiler | The 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().
|
inlineoverridevirtualinherited |
Set the stop condition of the optimization algorithm.
stopCondition | The stop condition to use while optimizing. |
Implements bpp::OptimizerInterface.
Definition at line 208 of file AbstractOptimizer.h.
Referenced by bpp::BfgsMultiDimensions::BfgsMultiDimensions(), bpp::BrentOneDimension::BrentOneDimension(), bpp::ConjugateGradientMultiDimensions::ConjugateGradientMultiDimensions(), bpp::DownhillSimplexMethod::DownhillSimplexMethod(), bpp::GoldenSectionSearch::GoldenSectionSearch(), MetaOptimizer(), bpp::NewtonBacktrackOneDimension::NewtonBacktrackOneDimension(), bpp::NewtonOneDimension::NewtonOneDimension(), bpp::PowellMultiDimensions::PowellMultiDimensions(), bpp::SimpleMultiDimensions::SimpleMultiDimensions(), and bpp::SimpleNewtonMultiDimensions::SimpleNewtonMultiDimensions().
|
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.
v | verbose 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().
|
overridevirtualinherited |
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 bpp::AbstractOptimizer::currentValue_, bpp::AbstractOptimizer::doStep(), bpp::AbstractOptimizer::fireOptimizationStepPerformed(), bpp::AbstractOptimizer::function_, bpp::AbstractOptimizer::listenerModifiesParameters(), bpp::ParameterList::matchParametersValues(), bpp::AbstractOptimizer::parameters_, bpp::AbstractOptimizer::printPoint(), bpp::AbstractOptimizer::stopCondition_, bpp::AbstractOptimizer::tolIsReached_, and bpp::AbstractOptimizer::updateParameters_.
Referenced by bpp::AbstractOptimizer::optimize(), and bpp::AbstractOptimizer::~AbstractOptimizer().
|
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.
yn | true/false |
Implements bpp::OptimizerInterface.
Definition at line 251 of file AbstractOptimizer.h.
|
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.
Implements bpp::OptimizerInterface.
Definition at line 262 of file AbstractOptimizer.h.
References bpp::AbstractOptimizer::updateParameters_.
Referenced by doInit().
|
protectedinherited |
The constraint policy.
Must be one the following:
Definition at line 56 of file AbstractOptimizer.h.
Referenced by bpp::AbstractOptimizer::AbstractOptimizer(), bpp::AbstractOptimizer::getConstraintPolicy(), bpp::AbstractOptimizer::init(), and bpp::AbstractOptimizer::operator=().
|
protectedinherited |
The current value of the function.
Definition at line 102 of file AbstractOptimizer.h.
Referenced by bpp::NewtonOneDimension::doInit(), bpp::NewtonOneDimension::doStep(), bpp::BfgsMultiDimensions::doStep(), bpp::GoldenSectionSearch::getFunctionValue(), bpp::AbstractOptimizer::getFunctionValue(), bpp::AbstractOptimizer::init(), bpp::BrentOneDimension::optimize(), bpp::AbstractOptimizer::optimize(), and bpp::AbstractOptimizer::step().
|
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=().
|
protectedinherited |
The function to optimize.
Definition at line 29 of file AbstractOptimizer.h.
Referenced by bpp::NewtonOneDimension::firstOrderDerivableFunction(), bpp::ConjugateGradientMultiDimensions::firstOrderDerivableFunction(), bpp::BfgsMultiDimensions::firstOrderDerivableFunction(), bpp::NewtonBacktrackOneDimension::firstOrderDerivableFunction(), bpp::AbstractOptimizer::function(), bpp::NewtonOneDimension::getFirstOrderDerivableFunction(), bpp::ConjugateGradientMultiDimensions::getFirstOrderDerivableFunction(), bpp::BfgsMultiDimensions::getFirstOrderDerivableFunction(), bpp::NewtonBacktrackOneDimension::getFirstOrderDerivableFunction(), bpp::AbstractOptimizer::getFunction(), bpp::AbstractOptimizer::getFunction_(), bpp::NewtonOneDimension::getSecondOrderDerivableFunction(), bpp::AbstractOptimizer::init(), bpp::AbstractOptimizer::operator=(), bpp::NewtonOneDimension::secondOrderDerivableFunction(), and bpp::AbstractOptimizer::step().
|
private |
Definition at line 170 of file MetaOptimizer.h.
Referenced by doInit(), doStep(), and operator=().
|
protectedinherited |
Check if the optimizer have been feeded with initial parameters values.
Definition at line 78 of file AbstractOptimizer.h.
Referenced by bpp::AbstractOptimizer::AbstractOptimizer(), bpp::AbstractOptimizer::init(), bpp::AbstractOptimizer::isInitialized(), bpp::AbstractOptimizer::operator=(), and bpp::AbstractOptimizer::optimize().
|
protectedinherited |
|
protectedinherited |
The message handler.
Definition at line 39 of file AbstractOptimizer.h.
Referenced by bpp::AbstractOptimizer::autoParameter(), bpp::AbstractOptimizer::getMessageHandler(), bpp::AbstractOptimizer::operator=(), and bpp::AbstractOptimizer::printMessage().
|
private |
Definition at line 167 of file MetaOptimizer.h.
Referenced by doInit(), doStep(), MetaOptimizer(), and operator=().
|
protectedinherited |
The current number of function evaluations achieved.
Definition at line 97 of file AbstractOptimizer.h.
Referenced by bpp::DownhillSimplexMethod::doInit(), bpp::SimpleNewtonMultiDimensions::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::ConjugateGradientMultiDimensions::doStep(), bpp::BfgsMultiDimensions::doStep(), bpp::PowellMultiDimensions::doStep(), bpp::GoldenSectionSearch::doStep(), bpp::DownhillSimplexMethod::doStep(), doStep(), bpp::AbstractOptimizer::getNumberOfEvaluations(), bpp::AbstractOptimizer::init(), bpp::AbstractOptimizer::operator=(), bpp::AbstractOptimizer::optimize(), bpp::AbstractOptimizer::printPoint(), and bpp::DownhillSimplexMethod::tryExtrapolation().
|
protectedinherited |
The maximum number of function evaluations allowed.
Definition at line 92 of file AbstractOptimizer.h.
Referenced by bpp::SimpleNewtonMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::DownhillSimplexMethod::DownhillSimplexMethod(), bpp::GoldenSectionSearch::GoldenSectionSearch(), bpp::AbstractOptimizer::isMaximumNumberOfEvaluationsReached(), bpp::NewtonOneDimension::NewtonOneDimension(), bpp::AbstractOptimizer::operator=(), and bpp::AbstractOptimizer::optimize().
|
private |
Definition at line 166 of file MetaOptimizer.h.
Referenced by doInit(), doStep(), and operator=().
|
private |
Definition at line 164 of file MetaOptimizer.h.
Referenced by doInit(), doStep(), and operator=().
|
private |
Definition at line 165 of file MetaOptimizer.h.
Referenced by doInit(), doStep(), and operator=().
|
protectedinherited |
The parameters that will be optimized.
Definition at line 34 of file AbstractOptimizer.h.
Referenced by bpp::AbstractOptimizer::autoParameter(), bpp::AbstractOptimizer::getParameters(), bpp::AbstractOptimizer::getParameters_(), bpp::AbstractOptimizer::ignoreConstraints(), bpp::AbstractOptimizer::init(), bpp::AbstractOptimizer::operator=(), and bpp::AbstractOptimizer::step().
|
private |
Definition at line 168 of file MetaOptimizer.h.
Referenced by doInit(), doStep(), MetaOptimizer(), and operator=().
|
protectedinherited |
The profiler.
Definition at line 44 of file AbstractOptimizer.h.
Referenced by bpp::AbstractOptimizer::getProfiler(), bpp::AbstractOptimizer::operator=(), bpp::AbstractOptimizer::profile(), and bpp::AbstractOptimizer::profileln().
|
protectedinherited |
Definition at line 80 of file AbstractOptimizer.h.
Referenced by bpp::AbstractOptimizer::init(), bpp::AbstractOptimizer::operator=(), and bpp::AbstractOptimizer::printPoint().
|
protectedinherited |
Definition at line 86 of file AbstractOptimizer.h.
Referenced by bpp::AbstractOptimizer::getOptimizationProgressCharacter(), and bpp::AbstractOptimizer::operator=().
|
private |
Definition at line 169 of file MetaOptimizer.h.
Referenced by doInit(), doStep(), and operator=().
|
protectedinherited |
The stoping condition to use while optimizing.
Definition at line 61 of file AbstractOptimizer.h.
Referenced by bpp::AbstractOptimizer::AbstractOptimizer(), bpp::AbstractOptimizer::getStopCondition(), bpp::AbstractOptimizer::init(), bpp::AbstractOptimizer::operator=(), and bpp::AbstractOptimizer::step().
|
protectedinherited |
Tell if the tolerance level has been reached.
This field is initilaised by the init() method, maintained by the step() method and used in the optimize() method.
Definition at line 110 of file AbstractOptimizer.h.
Referenced by bpp::NewtonOneDimension::doStep(), bpp::SimpleNewtonMultiDimensions::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::ConjugateGradientMultiDimensions::doStep(), bpp::BfgsMultiDimensions::doStep(), bpp::NewtonBacktrackOneDimension::doStep(), bpp::GoldenSectionSearch::doStep(), doStep(), bpp::AbstractOptimizer::init(), bpp::AbstractOptimizer::isToleranceReached(), bpp::AbstractOptimizer::operator=(), bpp::AbstractOptimizer::optimize(), and bpp::AbstractOptimizer::step().
|
protectedinherited |
Definition at line 84 of file AbstractOptimizer.h.
Referenced by bpp::AbstractOptimizer::operator=(), bpp::AbstractOptimizer::step(), and bpp::AbstractOptimizer::updateParameters().
|
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().