AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
landmark_heuristic.h
1#ifndef LANDMARKS_LANDMARK_HEURISTIC_H
2#define LANDMARKS_LANDMARK_HEURISTIC_H
3
4#include "downward/heuristic.h"
5
6class ConstBitsetView;
7
8namespace successor_generator {
9class SuccessorGenerator;
10}
11
12namespace landmarks {
13class LandmarkFactory;
14class LandmarkGraph;
15class LandmarkNode;
16class LandmarkStatusManager;
17
18class LandmarkHeuristic : public Heuristic {
19 bool initial_landmark_graph_has_cycle_of_natural_orderings;
20
21 /* TODO: We would prefer the following two functions to be implemented
22 somewhere else as more generic graph algorithms. */
23 bool landmark_graph_has_cycle_of_natural_orderings();
24 bool depth_first_search_for_cycle_of_natural_orderings(
25 const LandmarkNode& node,
26 std::vector<bool>& closed,
27 std::vector<bool>& visited);
28
29protected:
30 std::shared_ptr<LandmarkGraph> lm_graph;
31 const bool use_preferred_operators;
32
33 std::unique_ptr<LandmarkStatusManager> lm_status_manager;
34 std::unique_ptr<successor_generator::SuccessorGenerator>
35 successor_generator;
36
37 void initialize(
38 const std::shared_ptr<LandmarkFactory>& lm_factory,
39 bool prog_goal,
40 bool prog_gn,
41 bool prog_r);
42 void
43 compute_landmark_graph(const std::shared_ptr<LandmarkFactory>& lm_factory);
44
45 virtual int get_heuristic_value(const State& ancestor_state) = 0;
46
47 void
48 generate_preferred_operators(const State& state, ConstBitsetView& future);
49 virtual int compute_heuristic(const State& ancestor_state) override;
50
51public:
52 LandmarkHeuristic(
53 bool use_preferred_operators,
54 const std::shared_ptr<AbstractTask>& transform,
55 bool cache_estimates,
56 const std::string& description,
57 utils::Verbosity verbosity);
58
59 ~LandmarkHeuristic() override;
60
61 virtual void
62 get_path_dependent_evaluators(std::set<Evaluator*>& evals) override
63 {
64 evals.insert(this);
65 }
66
67 virtual void notify_initial_state(const State& initial_state) override;
68 virtual void notify_state_transition(
69 const State& parent_state,
70 OperatorID op_id,
71 const State& state) override;
72};
73
74} // namespace landmarks
75
76#endif