48 lines
1.5 KiB
C++
Executable File
48 lines
1.5 KiB
C++
Executable 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
|