1#ifndef PROBFD_PDBS_CEGAR_CEGAR_H
2#define PROBFD_PDBS_CEGAR_CEGAR_H
4#include "probfd/pdbs/types.h"
6#include "probfd/fdr_types.h"
7#include "probfd/value_type.h"
10#include <unordered_map>
11#include <unordered_set>
20class RandomNumberGenerator;
24class ProbabilisticTaskProxy;
27namespace probfd::pdbs::cegar {
29class FlawFindingStrategy;
32namespace probfd::pdbs::cegar {
35 std::unique_ptr<ProjectionCollection> projections;
36 std::unique_ptr<PPDBCollection> pdbs;
45 const std::shared_ptr<utils::RandomNumberGenerator> rng_;
48 const std::shared_ptr<FlawFindingStrategy> flaw_strategy_;
52 const int max_pdb_size_;
53 const int max_collection_size_;
55 const std::vector<int> goals_;
56 std::unordered_set<int> blacklisted_variables_;
59 std::vector<PDBInfo> pdb_infos_;
60 std::vector<PDBInfo>::iterator unsolved_end;
61 std::vector<PDBInfo>::iterator solved_end;
67 std::unordered_map<int, std::vector<PDBInfo>::iterator> variable_to_info_;
69 int remaining_size_ = max_collection_size_;
73 const std::shared_ptr<utils::RandomNumberGenerator>& rng,
74 std::shared_ptr<cegar::FlawFindingStrategy> flaw_strategy,
77 int max_collection_size,
78 std::vector<int> goals,
79 std::unordered_set<int> blacklisted_variables = {});
83 CEGARResult generate_pdbs(
84 ProbabilisticTaskProxy task_proxy,
85 const std::shared_ptr<FDRSimpleCostFunction>& task_cost_function,
90 void generate_trivial_solution_collection(
91 ProbabilisticTaskProxy task_proxy,
92 std::shared_ptr<FDRSimpleCostFunction> task_cost_function,
93 utils::CountdownTimer& timer,
96 std::vector<PDBInfo>::iterator get_flaws(
97 ProbabilisticTaskProxy task_proxy,
98 std::vector<Flaw>& flaws,
99 std::vector<int>& flaw_offsets,
100 utils::CountdownTimer& timer,
101 utils::LogProxy log);
103 bool can_add_variable_to_pattern(
104 const VariablesProxy& variables,
105 std::vector<PDBInfo>::iterator info_it,
108 bool can_merge_patterns(
109 std::vector<PDBInfo>::iterator info_it1,
110 std::vector<PDBInfo>::iterator info_it2)
const;
112 void add_pattern_for_var(
113 ProbabilisticTaskProxy task_proxy,
114 std::shared_ptr<FDRSimpleCostFunction> task_cost_function,
116 utils::CountdownTimer& timer);
118 void add_variable_to_pattern(
119 ProbabilisticTaskProxy task_proxy,
120 std::shared_ptr<FDRSimpleCostFunction> task_cost_function,
121 std::vector<PDBInfo>::iterator info_it,
123 utils::CountdownTimer& timer);
126 ProbabilisticTaskProxy task_proxy,
127 std::shared_ptr<FDRSimpleCostFunction> task_cost_function,
128 std::vector<PDBInfo>::iterator info_it1,
129 std::vector<PDBInfo>::iterator info_it2,
130 utils::CountdownTimer& timer);
133 ProbabilisticTaskProxy task_proxy,
134 const std::shared_ptr<FDRSimpleCostFunction>& task_cost_function,
135 const std::vector<Flaw>& flaws,
136 const std::vector<int>& flaw_offsets,
137 utils::CountdownTimer& timer,
138 utils::LogProxy log);
140 void print_collection(utils::LogProxy log)
const;
The top-level namespace of probabilistic Fast Downward.
Definition command_line.h:8