AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
task_state_space.h
1#ifndef PROBFD_TASK_STATE_SPACE_H
2#define PROBFD_TASK_STATE_SPACE_H
3
4#include "probfd/task_utils/probabilistic_successor_generator.h"
5
6#include "probfd/fdr_types.h"
7#include "probfd/mdp.h"
8#include "probfd/task_proxy.h"
9#include "probfd/types.h"
10#include "probfd/value_type.h"
11
12#include "downward/utils/logging.h"
13
14#include "downward/state_registry.h"
15#include "downward/task_proxy.h"
16
17#include <cstddef>
18#include <memory>
19#include <vector>
20
21// Forward Declarations
22class OperatorID;
23class Evaluator;
24
25namespace probfd {
26template <typename>
29} // namespace probfd
30
31namespace probfd {
32
33class TaskStateSpace : public FDRStateSpace {
34protected:
35 struct Statistics {
36 unsigned long long single_transition_generator_calls = 0;
37 unsigned long long all_transitions_generator_calls = 0;
38 unsigned long long aops_generator_calls = 0;
39
40 unsigned long long generated_operators = 0;
41 unsigned long long generated_states = 0;
42
43 unsigned long long aops_computations = 0;
44 unsigned long long computed_operators = 0;
45
46 unsigned long long transition_computations = 0;
47 unsigned long long computed_successors = 0;
48
49 void print(utils::LogProxy log) const;
50 };
51
52protected:
53 ProbabilisticTaskProxy task_proxy_;
54 mutable utils::LogProxy log_;
55
56 StateRegistry state_registry_;
57 successor_generator::ProbabilisticSuccessorGenerator gen_;
58
59 const std::vector<std::shared_ptr<::Evaluator>> notify_;
60
61 Statistics statistics_;
62
63public:
64 TaskStateSpace(
65 std::shared_ptr<ProbabilisticTask> task,
66 utils::LogProxy log,
67 std::vector<std::shared_ptr<::Evaluator>> path_dependent_evaluators =
68 {});
69
70 StateID get_state_id(const State& state) final;
71 State get_state(StateID state_id) final;
72
73 void generate_applicable_actions(
74 const State& state,
75 std::vector<OperatorID>& result) override;
76
77 void generate_action_transitions(
78 const State& state,
79 OperatorID operator_id,
80 Distribution<StateID>& result) override;
81
82 void generate_all_transitions(
83 const State& state,
84 std::vector<OperatorID>& aops,
85 std::vector<Distribution<StateID>>& successors) override;
86
87 void generate_all_transitions(
88 const State& state,
89 std::vector<TransitionType>& transitions) override;
90
91 const State& get_initial_state();
92
93 size_t get_num_registered_states() const;
94
95 virtual void print_statistics() const;
96
97 void compute_successor_dist(
98 const State& s,
99 OperatorID op_id,
100 Distribution<StateID>& successors);
101
102protected:
103 void
104 compute_applicable_operators(const State& s, std::vector<OperatorID>& ops);
105};
106
107} // namespace probfd
108
109#endif // PROBFD_TASK_STATE_SPACE_H
A convenience class that represents a finite probability distribution.
Definition task_state_space.h:27
Represents a probabilistic planning task with axioms and conditional effects.
Definition probabilistic_task.h:19
An interface representing a Markov Decision Process (MDP) without objective function.
Definition state_space.h:44
The top-level namespace of probabilistic Fast Downward.
Definition command_line.h:8