AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
mdp_solver.h
1#ifndef PROBFD_SOLVERS_MDP_SOLVER_H
2#define PROBFD_SOLVERS_MDP_SOLVER_H
3
4#include "probfd/solver_interface.h" // IWYU pragma: export
5
6#include "probfd/fdr_types.h"
7#include "probfd/progress_report.h"
8#include "probfd/task_proxy.h"
9#include "probfd/task_state_space.h"
10
11#include "downward/utils/logging.h"
12
13#include <memory>
14#include <string>
15
16// Forward Declarations
17namespace probfd {
18class ProbabilisticTask;
19class TaskCostFunctionFactory;
20class TaskEvaluatorFactory;
21} // namespace probfd
22
25namespace probfd::solvers {
26
30class MDPSolver : public SolverInterface {
31 mutable utils::LogProxy log_;
32
33protected:
34 const std::shared_ptr<ProbabilisticTask> task_;
35
36 const std::unique_ptr<TaskStateSpace> task_mdp_;
37 const std::shared_ptr<FDRCostFunction> task_cost_function_;
38
39private:
40 const std::shared_ptr<TaskEvaluatorFactory> heuristic_factory_;
41
42 ProgressReport progress_;
43
44 const double max_time_;
45 const std::string policy_filename;
46 const bool print_fact_names;
47
48public:
53 utils::Verbosity verbosity,
54 std::vector<std::shared_ptr<::Evaluator>> path_dependent_evaluators,
55 bool cache,
56 std::shared_ptr<TaskEvaluatorFactory> heuristic_factory,
57 std::optional<value_t> report_epsilon,
58 bool report_enabled,
59 double max_time,
60 std::string policy_filename,
61 bool print_fact_names);
62
63 ~MDPSolver() override;
64
68 virtual std::unique_ptr<FDRMDPAlgorithm> create_algorithm() = 0;
69
73 virtual std::string get_algorithm_name() const = 0;
74
78 virtual void print_additional_statistics() const {}
79
83 bool solve() override;
84};
85
86} // namespace probfd::solvers
87
88#endif // PROBFD_SOLVERS_MDP_SOLVER_H
A registry for print functions related to search progress.
Definition progress_report.h:33
An interface that describes an MDP solver.
Definition solver_interface.h:28
Base interface for MDP solvers.
Definition mdp_solver.h:30
bool solve() override
Runs the encapsulated MDP on the global problem.
virtual std::unique_ptr< FDRMDPAlgorithm > create_algorithm()=0
Factory method a new instance of the encapsulated MDP algorithm.
MDPSolver(utils::Verbosity verbosity, std::vector< std::shared_ptr<::Evaluator > > path_dependent_evaluators, bool cache, std::shared_ptr< TaskEvaluatorFactory > heuristic_factory, std::optional< value_t > report_epsilon, bool report_enabled, double max_time, std::string policy_filename, bool print_fact_names)
Constructs the MDP solver from the given arguments.
virtual void print_additional_statistics() const
Print additional algorithm statistics to std::cout.
Definition mdp_solver.h:78
virtual std::string get_algorithm_name() const =0
Returns the name of the encapsulated MDP algorithm.
This namespace contains the solver interface base class for various search algorithms.
Definition bisimulation_heuristic_search_algorithm.h:17
The top-level namespace of probabilistic Fast Downward.
Definition command_line.h:8