methods.h
Go to the documentation of this file.
#ifndef METHODS_H
#define METHODS_H
#include"models.h"
/*
* Optimization Methods
*/
class OptimizationMethod{
public:
//Virtual Constructor & Destructor for any optimization method
OptimizationMethod(){};
OptimizationMethod(Model* A):ToAdjust(A){};
virtual ~OptimizationMethod(){};
//Virtual initialisation, execution, finalisation for any optimization method
virtual void initialise(){}; //Initialise attributes using values stored in the method header file
virtual void execute(){}; //Execute the optimization of the model
virtual void finalise() const = 0; //Export the model parameters and display the optimized model
protected:
Model* ToAdjust;
};
// Simulated Annealing
class SimulatedAnnealing : public OptimizationMethod{
public:
//Constructor & Destructor specific to this method
SimulatedAnnealing();
SimulatedAnnealing(Model*);
SimulatedAnnealing(Model*,double,double,double,double,int,int);
~SimulatedAnnealing(){};
//Initialisation, execution and finalisation for this method
void initialise();
void execute();
void finalise() const ;
private:
double ampl; //Variation amplitude to get Neighbor
double temp; //Current temperature of the system
double t_end; //Freezing temperature
double cooling; //Cooling ratio
int length; //Number of iteration for the same value of temperature
int max_f; //Max number of unsuccessful iterations
int current_f; //Current number of unsuccessful iteration combo
};
#endif
SimulatedAnnealing
Definition: methods.h:26
SimulatedAnnealing::SimulatedAnnealing
SimulatedAnnealing()
Definition: methods.cpp:17
OptimizationMethod::execute
virtual void execute()
Definition: methods.h:18
OptimizationMethod::initialise
virtual void initialise()
Definition: methods.h:17
SimulatedAnnealing::execute
void execute()
Definition: methods.cpp:85
OptimizationMethod::finalise
virtual void finalise() const =0
OptimizationMethod::OptimizationMethod
OptimizationMethod()
Definition: methods.h:13
SimulatedAnnealing::initialise
void initialise()
Definition: methods.cpp:75
OptimizationMethod::~OptimizationMethod
virtual ~OptimizationMethod()
Definition: methods.h:15
OptimizationMethod::OptimizationMethod
OptimizationMethod(Model *A)
Definition: methods.h:14
OptimizationMethod
Definition: methods.h:10
OptimizationMethod::ToAdjust
Model * ToAdjust
Definition: methods.h:21
SimulatedAnnealing::finalise
void finalise() const
Definition: methods.cpp:114
models.h
Model
Definition: models.h:11
SimulatedAnnealing::~SimulatedAnnealing
~SimulatedAnnealing()
Definition: methods.h:32