#ifndef ROOT_TMVA_SimulatedAnnealing
#define ROOT_TMVA_SimulatedAnnealing
#include <vector>
#include <list>
#ifndef ROOT_TMVA_Types
#include "TMVA/Types.h"
#endif
class TRandom;
namespace TMVA {
class IFitterTarget;
class Interval;
class MsgLogger;
class SimulatedAnnealing {
public:
SimulatedAnnealing( IFitterTarget& target, const std::vector<TMVA::Interval*>& ranges );
virtual ~SimulatedAnnealing();
Double_t Minimize( std::vector<Double_t>& parameters );
void SetMaxCalls ( Int_t mc ) { fMaxCalls = mc; }
void SetInitTemp ( Double_t it ) { fInitialTemperature = it; }
void SetMinTemp ( Double_t min ) { fMinTemperature = min; }
void SetAccuracy ( Double_t eps ) { fEps = eps; }
void SetTemperatureScale ( Double_t scale ) { fTemperatureScale = scale; }
void SetAdaptiveSpeed ( Double_t speed ) { fAdaptiveSpeed = speed; }
void SetOptions( Int_t maxCalls, Double_t initialTemperature, Double_t minTemperature, Double_t eps,
TString kernelTemperatureS, Double_t temperatureScale, Double_t adaptiveSpeed,
Double_t temperatureAdaptiveStep, Bool_t useDefaultScale, Bool_t useDefaultTemperature );
private:
enum EKernelTemperature {
kSqrt = 0,
kIncreasingAdaptive,
kDecreasingAdaptive,
kLog,
kHomo,
kSin,
kGeo
} fKernelTemperature;
void FillWithRandomValues( std::vector<Double_t>& parameters );
void ReWriteParameters( std::vector<Double_t>& from, std::vector<Double_t>& to );
void GenerateNewTemperature(Double_t& currentTemperature, Int_t Iter );
void GenerateNeighbour( std::vector<Double_t>& parameters, std::vector<Double_t>& oldParameters, Double_t currentTemperature );
Bool_t ShouldGoIn( Double_t currentFit, Double_t localFit, Double_t currentTemperature );
void SetDefaultScale();
Double_t GenerateMaxTemperature( std::vector<Double_t>& parameters );
std::vector<Double_t> GenerateNeighbour( std::vector<Double_t>& parameters, Double_t currentTemperature );
IFitterTarget& fFitterTarget;
TRandom* fRandom;
const std::vector<TMVA::Interval*>& fRanges;
Int_t fMaxCalls;
Double_t fInitialTemperature;
Double_t fMinTemperature;
Double_t fEps;
Double_t fTemperatureScale;
Double_t fAdaptiveSpeed;
Double_t fTemperatureAdaptiveStep;
Bool_t fUseDefaultScale;
Bool_t fUseDefaultTemperature;
mutable MsgLogger* fLogger;
MsgLogger& Log() const { return *fLogger; }
Double_t fProgress;
ClassDef(SimulatedAnnealing,0)
};
}
#endif