AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
combining_evaluator.h
1#ifndef EVALUATORS_COMBINING_EVALUATOR_H
2#define EVALUATORS_COMBINING_EVALUATOR_H
3
4#include "downward/evaluator.h"
5
6#include <memory>
7#include <set>
8#include <string>
9#include <vector>
10
11namespace combining_evaluator {
12/*
13 CombiningEvaluator is the base class for SumEvaluator and
14 MaxEvaluator, which captures the common aspects of their behaviour.
15*/
16class CombiningEvaluator : public Evaluator {
17 std::vector<std::shared_ptr<Evaluator>> subevaluators;
18 bool all_dead_ends_are_reliable;
19
20protected:
21 virtual int combine_values(const std::vector<int>& values) = 0;
22
23public:
24 CombiningEvaluator(
25 const std::vector<std::shared_ptr<Evaluator>>& evals,
26 const std::string& description,
27 utils::Verbosity verbosity);
28
29 /*
30 Note: dead_ends_are_reliable() is a state-independent method, so
31 it only returns true if all subevaluators report dead ends reliably.
32
33 Note that we could get more fine-grained information when
34 considering of reliability for a given evaluated state. For
35 example, if we use h1 (unreliable) and h2 (reliable) and have a
36 state where h1 is finite and h2 is infinite, then we can
37 *reliably* mark the state as a dead end. There is currently no
38 way to exploit such state-based information, and hence we do not
39 compute it.
40 */
41
42 virtual bool dead_ends_are_reliable() const override;
43 virtual EvaluationResult
44 compute_result(EvaluationContext& eval_context) override;
45
46 virtual void
47 get_path_dependent_evaluators(std::set<Evaluator*>& evals) override;
48};
49
50} // namespace combining_evaluator
51
52#endif