41 #ifndef BPP_NUMERIC_FUNCTION_ABSTRACTOPTIMIZER_H
42 #define BPP_NUMERIC_FUNCTION_ABSTRACTOPTIMIZER_H
315 void profile(
const std::string& s);
Partial implementation of the Optimizer interface.
const std::string & getOptimizationProgressCharacter() const
void setOptimizationProgressCharacter(const std::string &c)
Set the character to be displayed during optimization.
void setFunction(Function *function)
Set the function to optimize.
void setProfiler(OutputStream *profiler)
Set the profiler for this optimizer.
void ignoreConstraints()
Remove the constraints of all the arguments.
Function * function_
The function to optimize.
bool isInitialized() const
void setConstraintPolicy(const std::string &constraintPolicy)
Set the constraint policy for this optimizer.
const OptimizationStopCondition * getDefaultStopCondition() const
Get the default stop condition of the optimization algorithm.
OutputStream * getMessageHandler() const
std::vector< OptimizationListener * > listeners_
OutputStream * getProfiler() const
void setMessageHandler(OutputStream *mh)
Set the message handler for this optimizer.
OptimizationStopCondition * stopCondition_
The stoping condition to use while optimizing.
void fireOptimizationInitializationPerformed(const OptimizationEvent &event)
Notify all listeners that optimizer initialization was performed.
void printPoint(const ParameterList ¶ms, double value)
Print parameters and corresponding function evaluation to profiler.
double step()
Basic implementation.
double optimize()
Basic implementation.
void printMessage(const std::string &message)
Give a message to print to the message handler.
OptimizationStopCondition * getDefaultStopCondition()
Get the default stop condition of the optimization algorithm.
Parameter & getParameter_(size_t i)
bool listenerModifiesParameters() const
void profileln(double v)
Print to the profile if there is one and end line.
Function * getFunction()
Get the current function being optimized.
double getParameterValue(const std::string &name) const
unsigned int nbEvalMax_
The maximum number of function evaluations allowed.
void fireOptimizationStepPerformed(const OptimizationEvent &event)
Notify all listeners that an optimization step was performed.
OutputStream * profiler_
The profiler.
unsigned int nbEval_
The current number of function evaluations achieved.
const ParameterList & getParameters() const
void setStopCondition(const OptimizationStopCondition &stopCondition)
Set the stop condition of the optimization algorithm.
double getFunctionValue() const
Get the current function value.
Function * getFunction_()
OptimizationStopCondition * defaultStopCondition_
The default stoping condition to use while optimizing.
AbstractOptimizer(Function *function=0)
void init(const ParameterList ¶ms)
Basic implementation.
bool isToleranceReached() const
Tell if the tolerance level is reached.
const OptimizationStopCondition * getStopCondition() const
Get the stop condition of the optimization algorithm.
void setVerbose(unsigned int v)
Set the verbose level.
unsigned int getNumberOfEvaluations() const
Get the number of function evaluations performed since the call of the init function.
OutputStream * messageHandler_
The message handler.
ParameterList & getParameters_()
unsigned int verbose_
State of the verbose mode: > 0 = enabled.
std::string constraintPolicy_
The constraint policy.
OptimizationStopCondition * getStopCondition()
Get the stop condition of the optimization algorithm.
const Function * getFunction() const
Get the current function being optimized.
void setMaximumNumberOfEvaluations(unsigned int max)
Set the maximum number of function evaluation to perform during optimization.
bool isInitialized_
Check if the optimizer have been feeded with initial parameters values.
std::string getConstraintPolicy() const
Get the constraint policy for this optimizer.
virtual ~AbstractOptimizer()
double currentValue_
The current value of the function.
bool isMaximumNumberOfEvaluationsReached() const
Tell if the maximum number of function evaluations is reached.
bool tolIsReached_
Tell if the tolerance level has been reached.
unsigned int getVerbose() const
Get the verbose level.
virtual void doInit(const ParameterList ¶ms)=0
This function is called by the init() method and contains all calculations.
void profile(double v)
Print to the profile if there is one.
void addOptimizationListener(OptimizationListener *listener)
Register a listener to this class.
bool updateParameters() const
Tell if we shall update all parameters after one optimization step.
void updateParameters(bool yn)
Tell if we shall update all parameters after one optimization step.
void autoParameter()
Build a list of AutoParameter instead of Parameter.
bool hasFunction() const
Tell if a funciton is associatied to this optimizer.
AbstractOptimizer & operator=(const AbstractOptimizer &opt)
ParameterList parameters_
The parameters that will be optimized.
virtual double doStep()=0
This function is called by the step() method and contains all calculations.
void setDefaultStopCondition_(OptimizationStopCondition *osc)
This is the function abstract class.
The base class exception for NULL pointer error. This exception may be thrown when an unexpected NULL...
An event object which indicates that an optimization event occured.
The listener interface for receiving optimization events.
Interface for otimization stop condition objet.
OptimizationStopCondition * clone() const =0
Create a copy of this object and send a pointer to it.
virtual void init()=0
Initialize the condition.
This is the basal interface for all optimization methods.
The parameter list object.
virtual double getParameterValue(const std::string &name) const
Get the value of the parameter with name name.
This class is designed to facilitate the manipulation of parameters.