19struct BisimulationTimer {
22 unsigned transitions = 0;
24 void print(std::ostream& out)
const;
27class BisimulationBasedHeuristicSearchAlgorithm :
public FDRMDPAlgorithm {
32 using QQState = quotients::QuotientState<QState, QAction>;
33 using QQAction = quotients::QuotientAction<QAction>;
35 const std::shared_ptr<ProbabilisticTask> task_;
36 const std::shared_ptr<FDRCostFunction> task_cost_function_;
38 const std::string algorithm_name_;
40 std::shared_ptr<MDPAlgorithm<QState, QAction>> algorithm_;
42 BisimulationTimer stats_;
45 BisimulationBasedHeuristicSearchAlgorithm(
46 std::shared_ptr<ProbabilisticTask> task,
47 std::shared_ptr<FDRCostFunction> task_cost_function,
48 std::string algorithm_name,
56 double max_time)
override;
58 std::unique_ptr<PolicyType> compute_policy(
63 double max_time)
override;
65 void print_statistics(std::ostream& out)
const override;
68 template <
typename,
typename,
bool>
72 static std::unique_ptr<BisimulationBasedHeuristicSearchAlgorithm> create(
73 std::shared_ptr<ProbabilisticTask> task,
74 std::shared_ptr<FDRCostFunction> task_cost_function,
75 std::string algorithm_name,
79 return std::make_unique<BisimulationBasedHeuristicSearchAlgorithm>(
81 std::move(task_cost_function),
82 std::move(algorithm_name),
83 std::make_shared<HS<QState, QAction, Interval>>(
85 std::forward<Args>(args)...));
89 template <
typename,
typename,
typename>
91 template <
typename,
typename,
bool>
95 static std::unique_ptr<BisimulationBasedHeuristicSearchAlgorithm> create(
96 std::shared_ptr<ProbabilisticTask> task,
97 std::shared_ptr<FDRCostFunction> task_cost_function,
98 std::string algorithm_name,
102 using StateInfoT =
typename HS<QQState, QQAction, Interval>::StateInfo;
103 return std::make_unique<BisimulationBasedHeuristicSearchAlgorithm>(
105 std::move(task_cost_function),
106 std::move(algorithm_name),
107 std::make_shared<Fret<QState, QAction, StateInfoT>>(
108 std::make_shared<HS<QQState, QQAction, Interval>>(
110 std::forward<Args>(args)...)));