AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
policy.h
1#ifndef PROBFD_POLICY_H
2#define PROBFD_POLICY_H
3
4#include "probfd/multi_policy.h"
5
6#include <functional>
7#include <optional>
8#include <vector>
9
10namespace probfd {
11
23template <typename State, typename Action>
24class Policy : public MultiPolicy<State, Action> {
25public:
26 virtual ~Policy() = default;
27
30 virtual std::optional<PolicyDecision<Action>>
31 get_decision(const State& state) const = 0;
32
33 std::vector<PolicyDecision<Action>>
34 get_decisions(const State& state) const override
35 {
36 std::optional decision = this->get_decision(state);
37 std::vector<PolicyDecision<Action>> decisions;
38 if (decision) decisions.emplace_back(std::move(*decision));
39 return decisions;
40 }
41
42 virtual void print(
43 std::ostream& out,
44 std::function<void(const State&, std::ostream&)> state_printer,
45 std::function<void(const Action&, std::ostream&)> action_printer) = 0;
46};
47
48} // namespace probfd
49
50#endif
virtual std::optional< PolicyDecision< Action > > get_decision(const State &state) const =0
Retrives the action and optimal state value interval specified by the policy for a given state.
std::vector< PolicyDecision< Action > > get_decisions(const State &state) const override
Retrives the actions and their optimal state value intervals specified by the policy for a given stat...
Definition policy.h:34
The top-level namespace of probabilistic Fast Downward.
Definition command_line.h:8