ROOT  6.06/09
Reference Guide
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TMVA::GeneticPopulation Class Reference

Definition at line 58 of file GeneticPopulation.h.

Public Member Functions

 GeneticPopulation (const std::vector< TMVA::Interval * > &ranges, Int_t size, UInt_t seed=0)
 Constructor. More...
 
virtual ~GeneticPopulation ()
 destructor More...
 
void SetRandomSeed (UInt_t seed=0)
 the random seed of the random generator More...
 
void MakeChildren ()
 does what the name says,... More...
 
void Mutate (Double_t probability=20, Int_t startIndex=0, Bool_t near=kFALSE, Double_t spread=0.1, Bool_t mirror=kFALSE)
 mutates the individuals in the genePool Parameters: double probability : gives the probability (in percent) of a mutation of a coefficient int startIndex : leaves unchanged (without mutation) the individuals which are better ranked than indicated by "startIndex". More...
 
GeneticGenesGetGenes (Int_t index)
 gives back the "Genes" of the population with the given index. More...
 
Int_t GetPopulationSize () const
 
Double_t GetFitness () const
 
const std::vector< TMVA::GeneticGenes > & GetGenePool () const
 
const std::vector< TMVA::GeneticRange * > & GetRanges () const
 
std::vector< TMVA::GeneticGenes > & GetGenePool ()
 
std::vector< TMVA::GeneticRange * > & GetRanges ()
 
void Print (Int_t untilIndex=-1)
 make a little printout of the individuals up to index "untilIndex" this means, . More...
 
void Print (std::ostream &out, Int_t utilIndex=-1)
 
TH1FVariableDistribution (Int_t varNumber, Int_t bins, Int_t min, Int_t max)
 give back a histogram with the distribution of the coefficients parameters: int bins : number of bins of the histogram int min : histogram minimum int max : maximum value of the histogram More...
 
std::vector< Double_tVariableDistribution (Int_t varNumber)
 gives back all the values of coefficient "varNumber" of the current generation More...
 
void MakeCopies (int number)
 produces offspring which is are copies of their parents Parameters: int number : the number of the last individual to be copied More...
 
void NextGeneration ()
 
void AddPopulation (GeneticPopulation *strangers)
 add another population (strangers) to the one of this GeneticPopulation More...
 
void AddPopulation (GeneticPopulation &strangers)
 add another population (strangers) to the one of this GeneticPopulation More...
 
void TrimPopulation ()
 trim the population to the predefined size More...
 
void GiveHint (std::vector< Double_t > &hint, Double_t fitness=0)
 add an individual (a set of variables) to the population if there is a set of variables which is known to perform good, they can be given as a hint to the population More...
 
void Sort ()
 sort the genepool according to the fitness of the individuals More...
 

Private Member Functions

GeneticGenes MakeSex (GeneticGenes male, GeneticGenes female)
 this function takes two individuals and produces offspring by mixing (recombining) their coefficients More...
 
MsgLoggerLog () const
 

Private Attributes

std::vector< TMVA::GeneticGenesfGenePool
 
std::vector< TMVA::GeneticRange * > fRanges
 
TRandom3fRandomGenerator
 
MsgLoggerfLogger
 
Int_t fPopulationSizeLimit
 

#include <TMVA/GeneticPopulation.h>

+ Collaboration diagram for TMVA::GeneticPopulation:

Constructor & Destructor Documentation

TMVA::GeneticPopulation::GeneticPopulation ( const std::vector< TMVA::Interval * > &  ranges,
Int_t  size,
UInt_t  seed = 0 
)

Constructor.

Definition at line 50 of file GeneticPopulation.cxx.

TMVA::GeneticPopulation::~GeneticPopulation ( )
virtual

destructor

Definition at line 79 of file GeneticPopulation.cxx.

Member Function Documentation

void TMVA::GeneticPopulation::AddPopulation ( GeneticPopulation strangers)

add another population (strangers) to the one of this GeneticPopulation

Definition at line 285 of file GeneticPopulation.cxx.

Referenced by TMVA::GeneticFitter::Run().

void TMVA::GeneticPopulation::AddPopulation ( GeneticPopulation strangers)

add another population (strangers) to the one of this GeneticPopulation

Definition at line 296 of file GeneticPopulation.cxx.

Double_t TMVA::GeneticPopulation::GetFitness ( ) const
inline

Definition at line 73 of file GeneticPopulation.h.

const std::vector<TMVA::GeneticGenes>& TMVA::GeneticPopulation::GetGenePool ( ) const
inline

Definition at line 75 of file GeneticPopulation.h.

std::vector<TMVA::GeneticGenes>& TMVA::GeneticPopulation::GetGenePool ( )
inline

Definition at line 78 of file GeneticPopulation.h.

TMVA::GeneticGenes * TMVA::GeneticPopulation::GetGenes ( Int_t  index)

gives back the "Genes" of the population with the given index.

Definition at line 197 of file GeneticPopulation.cxx.

Referenced by ROOT::Math::GeneticMinimizer::Minimize(), and TMVA::GeneticFitter::Run().

Int_t TMVA::GeneticPopulation::GetPopulationSize ( ) const
inline

Definition at line 72 of file GeneticPopulation.h.

const std::vector<TMVA::GeneticRange*>& TMVA::GeneticPopulation::GetRanges ( ) const
inline

