Ultra 0.9.4
Loading...
Searching...
No Matches
ultra::search_log Class Reference

Public Member Functions

template<Population P, Fitness F>
void save_snapshot (const P &, const summary< std::ranges::range_value_t< P >, F > &)
template<Individual I, Fitness F>
void save_summary (const search_stats< I, F > &, const model_measurements< F > &) const
bool is_valid () const
template<Individual I, Fitness F>
void save_dynamic (const summary< I, F > &sum, const distribution< F > &fit_dist)
template<Fitness F>
void save_population (unsigned generation, const distribution< F > &fit_dist)
template<Population P, Fitness F>
void save_layers (const P &pop, const summary< std::ranges::range_value_t< P >, F > &sum)
template<Population P, Fitness F>
void save_snapshot (const P &pop, const summary< std::ranges::range_value_t< P >, F > &sum)
template<Individual I, Fitness F>
void save_summary (const search_stats< I, F > &stats, const model_measurements< F > &threshold) const

Public Attributes

std::filesystem::path base_dir {}
std::filesystem::path dynamic_file_path {default_dynamic_file}
std::filesystem::path layers_file_path {default_layers_file}
std::filesystem::path population_file_path {default_population_file}
std::filesystem::path summary_file_path {default_summary_file}

Static Public Attributes

static constexpr auto default_dynamic_file {"dynamic.txt"}
static constexpr auto default_layers_file {"layers.txt"}
static constexpr auto default_population_file {"population.txt"}
static constexpr auto default_summary_file {"summary.xml"}

Member Function Documentation

◆ is_valid()

bool ultra::search_log::is_valid ( ) const
nodiscard
Returns
true if the object passes the internal consistency check

◆ save_layers()

template<Population P, Fitness F>
void ultra::search_log::save_layers ( const P & pop,
const summary< std::ranges::range_value_t< P >, F > & sum )

Saves working / statistical information about layer status.

Parameters
[in]popcomplete evolved population
[in]sumup to date evolution summary

◆ save_snapshot() [1/2]

template<Population P, Fitness F>
void ultra::search_log::save_snapshot ( const P & pop,
const summary< std::ranges::range_value_t< P >, F > & sum )

Saves working / statistical information in a log file.

Data are written in a CSV-like fashion and are partitioned in blocks separated by two blank lines:

[BLOCK_1]\n\n
[BLOCK_2]\n\n
...
[BLOCK_x]

where each block is a set of lines such as this:

data_1 [space] data_2 [space] ... [space] data_n

We use this format, instead of XML, because statistics are produced incrementally, making it easy and fast to append new data to a CSV-like file. Additionally, extracting and plotting data with GNU Plot is simple.

◆ save_snapshot() [2/2]

template<Population P, Fitness F>
void ultra::search_log::save_snapshot ( const P & pop,
const summary< std::ranges::range_value_t< P >, F > & sum )

Saves working / statistical information in a log file.

Data are written in a CSV-like fashion and are partitioned in blocks separated by two blank lines:

[BLOCK_1]\n\n
[BLOCK_2]\n\n
...
[BLOCK_x]

where each block is a set of lines such as this:

data_1 [space] data_2 [space] ... [space] data_n

We use this format, instead of XML, because statistics are produced incrementally, making it easy and fast to append new data to a CSV-like file. Additionally, extracting and plotting data with GNU Plot is simple.

Member Data Documentation

◆ base_dir

std::filesystem::path ultra::search_log::base_dir {}

A base common path for log files.

Note
A single log file can overwrite this path specifying an absolute path.

◆ dynamic_file_path

std::filesystem::path ultra::search_log::dynamic_file_path {default_dynamic_file}

The path to the XML file used to save real-time information.

Note
If this is an empty string, logging of real-time information is disabled.

◆ layers_file_path

std::filesystem::path ultra::search_log::layers_file_path {default_layers_file}

The path to the XML file used to save layer-specific information.

Note
If this is an empty string, logging of layer-related information is disabled.

◆ population_file_path

std::filesystem::path ultra::search_log::population_file_path {default_population_file}

The path to the XML file used to save population-specific information.

Note
If this is an empty string, logging of population-related information is disabled.
Warning
Enabling this log with large populations has a big performance impact.

◆ summary_file_path

std::filesystem::path ultra::search_log::summary_file_path {default_summary_file}

The path to the XML file used to save summary information.

Note
If this is an empty string, logging of summary information is disabled.

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