Warning, file /include/root/TMVA/GeneticAlgorithm.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #ifndef ROOT_TMVA_GeneticAlgorithm
0026 #define ROOT_TMVA_GeneticAlgorithm
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #include <vector>
0037 #include <deque>
0038 #include <iosfwd>
0039
0040 #include "TMVA/IFitterTarget.h"
0041 #include "TMVA/GeneticPopulation.h"
0042 #include "TMVA/Types.h"
0043
0044 namespace TMVA {
0045
0046 class IFitterTarget;
0047 class Interval;
0048 class MsgLogger;
0049
0050 class GeneticAlgorithm {
0051
0052 public:
0053
0054 GeneticAlgorithm( IFitterTarget& target, Int_t populationSize,
0055 const std::vector<TMVA::Interval*>& ranges, UInt_t seed = 0 );
0056 virtual ~GeneticAlgorithm();
0057
0058 void Init();
0059
0060 virtual Bool_t HasConverged(Int_t steps = 10, Double_t ratio = 0.1);
0061 virtual Double_t SpreadControl(Int_t steps, Int_t ofSteps,
0062 Double_t factor);
0063 virtual Double_t NewFitness(Double_t oldValue, Double_t newValue);
0064 virtual Double_t CalculateFitness();
0065 virtual void Evolution();
0066
0067 GeneticPopulation& GetGeneticPopulation() { return fPopulation; }
0068
0069 Double_t GetSpread() const { return fSpread; }
0070 void SetSpread(Double_t s) { fSpread = s; }
0071
0072 void SetMakeCopies(Bool_t s) { fMakeCopies = s; }
0073 Bool_t GetMakeCopies() { return fMakeCopies; }
0074
0075 Int_t fConvCounter;
0076
0077 protected:
0078
0079 IFitterTarget& fFitterTarget;
0080
0081 Double_t fConvValue;
0082
0083
0084
0085
0086 std::deque<Int_t> fSuccessList;
0087 Double_t fLastResult;
0088
0089 Double_t fSpread;
0090 Bool_t fMirror;
0091 Bool_t fFirstTime;
0092 Bool_t fMakeCopies;
0093
0094 Int_t fPopulationSize;
0095
0096 const std::vector<TMVA::Interval*>& fRanges;
0097
0098 GeneticPopulation fPopulation;
0099 Double_t fBestFitness;
0100
0101 mutable MsgLogger* fLogger;
0102 MsgLogger& Log() const { return *fLogger; }
0103
0104 ClassDef(GeneticAlgorithm, 0);
0105 };
0106
0107 }
0108
0109 #endif