Modernized GAlib  3.0.0 current
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
GAStatistics Class Reference

Statistics class. More...

#include <GAStatistics.h>

Collaboration diagram for GAStatistics:
[legend]

Public Types

enum  {
  NoScores = 0x00 , Mean = 0x01 , Maximum = 0x02 , Minimum = 0x04 ,
  Deviation = 0x08 , Diversity = 0x10 , AllScores = 0xff
}
 

Public Member Functions

 GAStatistics (const GAStatistics &)
 
GAStatisticsoperator= (const GAStatistics &orig)
 
void copy (const GAStatistics &)
 
float online () const
 
float offlineMax () const
 
float offlineMin () const
 
float initial (int w=Maximum) const
 
float current (int w=Maximum) const
 
float maxEver () const
 
float minEver () const
 
int generation () const
 
unsigned long int selections () const
 
unsigned long int crossovers () const
 
unsigned long int mutations () const
 
unsigned long int replacements () const
 
unsigned long int indEvals () const
 
unsigned long int popEvals () const
 
float convergence () const
 
int nConvergence () const
 
int nConvergence (unsigned int)
 
int nBestGenomes (const GAGenome &, unsigned int)
 
int nBestGenomes () const
 
int scoreFrequency (unsigned int x)
 
int scoreFrequency () const
 
int flushFrequency (unsigned int x)
 
int flushFrequency () const
 
std::string scoreFilename (const std::string &filename)
 
std::string scoreFilename () const
 
int selectScores (int w)
 
int selectScores () const
 
bool recordDiversity (bool flag)
 
bool recordDiversity () const
 
void flushScores ()
 
void update (const GAPopulation &pop)
 
void reset (const GAPopulation &pop)
 
const GAPopulationbestPopulation () const
 
const GAGenomebestIndividual (unsigned int n=0) const
 
int scores (const std::string &filename, int which=NoScores)
 
int scores (std::ostream &os, int which=NoScores)
 
int write (const std::string &filename) const
 
int write (std::ostream &os) const
 

Public Attributes

unsigned long int numsel
 
unsigned long int numcro
 
unsigned long int nummut
 
unsigned long int numrep
 
unsigned long int numeval
 
unsigned long int numpeval
 

Protected Member Functions

void setConvergence (float)
 
void setScore (const GAPopulation &)
 
void updateBestIndividual (const GAPopulation &, bool flag=false)
 
void writeScores ()
 
void resizeScores (unsigned int)
 

Protected Attributes

unsigned int curgen
 
unsigned int scoreFreq
 
bool dodiv
 
float maxever
 
float minever
 
float on
 
float offmax
 
float offmin
 
float aveInit
 
float maxInit
 
float minInit
 
float devInit
 
float divInit
 
float aveCur
 
float maxCur
 
float minCur
 
float devCur
 
float divCur
 
unsigned int nconv
 
unsigned int Nconv
 
float * cscore
 
unsigned int nscrs
 how many scores do we have?
 
unsigned int Nscrs
 
std::vector< int > gen
 generation number corresponding to scores
 
std::vector< float > aveScore
 average scores of each generation
 
std::vector< float > maxScore
 best scores of each generation
 
std::vector< float > minScore
 worst scores of each generation
 
std::vector< float > devScore
 stddev of each generation
 
std::vector< float > divScore
 diversity of each generation
 
std::string scorefile
 name of file to which scores get written
 
int which
 which data to write to file
 
GAPopulationboa
 keep a copy of the best genomes
 

Friends

class GA
 

Detailed Description

Statistics class.

We define this class as a storage object for the current state of the GA. Whereas the parameters object keeps track of the user-definable settings for the GA, the statistics object keeps track of the data that the GA generates along the way.


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