#ifndef ROOT_TMVA_GeneticPopulation
#define ROOT_TMVA_GeneticPopulation
#include <string>
#include <vector>
#ifndef ROOT_Riosfwd
#include "Riosfwd.h"
#endif
#ifndef ROOT_TMVA_GeneticGenes
#include "TMVA/GeneticGenes.h"
#endif
#ifndef ROOT_TMVA_Interval
#include "TMVA/Interval.h"
#endif
#ifndef ROOT_TMVA_GeneticRange
#include "TMVA/GeneticRange.h"
#endif
class TH1F;
namespace TMVA {
class MsgLogger;
class GeneticPopulation {
public:
GeneticPopulation(const std::vector<TMVA::Interval*>& ranges, Int_t size, UInt_t seed = 0);
virtual ~GeneticPopulation();
void SetRandomSeed( UInt_t seed = 0);
void MakeChildren();
void Mutate( Double_t probability = 20, Int_t startIndex = 0, Bool_t near = kFALSE,
Double_t spread = 0.1, Bool_t mirror = kFALSE );
GeneticGenes* GetGenes( Int_t index );
Int_t GetPopulationSize() const { return fGenePool.size(); }
Double_t GetFitness() const { return fGenePool.size()>0? fGenePool[0].GetFitness() : 0; }
const std::vector<TMVA::GeneticGenes>& GetGenePool() const { return fGenePool; }
const std::vector<TMVA::GeneticRange*>& GetRanges() const { return fRanges; }
std::vector<TMVA::GeneticGenes>& GetGenePool() { return fGenePool; }
std::vector<TMVA::GeneticRange*>& GetRanges() { return fRanges; }
void Print( Int_t untilIndex = -1 );
void Print( ostream & out, Int_t utilIndex = -1 );
TH1F* VariableDistribution( Int_t varNumber, Int_t bins, Int_t min, Int_t max );
std::vector< Double_t > VariableDistribution( Int_t varNumber );
void MakeCopies( int number );
void NextGeneration() {}
void AddPopulation( GeneticPopulation *strangers );
void AddPopulation( GeneticPopulation &strangers );
void TrimPopulation();
void GiveHint( std::vector< Double_t >& hint, Double_t fitness = 0 );
void Sort();
private:
GeneticGenes MakeSex( GeneticGenes male, GeneticGenes female );
private:
std::vector<TMVA::GeneticGenes> fGenePool;
std::vector<TMVA::GeneticRange*> fRanges;
TRandom3*fRandomGenerator;
mutable MsgLogger* fLogger;
MsgLogger& Log() const { return *fLogger; }
Int_t fPopulationSizeLimit;
ClassDef(GeneticPopulation,0)
};
}
#endif