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