1#ifndef CONSOLE_LOGGER_H
2#define CONSOLE_LOGGER_H
18 template <
typename GeneType>
21 std::size_t interval_m;
28 explicit ConsoleLogger(
const std::size_t interval) : interval_m(interval) {}
36 if (interval_m > 0 && (gen % interval_m == 0 || gen == 0)) {
37 std::cout <<
"Generation " << gen
A container for a group of individuals in the genetic algorithm.
const Individual< GeneType > & getBestIndividual() const
Finds and returns the individual with the best fitness score.
Logger for printing optimization progress to the console.
void log(const std::size_t gen, const Population< GeneType > &pop)
Prints the current best fitness if the generation matches the interval.
ConsoleLogger(const std::size_t interval)
Constructs a console logger.