25 #ifndef ROOT_TMVA_GeneticPopulation
26 #define ROOT_TMVA_GeneticPopulation
49 class GeneticPopulation {
53 GeneticPopulation(
const std::vector<TMVA::Interval*>& ranges, Int_t size, UInt_t seed = 0);
54 virtual ~GeneticPopulation();
56 void SetRandomSeed( UInt_t seed = 0);
59 void Mutate( Double_t probability = 20, Int_t startIndex = 0, Bool_t near = kFALSE,
60 Double_t spread = 0.1, Bool_t mirror = kFALSE );
62 GeneticGenes* GetGenes( Int_t index );
63 Int_t GetPopulationSize()
const {
return fGenePool.size(); }
64 Double_t GetFitness()
const {
return fGenePool.size()>0? fGenePool[0].GetFitness() : 0; }
66 const std::vector<TMVA::GeneticGenes>& GetGenePool()
const {
return fGenePool; }
67 const std::vector<TMVA::GeneticRange*>& GetRanges()
const {
return fRanges; }
69 std::vector<TMVA::GeneticGenes>& GetGenePool() {
return fGenePool; }
70 std::vector<TMVA::GeneticRange*>& GetRanges() {
return fRanges; }
72 void Print( Int_t untilIndex = -1 );
73 void Print( std::ostream & out, Int_t utilIndex = -1 );
75 TH1F* VariableDistribution( Int_t varNumber, Int_t bins, Int_t min, Int_t max );
76 std::vector< Double_t > VariableDistribution( Int_t varNumber );
82 void MakeCopies(
int number );
83 void NextGeneration() {}
84 void AddPopulation( GeneticPopulation *strangers );
85 void AddPopulation( GeneticPopulation &strangers );
86 void TrimPopulation();
87 void GiveHint( std::vector< Double_t >& hint, Double_t fitness = 0 );
91 GeneticGenes MakeSex( GeneticGenes male, GeneticGenes female );
95 std::vector<TMVA::GeneticGenes> fGenePool;
96 std::vector<TMVA::GeneticRange*> fRanges;
98 TRandom3*fRandomGenerator;
100 mutable MsgLogger* fLogger;
101 MsgLogger& Log()
const {
return *fLogger; }
103 Int_t fPopulationSizeLimit;
105 ClassDef(GeneticPopulation,0);