AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
utils.h
1#ifndef PDBS_UTILS_H
2#define PDBS_UTILS_H
3
4#include "downward/pdbs/types.h"
5
6#include "downward/task_proxy.h"
7
8#include "downward/utils/timer.h"
9
10#include <memory>
11#include <string>
12
13namespace utils {
14class LogProxy;
15class RandomNumberGenerator;
16} // namespace utils
17
18namespace pdbs {
19class PatternCollectionInformation;
20class PatternInformation;
21
22extern int
23compute_pdb_size(const TaskProxy& task_proxy, const Pattern& pattern);
24extern int compute_total_pdb_size(
25 const TaskProxy& task_proxy,
26 const PatternCollection& pattern_collection);
27
28extern std::vector<FactPair> get_goals_in_random_order(
29 const TaskProxy& task_proxy,
30 utils::RandomNumberGenerator& rng);
31extern std::vector<int> get_non_goal_variables(const TaskProxy& task_proxy);
32
33/*
34 Compute the causal graph neighbors for each variable of the task. If
35 bidirectional is false, then only predecessors of variables are considered
36 neighbors. If bidirectional is true, then the causal graph is treated as
37 undirected graph and also successors of variables are considered neighbors.
38*/
39extern std::vector<std::vector<int>> compute_cg_neighbors(
40 const std::shared_ptr<AbstractTask>& task,
41 bool bidirectional);
42
43extern PatternCollectionInformation get_pattern_collection_info(
44 const TaskProxy& task_proxy,
45 const std::shared_ptr<PDBCollection>& pdbs,
46 utils::LogProxy& log);
47
48/*
49 Dump the given pattern, the number of variables contained, the size of the
50 corresponding PDB, and the runtime used for computing it. All output is
51 prepended with the given string identifier.
52*/
53extern void dump_pattern_generation_statistics(
54 const std::string& identifier,
55 utils::Duration runtime,
56 const PatternInformation& pattern_info,
57 utils::LogProxy& log);
58
59/*
60 Compute and dump the number of patterns, the total size of the corresponding
61 PDBs, and the runtime used for computing the collection. All output is
62 prepended with the given string identifier.
63*/
64extern void dump_pattern_collection_generation_statistics(
65 const std::string& identifier,
66 utils::Duration runtime,
67 const PatternCollectionInformation& pci,
68 utils::LogProxy& log);
69
70} // namespace pdbs
71
72#endif