Definition at line 76 of file GeneticPopulation.h.

std::vector<TMVA::GeneticRange*>& TMVA::GeneticPopulation::GetRanges ( )
inline

Definition at line 79 of file GeneticPopulation.h.

void TMVA::GeneticPopulation::GiveHint ( std::vector< Double_t > &  hint,
Double_t  fitness = 0 
)

add an individual (a set of variables) to the population if there is a set of variables which is known to perform good, they can be given as a hint to the population

Definition at line 315 of file GeneticPopulation.cxx.

Referenced by TMVA::GeneticFitter::Run().

MsgLogger& TMVA::GeneticPopulation::Log ( ) const
inlineprivate

Definition at line 110 of file GeneticPopulation.h.

void TMVA::GeneticPopulation::MakeChildren ( )

does what the name says,...

it creates children out of members of the current generation children have a combination of the coefficients of their parents

Definition at line 121 of file GeneticPopulation.cxx.

void TMVA::GeneticPopulation::MakeCopies ( int  number)

produces offspring which is are copies of their parents Parameters: int number : the number of the last individual to be copied

Definition at line 105 of file GeneticPopulation.cxx.

TMVA::GeneticGenes TMVA::GeneticPopulation::MakeSex ( TMVA::GeneticGenes  male,
TMVA::GeneticGenes  female 
)
private

this function takes two individuals and produces offspring by mixing (recombining) their coefficients

Definition at line 139 of file GeneticPopulation.cxx.

void TMVA::GeneticPopulation::Mutate ( Double_t  probability = 20,
Int_t  startIndex = 0,
Bool_t  near = kFALSE,
Double_t  spread = 0.1,
Bool_t  mirror = kFALSE 
)

mutates the individuals in the genePool Parameters: double probability : gives the probability (in percent) of a mutation of a coefficient int startIndex : leaves unchanged (without mutation) the individuals which are better ranked than indicated by "startIndex".

This means: if "startIndex==3", the first (and best) three individuals are not mutaded. This allows to preserve the best result of the current Generation for the next generation. Bool_t near : if true, the mutation will produce a new coefficient which is "near" the old one (gaussian around the current value) double spread : if near==true, spread gives the sigma of the gaussian Bool_t mirror : if the new value obtained would be outside of the given constraints the value is mapped between the constraints again. This can be done either by a kind of periodic boundary conditions or mirrored at the boundary. (mirror = true seems more "natural")

Definition at line 170 of file GeneticPopulation.cxx.

void TMVA::GeneticPopulation::NextGeneration ( )
inline

Definition at line 92 of file GeneticPopulation.h.

void TMVA::GeneticPopulation::Print ( Int_t  untilIndex = -1)

make a little printout of the individuals up to index "untilIndex" this means, .

. write out the best "untilIndex" individuals.

Definition at line 207 of file GeneticPopulation.cxx.

void TMVA::GeneticPopulation::Print ( std::ostream &  out,
Int_t  utilIndex = -1 
)
void TMVA::GeneticPopulation::SetRandomSeed ( UInt_t  seed = 0)

the random seed of the random generator

Definition at line 94 of file GeneticPopulation.cxx.

void TMVA::GeneticPopulation::Sort ( )

sort the genepool according to the fitness of the individuals

Definition at line 326 of file GeneticPopulation.cxx.

Referenced by TMVA::GeneticFitter::Run().

void TMVA::GeneticPopulation::TrimPopulation ( )

trim the population to the predefined size

Definition at line 304 of file GeneticPopulation.cxx.

Referenced by ROOT::Math::GeneticMinimizer::Minimize(), and TMVA::GeneticFitter::Run().

TH1F * TMVA::GeneticPopulation::VariableDistribution ( Int_t  varNumber,
Int_t  bins,
Int_t  min,
Int_t  max 
)

give back a histogram with the distribution of the coefficients parameters: int bins : number of bins of the histogram int min : histogram minimum int max : maximum value of the histogram

Definition at line 255 of file GeneticPopulation.cxx.

vector< Double_t > TMVA::GeneticPopulation::VariableDistribution ( Int_t  varNumber)

gives back all the values of coefficient "varNumber" of the current generation

Definition at line 273 of file GeneticPopulation.cxx.

Member Data Documentation

std::vector<TMVA::GeneticGenes> TMVA::GeneticPopulation::fGenePool
private

Definition at line 104 of file GeneticPopulation.h.

Referenced by AddPopulation(), GetFitness(), GetGenePool(), and GetPopulationSize().

MsgLogger* TMVA::GeneticPopulation::fLogger
mutableprivate

Definition at line 109 of file GeneticPopulation.h.

Referenced by Log(), and ~GeneticPopulation().

Int_t TMVA::GeneticPopulation::fPopulationSizeLimit
private

Definition at line 112 of file GeneticPopulation.h.

TRandom3* TMVA::GeneticPopulation::fRandomGenerator
private

Definition at line 107 of file GeneticPopulation.h.

Referenced by ~GeneticPopulation().

std::vector<TMVA::GeneticRange*> TMVA::GeneticPopulation::fRanges
private

Definition at line 105 of file GeneticPopulation.h.

Referenced by GetRanges(), and ~GeneticPopulation().


The documentation for this class was generated from the following files: