AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
search_progress.h
1#ifndef SEARCH_PROGRESS_H
2#define SEARCH_PROGRESS_H
3
4#include <unordered_map>
5
6class EvaluationContext;
7class Evaluator;
8
9namespace utils {
10class LogProxy;
11}
12
13/*
14 This class helps track search progress.
15
16 Evaluators can be configured to be used for reporting new minima, boosting
17 open lists, or both. This class maintains a record of minimum evaluator
18 values for evaluators that are used for either of these two things.
19*/
20
21
22class SearchProgress {
23 std::unordered_map<const Evaluator *, int> min_values;
24
25 bool process_evaluator_value(const Evaluator *evaluator, int value);
26
27public:
28 SearchProgress() = default;
29 ~SearchProgress() = default;
30
31 /*
32 Call the following function after each state evaluation.
33
34 It returns true if the evaluation context contains a new minimum value
35 for at least one evaluator used for boosting.
36
37 It also prints one line of output for all evaluators used for reporting
38 minima that have a new minimum value in the given evaluation context.
39
40 In both cases this includes the situation where the evaluator in question
41 has not been evaluated previously, e.g., after evaluating the initial
42 state.
43 */
44 bool check_progress(const EvaluationContext &eval_context);
45};
46
47#endif