AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
projection_operator.h
1#ifndef PROBFD_PDBS_PROJECTION_OPERATOR_H
2#define PROBFD_PDBS_PROJECTION_OPERATOR_H
3
4#include "probfd/distribution.h"
5#include "probfd/task_proxy.h"
6
7#include "downward/operator_id.h"
8
9#include <ranges>
10#include <string>
11
13namespace probfd::pdbs {
14
19 friend class ProjectionStateSpace;
20
21public:
23 OperatorID operator_id;
24
25private:
26 // Implementation detail. Like in the classical implementation, each
27 // operator is applicable in exactly one state. The successor states are
28 // computed by adding an offset to the source state rank (t = s + offset).
29 // The distribution contains these offsets.
30 Distribution<int> outcome_offsets_;
31
32public:
33 template <std::ranges::input_range R>
34 requires(std::convertible_to<
35 std::ranges::range_reference_t<R>,
37 explicit ProjectionOperator(OperatorID id, R&& distr)
38 : operator_id(id)
39 , outcome_offsets_(std::from_range, std::forward<R>(distr))
40 {
41 }
42
43 template <std::ranges::input_range R>
44 requires(std::convertible_to<
45 std::ranges::range_reference_t<R>,
47 explicit ProjectionOperator(OperatorID id, R&& distr, no_normalize_t)
48 : operator_id(id)
49 , outcome_offsets_(
50 std::from_range,
52 std::forward<R>(distr))
53 {
54 }
55
56 friend bool are_equivalent(
57 const ProjectionOperator& left,
58 const ProjectionOperator& right)
59 {
60 return left.outcome_offsets_ == right.outcome_offsets_;
61 }
62};
63
68 ProbabilisticTaskProxy task_proxy_;
69
70public:
72 std::string operator()(const ProjectionOperator* op) const;
73};
74
75} // namespace probfd::pdbs
76
77#endif // PROBFD_PDBS_PROJECTION_OPERATOR_H
A convenience class that represents a finite probability distribution.
Definition task_state_space.h:27
An item-probability pair.
Definition distribution.h:20
Proxy class used to inspect a probabilistic planning task.
Definition task_proxy.h:194
Represents an operator of a projection state space.
Definition projection_operator.h:18
OperatorID operator_id
The operator ID of the task-level operator inducing this operator.
Definition projection_operator.h:23
Helper class to convert projection operators to strings.
Definition projection_operator.h:67
Represents the state space of a projection of a probabilistic planning task.
Definition projection_state_space.h:29
Namespace dedicated to probabilistic pattern databases.
Definition gzocp_heuristic.h:16
constexpr no_normalize_t no_normalize
Disambiguator tag for Distribution constructor to indicate that the probabilities are already normali...
Definition distribution.h:146
Disambiguator tag type.
Definition distribution.h:142