GALib-Parallel
Header-only C++ library for parallel evolutionary algorithms
Loading...
Searching...
No Matches
Public Member Functions | List of all members
galib::utils::FileLogger< GeneType > Class Template Reference

Logger for writing optimization progress to a CSV file. More...

#include <FileLogger.h>

Public Member Functions

 FileLogger (const std::string &path, const std::size_t interval)
 Constructs a file logger.
 
void log (std::size_t gen, const Population< GeneType > &pop)
 Appends current population data to the CSV file.
 

Detailed Description

template<typename GeneType>
class galib::utils::FileLogger< GeneType >

Logger for writing optimization progress to a CSV file.

Records the fitness and genotype of every individual in the population at defined intervals, creating a detailed audit trail of the evolution.

Template Parameters
GeneTypeThe gene type of the population.

Definition at line 22 of file FileLogger.h.

Constructor & Destructor Documentation

◆ FileLogger()

template<typename GeneType >
galib::utils::FileLogger< GeneType >::FileLogger ( const std::string &  path,
const std::size_t  interval 
)
inline

Constructs a file logger.

Parameters
pathOutput CSV file path.
intervalGeneration frequency for recording data.

Definition at line 34 of file FileLogger.h.

Member Function Documentation

◆ log()

template<typename GeneType >
void galib::utils::FileLogger< GeneType >::log ( std::size_t  gen,
const Population< GeneType > &  pop 
)
inline

Appends current population data to the CSV file.

Parameters
genCurrent generation index.
popCurrent population state.

Definition at line 42 of file FileLogger.h.

References galib::Population< GeneType >::getNumGenes(), and galib::Population< GeneType >::size().


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