AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
progress_report.h
1#ifndef PROBFD_PROGRESS_REPORT_H
2#define PROBFD_PROGRESS_REPORT_H
3
4#include "probfd/interval.h"
5#include "probfd/value_type.h"
6
7#include <functional>
8#include <iostream>
9#include <optional>
10#include <string>
11#include <vector>
12
13namespace probfd {
14
16using Printer = std::function<void(std::ostream&)>;
17
19using BoundProperty = std::function<Interval()>;
20
34 struct BoundPropertyInfo {
35 std::string name;
36 BoundProperty property;
37 std::optional<Interval> last_printed = std::nullopt;
38 };
39
40 const std::optional<value_t> tolerance_;
41 bool enabled_;
42 std::ostream& out_;
43
44 std::vector<BoundPropertyInfo> bound_infos_;
45 std::vector<Printer> additional_informations_;
46
47public:
58 std::optional<value_t> tolerance = std::nullopt,
59 std::ostream& out = std::cout,
60 bool enabled = true);
61
62 ~ProgressReport() = default;
63
69
76 void print();
77
81 void enable();
82
86 void disable();
87
92
97 void
98 register_bound(const std::string& property_name, BoundProperty property);
99
100private:
101 void print_progress();
102 bool advance_values(bool force = false);
103};
104
105} // namespace probfd
106
107#endif // PROBFD_PROGRESS_REPORT_H
A registry for print functions related to search progress.
Definition progress_report.h:33
void force_print()
Prints the output to the internal output stream, even if disabled and a bound change tolerance is set...
void print()
Prints the output to the internal output stream, if enabled.
void enable()
Enables printing.
void register_bound(const std::string &property_name, BoundProperty property)
Appends a new bound property with a given name to the list of bound properties to be printed when the...
void disable()
Disables printing.
void register_print(Printer f)
Appends a new printer to the list of printers.
ProgressReport(std::optional< value_t > tolerance=std::nullopt, std::ostream &out=std::cout, bool enabled=true)
Construct a new progress report.
The top-level namespace of probabilistic Fast Downward.
Definition command_line.h:8
std::function< Interval()> BoundProperty
A function that produces a state value bound.
Definition progress_report.h:19
std::function< void(std::ostream &)> Printer
A function that prints something to an output stream.
Definition progress_report.h:16
Represents a closed interval over the extended reals as a pair of lower and upper bound.
Definition interval.h:12