1#ifndef PROBFD_ALGORITHMS_I2DUAL_H
2#define PROBFD_ALGORITHMS_I2DUAL_H
4#include "probfd/storage/per_state_storage.h"
6#include "probfd/distribution.h"
7#include "probfd/fdr_types.h"
8#include "probfd/mdp_algorithm.h"
9#include "probfd/task_proxy.h"
10#include "probfd/value_type.h"
12#include "downward/lp/lp_solver.h"
14#include "downward/utils/timer.h"
26namespace probfd::algorithms::i2dual {
28class I2Dual :
public MDPAlgorithm<State, OperatorID> {
32 utils::Timer idual_timer = utils::Timer(
true);
33 utils::Timer lp_solver_timer = utils::Timer(
true);
34 utils::Timer hpom_timer = utils::Timer(
true);
36 unsigned long long iterations = 0;
37 unsigned long long expansions = 0;
38 unsigned long long open_states = 0;
39 unsigned long long num_lp_vars = 0;
40 unsigned long long num_lp_constraints = 0;
41 unsigned long long hpom_num_vars = 0;
42 unsigned long long hpom_num_constraints = 0;
44 void print(std::ostream& out)
const;
47 ProbabilisticTaskProxy task_proxy_;
48 std::shared_ptr<FDRCostFunction> task_cost_function_;
50 const bool hpom_enabled_;
51 const bool incremental_hpom_updates_;
53 lp::LPSolver lp_solver_;
55 size_t next_lp_var_ = 0;
56 size_t next_lp_constr_id_ = 0;
58 bool hpom_initialized_ =
false;
59 std::vector<int> offset_;
60 named_vector::NamedVector<lp::LPConstraint> hpom_constraints_;
62 Statistics statistics_;
66 std::vector<OperatorID> aops_;
67 Distribution<StateID> succs_;
71 std::shared_ptr<ProbabilisticTask> task,
72 std::shared_ptr<FDRCostFunction> task_cost_function,
74 bool incremental_updates,
75 lp::LPSolverType solver_type);
77 void print_statistics(std::ostream& out)
const override;
82 const State& initial_state,
83 ProgressReport progress,
84 double max_time)
override;
86 std::unique_ptr<PolicyType> compute_policy(
88 EvaluatorType& heuristic,
89 const State& initial_state,
90 ProgressReport progress,
91 double max_time)
override;
102 void prepare_hpom(lp::LinearProgram& lp);
104 void update_hpom_constraints_expanded(
106 storage::PerStateStorage<IDualData>& data,
107 const std::vector<StateID>& expanded);
109 void update_hpom_constraints_frontier(
111 storage::PerStateStorage<IDualData>& data,
112 const std::vector<StateID>& frontier,
115 void remove_fringe_state_from_hpom(
117 const IDualData& data,
118 named_vector::NamedVector<lp::LPConstraint>& constraints)
const;
120 void add_fringe_state_to_hpom(
122 const IDualData& data,
123 named_vector::NamedVector<lp::LPConstraint>& constraints)
const;
The top-level namespace of probabilistic Fast Downward.
Definition command_line.h:8
MDP< State, OperatorID > FDRMDP
Type alias for MDPs with states in FDR.
Definition fdr_types.h:42
Evaluator< State > FDREvaluator
Type alias for evaluators for states in FDR.
Definition fdr_types.h:48
double value_t
Typedef for the state value type.
Definition aliases.h:7