AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
mdp_heuristic_search.h
1#ifndef PROBFD_PLUGINS_SOLVERS_MDP_HEURISTIC_SEARCH_H
2#define PROBFD_PLUGINS_SOLVERS_MDP_HEURISTIC_SEARCH_H
3
4#include "downward/cli/plugins/plugin.h"
5
6#include "probfd/cli/naming_conventions.h"
7
8#include "mdp_solver.h"
9
10#include "probfd/solvers/mdp_heuristic_search.h"
11
12#include "probfd/bisimulation/types.h"
13
14#include <memory>
15#include <string>
16#include <type_traits>
17#include <utility>
18
20
21template <bool Bisimulation, bool Fret>
23 probfd::solvers::StateType<Bisimulation, Fret>,
24 probfd::solvers::ActionType<Bisimulation, Fret>>;
25
26template <bool Bisimulation, bool Fret>
27void add_mdp_hs_base_options_to_feature(
28 downward::cli::plugins::Feature& feature)
29{
30 feature.add_option<bool>(
31 "dual_bounds",
32 "Specifies whether the algorithm should use an upper-bounding value "
33 "function as well. In this case, convergence checks are made by "
34 "comparing whether the lower and upper bounding value functions are "
35 "epsilon-close to each other.",
36 "false");
37 feature.add_option<std::shared_ptr<PolicyPickerType<Bisimulation, Fret>>>(
38 "policy",
39 "The tie-breaking strategy to use when selecting a greedy policy.",
40 add_mdp_type_to_option<Bisimulation, Fret>(
41 "arbitrary_policy_tiebreaker()"));
42
43 add_base_solver_options_to_feature(feature);
44}
45
46template <bool Bisimulation, bool Fret>
47auto get_mdp_hs_base_args_from_options(
48 const downward::cli::plugins::Options& options)
49{
50 return std::tuple_cat(
51 std::make_tuple(
52 options.get<bool>("dual_bounds"),
53 options.get<std::shared_ptr<PolicyPickerType<Bisimulation, Fret>>>(
54 "policy")),
55 get_base_solver_args_from_options(options));
56}
57
58template <bool Bisimulation, bool Fret>
59void add_mdp_hs_options_to_feature(downward::cli::plugins::Feature& feature)
60{
61 if constexpr (Fret) {
62 feature.add_option<bool>(
63 "fret_on_policy",
64 "Whether FRET should be used on the greedy policy graph or on the "
65 "whole value graph.",
66 "true");
67 }
68
69 add_mdp_hs_base_options_to_feature<Bisimulation, Fret>(feature);
70}
71
72template <bool Bisimulation, bool Fret>
73auto get_mdp_hs_args_from_options(
74 const downward::cli::plugins::Options& options)
75{
76 if constexpr (Fret) {
77 return std::tuple_cat(
78 std::make_tuple(options.get<bool>("fret_on_policy")),
79 get_mdp_hs_base_args_from_options<Bisimulation, Fret>(options));
80 } else {
81 return get_mdp_hs_base_args_from_options<Bisimulation, Fret>(options);
82 }
83}
84
85} // namespace probfd::cli::solvers
86
87#endif
An strategy interface used to choose break ties between multiple greedy actions for a state.
Definition policy_picker.h:57
This namespace contains the solver plugins for various search algorithms.
Definition mdp_heuristic_search.h:19