44 #include "../ParameterList.h" 46 #include "../../Clonable.h" 47 #include "../../Io/OutputStream.h" 132 #if defined(NO_VIRTUAL_COV) 379 backupFile_(backupFile) {}
387 std::ofstream bck(backupFile_.c_str(), std::ios::out);
388 bck <<
"f(x)=" << setprecision(20) <<
event.getOptimizer()->getFunction()->getValue() << endl;
389 ParameterList pl =
event.getOptimizer()->getFunction()->getParameters();
390 for (
unsigned int i = 0; i < pl.
size(); ++i) {
391 bck << pl[i].getName() <<
"=" << setprecision(20) << pl[i].getValue() << std::endl;
401 #endif //_OPTIMIZER_H_
virtual bool hasFunction() const =0
Tell if a funciton is associatied to this optimizer.
virtual void setMessageHandler(OutputStream *mh)=0
Set the message handler for this optimizer.
const Optimizer * getOptimizer() const
virtual OutputStream * getMessageHandler() const =0
bool listenerModifiesParameters() const
virtual const ParameterList & getParameters() const =0
This class allows to perform a correspondence analysis.
virtual const Function * getFunction() const =0
Get the current function being optimized.
virtual bool isToleranceReached() const =0
Tell if the tolerance level is reached.
This is the function abstract class.
OptimizationEvent(Optimizer *optimizer)
virtual double optimize()=0
Perform as many optimization steps untill the stop condition is met.
OptimizationEvent(const OptimizationEvent &oe)
Interface for otimization stop condition objet.
OptimizationEvent & operator=(const OptimizationEvent &oe)
virtual std::string getConstraintPolicy() const =0
Get the constraint policy for this optimizer.
void optimizationStepPerformed(const OptimizationEvent &event)
virtual OptimizationStopCondition * getDefaultStopCondition()=0
Get the default stop condition of the optimization algorithm.
virtual ~OptimizationListener()
Optimizer * getOptimizer()
The parameter list object.
virtual bool listenerModifiesParameters() const =0
virtual double getFunctionValue() const =0
Get the current function value.
virtual OutputStream * getProfiler() const =0
The listener interface for receiving optimization events.
virtual void addOptimizationListener(OptimizationListener *listener)=0
Register a listener to this class.
virtual ~BackupListener()
virtual void setFunction(Function *function)=0
Set the function to optimize.
virtual double step()=0
Perform an optimization step.
virtual ~OptimizationEvent()
virtual void optimizationInitializationPerformed(const OptimizationEvent &event)=0
Save intermediate optimization results to file.
The base class exception for NULL pointer error.
virtual unsigned int getNumberOfEvaluations() const =0
Get the number of function evaluations performed since the call of the init function.
virtual void setVerbose(unsigned int v)=0
Set the verbose level.
Optimizer * clone() const =0
Create a copy of this object and send a pointer to it.
virtual unsigned int getVerbose() const =0
Get the verbose level.
virtual void setMaximumNumberOfEvaluations(unsigned int max)=0
Set the maximum number of function evaluation to perform during optimization.
An event object which indicates that an optimization event occured.
virtual void setStopCondition(const OptimizationStopCondition &stopCondition)=0
Set the stop condition of the optimization algorithm.
The Clonable interface (allow an object to be cloned).
virtual void optimizationStepPerformed(const OptimizationEvent &event)=0
virtual bool isInitialized() const =0
virtual void setProfiler(OutputStream *profiler)=0
Set the profiler for this optimizer.
virtual bool isMaximumNumberOfEvaluationsReached() const =0
Tell if the maximum number of function evaluations is reached.
This is the basal interface for all optimization methods.
virtual void init(const ParameterList ¶ms)=0
Set the initial values of the parameters.
void optimizationInitializationPerformed(const OptimizationEvent &event)
BackupListener(const string &backupFile)
virtual double getParameterValue(const std::string &name) const =0
virtual void setConstraintPolicy(const std::string &constraintPolicy)=0
Set the constraint policy for this optimizer.
virtual OptimizationStopCondition * getStopCondition()=0
Get the stop condition of the optimization algorithm.