AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
|
#include "probfd/progress_report.h"
A registry for print functions related to search progress.
This class manages a list of printers (functions accepting an output stream) as well as a list of named bound properties (functions returning a bounding interval for some quantity, e.g. the optimal state value of the initial state).
The bound properties are printed before the out of the registered printers. Within these groups, the output is printed in a FIFO manner, i.e. the printer that was registered first is also printed first.
Public Member Functions | |
ProgressReport (std::optional< value_t > tolerance=std::nullopt, std::ostream &out=std::cout, bool enabled=true) | |
Construct a new progress report. | |
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 | disable () |
Disables printing. | |
void | register_print (Printer f) |
Appends a new printer to the list of printers. | |
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 report is advanced. | |
|
explicit |
Construct a new progress report.
tolerance | - An optional tolerance for bound property changes. If no bound property changes by more than this value (lower or upper bound), no output is produced. |
out | - The output stream to direct the output to. |
enabled | - Whether printing is enabled or not. |
void probfd::ProgressReport::force_print | ( | ) |
Prints the output to the internal output stream, even if disabled and a bound change tolerance is set.
void probfd::ProgressReport::print | ( | ) |
Prints the output to the internal output stream, if enabled.
If a bound change tolerance is set, only prints if any lower or upper bound of any bound property changed by more than the specified tolerance.
void probfd::ProgressReport::enable | ( | ) |
Enables printing.
void probfd::ProgressReport::disable | ( | ) |
Disables printing.
void probfd::ProgressReport::register_print | ( | Printer | f | ) |
Appends a new printer to the list of printers.
void probfd::ProgressReport::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 report is advanced.