AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
distances_impl.h
1#ifndef GUARD_INCLUDE_PROBFD_ABSTRACTIONS_DISTANCES_H
2#error "This file should only be included from distances.h"
3#endif
4
5#include "probfd/algorithms/ta_topological_value_iteration.h"
6
7#include "probfd/pdbs/projection_operator.h"
8#include "probfd/pdbs/projection_state_space.h"
9
10#include "probfd/evaluator.h"
11
12#include "downward/utils/countdown_timer.h"
13
14#if !defined(NDEBUG) && (defined(HAS_CPLEX) || defined(HAS_SOPLEX))
15#include "downward/lp/lp_solver.h"
16#include "probfd/abstractions/verification.h"
17#endif
18
19namespace probfd {
20
21template <typename State, typename Action>
24 param_type<State> initial_state,
25 const Evaluator<State>& heuristic,
26 std::span<value_t> value_table,
27 double max_time)
28{
29 using namespace algorithms::ta_topological_vi;
30
31 utils::CountdownTimer timer(max_time);
32
33 TATopologicalValueIteration<State, Action> vi(value_table.size());
34 vi.solve(
35 mdp,
36 heuristic,
37 initial_state,
38 value_table,
39 timer.get_remaining_time());
40
41#if !defined(NDEBUG) && (defined(HAS_CPLEX) || defined(HAS_SOPLEX))
42 lp::LPSolverType lp_solver_type;
43#if defined(HAS_CPLEX)
44 lp_solver_type = lp::LPSolverType::CPLEX;
45#else
46 // lp_solver_type = lp::LPSolverType::SOPLEX;
47#endif
48 verify(mdp, value_table, lp_solver_type);
49#endif
50}
51
52} // namespace probfd
The interface representing heuristic functions.
Definition mdp_algorithm.h:16
Basic interface for MDPs.
Definition mdp_algorithm.h:14
The top-level namespace of probabilistic Fast Downward.
Definition command_line.h:8
void compute_value_table(MDP< State, Action > &mdp, param_type< State > initial_state, const Evaluator< State > &heuristic, std::span< value_t > value_table, double max_time=std::numeric_limits< double >::infinity())
Computes the optimal value function of the abstraction, complete up to forward reachability from the ...
Definition distances_impl.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
void verify(MDP< State, Action > &mdp, std::span< const value_t > value_table, lp::LPSolverType type)
Computes the optimal value function of the abstraction, complete up to forward reachability from the ...
Definition verification_impl.h:18