AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
probfd::ProgressReport Class Reference

#include "probfd/progress_report.h"

Description

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.
 

Constructor & Destructor Documentation

◆ ProgressReport()

probfd::ProgressReport::ProgressReport ( std::optional< value_t > tolerance = std::nullopt,
std::ostream & out = std::cout,
bool enabled = true )
explicit

Construct a new progress report.

Parameters
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.

Member Function Documentation

◆ force_print()

void probfd::ProgressReport::force_print ( )

Prints the output to the internal output stream, even if disabled and a bound change tolerance is set.

◆ print()

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.

◆ enable()

void probfd::ProgressReport::enable ( )

Enables printing.

◆ disable()

void probfd::ProgressReport::disable ( )

Disables printing.

◆ register_print()

void probfd::ProgressReport::register_print ( Printer f)

Appends a new printer to the list of printers.

◆ register_bound()

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.