Ultra 0.9.4
Loading...
Searching...
No Matches
search_log.h
Go to the documentation of this file.
1
12
13#if !defined(ULTRA_SEARCH_LOG_H)
14#define ULTRA_SEARCH_LOG_H
15
18#include "kernel/search_stats.h"
19#include "utility/xml_tools.h"
20
21#include <filesystem>
22#include <fstream>
23
24namespace ultra
25{
26
28{
29public:
30 static constexpr auto default_dynamic_file {"dynamic.txt"};
31 static constexpr auto default_layers_file {"layers.txt"};
32 static constexpr auto default_population_file {"population.txt"};
33 static constexpr auto default_summary_file {"summary.xml"};
34
35 template<Population P, Fitness F> void save_snapshot(
36 const P &, const summary<std::ranges::range_value_t<P>, F> &);
37
38 template<Individual I, Fitness F> void save_summary(
39 const search_stats<I, F> &, const model_measurements<F> &) const;
40
41 [[nodiscard]] bool is_valid() const;
42
46 std::filesystem::path base_dir {};
47
51 std::filesystem::path dynamic_file_path {default_dynamic_file};
52
57 std::filesystem::path layers_file_path {default_layers_file};
58
65 std::filesystem::path population_file_path {default_population_file};
66
70 std::filesystem::path summary_file_path {default_summary_file};
71
72private:
73 [[nodiscard]] std::filesystem::path build_path(
74 const std::filesystem::path &) const;
75 bool open();
76
77 template<Individual I, Fitness F> void save_dynamic(
78 const summary<I, F> &, const distribution<F> &);
79 template<Population P, Fitness F> void save_layers(
80 const P &, const summary<std::ranges::range_value_t<P>, F> &);
81 template<Fitness F> void save_population(unsigned, const distribution<F> &);
82
83 std::ofstream dynamic_file;
84 std::ofstream layers_file;
85 std::ofstream population_file;
86}; // search_log
87
88[[nodiscard]] std::filesystem::path basename_from_summary(
89 std::filesystem::path);
90[[nodiscard]] std::filesystem::path dynamic_from_basename(const std::string &);
91[[nodiscard]] std::filesystem::path layers_from_basename(const std::string &);
92[[nodiscard]] std::filesystem::path population_from_basename(
93 const std::string &);
94[[nodiscard]] std::filesystem::path summary_from_basename(
95 std::filesystem::path);
96
97#include "kernel/search_log.tcc"
98
99} // namespace ultra
100
101#endif // include guard
Definition distribution.h:36
Definition search_log.h:28
bool is_valid() const
Definition search_log.cc:65
std::filesystem::path population_file_path
Definition search_log.h:65
std::filesystem::path dynamic_file_path
Definition search_log.h:51
void save_snapshot(const P &, const summary< std::ranges::range_value_t< P >, F > &)
Definition search_log.h:155
std::filesystem::path base_dir
Definition search_log.h:46
std::filesystem::path summary_file_path
Definition search_log.h:70
std::filesystem::path layers_file_path
Definition search_log.h:57
Definition search_stats.h:44
Definition evolution_summary.h:33
Definition model_measurements.h:28