1#ifndef PROBFD_ALGORITHMS_LRTDP_H
2#define PROBFD_ALGORITHMS_LRTDP_H
4#include "probfd/algorithms/heuristic_search_base.h"
15class SuccessorSampler;
49 unsigned long long trials = 0;
50 unsigned long long trial_bellman_backups = 0;
51 unsigned long long check_and_solve_bellman_backups = 0;
53 void print(std::ostream& out)
const;
56template <
typename Action,
bool UseInterval>
57struct PerStateInformation
58 :
public heuristic_search::
59 PerStateBaseInformation<Action, true, UseInterval> {
61 using Base =
typename heuristic_search::PerStateBaseInformation<Action, true, UseInterval>;
64 static constexpr uint8_t VISITED = 0b01 << Base::BITS;
65 static constexpr uint8_t SOLVED = 0b10 << Base::BITS;
66 static constexpr uint8_t BITS = Base::BITS + 2;
67 static constexpr uint8_t MASK = 0b11 << Base::BITS;
69 bool is_solved()
const
71 return this->info & SOLVED || this->is_goal_or_terminal();
74 void mark_solved() { this->info |= SOLVED; }
76 bool is_closed()
const {
return (this->info & VISITED) != 0; }
81 this->info |= VISITED;
87 this->info &= ~VISITED;
90 void clear() { this->info &= ~MASK; }
124template <
typename State,
typename Action,
bool UseInterval>
129 internal::PerStateInformation<Action, UseInterval>> {
130 using Base =
typename LRTDP::FRETHeuristicSearchAlgorithm;
132 using AlgorithmValueType = Base::AlgorithmValueType;
135 using StateInfo =
typename Base::StateInfo;
138 using MDPType =
typename Base::MDPType;
139 using EvaluatorType =
typename Base::EvaluatorType;
140 using PolicyPickerType =
typename Base::PolicyPicker;
144 using Statistics = internal::Statistics;
148 const std::shared_ptr<SuccessorSamplerType> sample_;
151 std::vector<StateID> current_trial_;
152 std::vector<StateID> policy_queue_;
153 std::deque<StateID> visited_;
155 Statistics statistics_;
158 std::vector<Transition<Action>> transitions_;
159 std::vector<AlgorithmValueType> qvalues_;
166 std::shared_ptr<PolicyPickerType> policy_chooser,
168 std::shared_ptr<SuccessorSamplerType> succ_sampler);
175 EvaluatorType& heuristic,
178 double max_time)
override;
185 EvaluatorType& heuristic,
187 utils::CountdownTimer& timer);
189 bool check_and_solve(
191 EvaluatorType& heuristic,
193 utils::CountdownTimer& timer);
198#define GUARD_INCLUDE_PROBFD_ALGORITHMS_LRTDP_H
199#include "probfd/algorithms/lrtdp_impl.h"
200#undef GUARD_INCLUDE_PROBFD_ALGORITHMS_LRTDP_H
A registry for print functions related to search progress.
Definition progress_report.h:33
Heuristics search algorithm that can be used within FRET.
Definition heuristic_search_base.h:368
Implements the labelled real-time dynamic programming (LRTDP) algorithm bonet:geffner:icaps-03.
Definition lrtdp.h:129
LRTDP(std::shared_ptr< PolicyPickerType > policy_chooser, TrialTerminationCondition stop_consistent, std::shared_ptr< SuccessorSamplerType > succ_sampler)
Constructs an LRTDP solver object.
Definition lrtdp_impl.h:27
void print_additional_statistics(std::ostream &out) const override
Prints additional statistics to the output stream.
Definition lrtdp_impl.h:73
void reset_search_state() override
Resets the h search algorithm object to a clean state.
Definition lrtdp_impl.h:38
Namespace dedicated to labelled real-time dynamic programming (LRTDP).
Definition lrtdp.h:19
TrialTerminationCondition
Enumeration type specifying the termination condition for trials sampled during LRTDP.
Definition lrtdp.h:25
This namespace contains implementations of SSP search algorithms.
Definition acyclic_value_iteration.h:22
typename std::conditional_t< is_cheap_to_copy_v< T >, T, const T & > param_type
Alias template defining the best way to pass a parameter of a given type.
Definition type_traits.h:25
Represents a closed interval over the extended reals as a pair of lower and upper bound.
Definition interval.h:12
A StateID represents a state within a StateIDMap. Just like Fast Downward's StateID type,...
Definition types.h:22