#include <Log.hpp>
Public Member Functions | |
Log (std::string strName, int iRuns=5, int iGenerations=100) | |
void | logParameters (int iPopulationSize, double dCrossoverRate, double dMutationRate, int iTries, int iMinDepth, int iMaxDepth, int iTournamentSize) |
void | addEntry (int iRun, int iGeneration, double dBestFitness, double dAvgFitness, int iBestHits, double dAvgHits) |
void | logBest (std::vector< Individual * > vpindBest) |
Log::Log | ( | std::string | strName, | |
int | iRuns = 5 , |
|||
int | iGenerations = 100 | |||
) |
Sets up a new logging system. Most of the parameters are used for formatting the data.
[in] | strName | The base name, extended to create the various files. |
[in] | iRuns | The number of runs or trials the GP will cycle through |
[in] | iGenerations | The number of cycles per run |
void Log::addEntry | ( | int | iRun, | |
int | iGeneration, | |||
double | dBestFitness, | |||
double | dAvgFitness, | |||
int | iBestHits, | |||
double | dAvgHits | |||
) |
Add fitness information for a particular generation of a particular run.
[in] | iRun | The run for which the information pertains. |
[in] | iGeneration | The generation for which the information pertains. |
[in] | dBestFitness | The best fitness of any individual in this run and generation. |
[in] | dAvgFitness | The average fitness of this run and generation. |
[in] | dBestHits | The number of hits obtained by the individual with the best fitness of this run and generation. |
[in] | dAvgHits | The average hits of this run and generation. |
void Log::logBest | ( | std::vector< Individual * > | vpindBest | ) |
Write the best individuals to file. This list must be generated elsewhere and passed in.
[in] | vpindBest | A list of the best individual from each run in order. |
void Log::logParameters | ( | int | iPopulationSize, | |
double | dCrossoverRate, | |||
double | dMutationRate, | |||
int | iTries, | |||
int | iMinDepth, | |||
int | iMaxDepth, | |||
int | iTournamentSize | |||
) |
Logs the parameters to a file.
[in] | iPopulationSize | Number of individuals in a population. |
[in] | dCrossoverRate | Proportion of population to be crossed. |
[in] | dMutationRate | Proportion of population to be mutated. |
[in] | iTries | Number of attempts at crossover or mutation made before it is abandoned. |
[in] | iMinDepth | Minimum distance between root and furthest leaf to be considered a valid tree. |
[in] | iMaxDepth | Maximum distance between root and furthest leaf to be considered a valid tree. |
[in] | iTournamentSize | Number of elements randomly selected from the population of which the one with the highest fitness is selected. |