69 using Base =
typename TopologicalValueIteration::MDPAlgorithm;
71 using PolicyType =
typename Base::PolicyType;
72 using MDPType =
typename Base::MDPType;
73 using EvaluatorType =
typename Base::EvaluatorType;
75 using MapPolicy = policies::MapPolicy<State, Action>;
80 enum { NEW, CLOSED, ONSTACK };
82 unsigned stack_id = 0;
93 AlgorithmValueType conv_part;
97 std::vector<ItemProbabilityPair<AlgorithmValueType*>> nconv_successors;
99 QValueInfo(Action action,
value_t action_cost);
101 bool finalize_transition(
value_t self_loop_prob);
103 AlgorithmValueType compute_q_value()
const;
110 AlgorithmValueType* value;
114 AlgorithmValueType conv_part;
117 std::vector<QValueInfo> nconv_qs;
120 std::optional<Action> best_action = std::nullopt;
123 std::optional<Action> best_converged = std::nullopt;
125 StackInfo(
StateID state_id, AlgorithmValueType& value_ref);
130 struct ExplorationInfo {
132 std::vector<Action> aops;
134 Distribution<StateID>::const_iterator successor;
139 StackInfo& stack_info;
148 StackInfo& stack_info,
151 void update_lowlink(
unsigned upd);
153 bool next_transition(MDPType& mdp);
154 bool next_successor();
156 bool forward_non_loop_transition(MDPType& mdp,
const State& state);
157 bool forward_non_loop_successor();
159 Action& get_current_action();
163 using StackIterator =
typename std::vector<StackInfo>::iterator;
166 const bool expand_goals_;
169 storage::PerStateStorage<StateInfo> state_information_;
170 std::deque<ExplorationInfo> exploration_stack_;
171 std::vector<StackInfo> stack_;
178 std::unique_ptr<PolicyType> compute_policy(
180 EvaluatorType& heuristic,
183 double max_time)
override;
187 EvaluatorType& heuristic,
190 double max_time)
override;
207 template <
typename ValueStore>
210 EvaluatorType& heuristic,
212 ValueStore& value_store,
213 double max_time = std::numeric_limits<double>::infinity(),
214 MapPolicy* policy =
nullptr);
224 StateInfo& state_info,
225 AlgorithmValueType& state_value);
232 bool initialize_state(
234 EvaluatorType& heuristic,
235 ExplorationInfo& exp_info,
246 template <
typename ValueStore>
249 ExplorationInfo& explore,
250 ValueStore& value_store,
251 utils::CountdownTimer& timer);
256 void scc_found(
auto scc, MapPolicy* policy, utils::CountdownTimer& timer);