AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
cegar.h
1#ifndef PDBS_CEGAR_H
2#define PDBS_CEGAR_H
3
4#include "downward/pdbs/pattern_collection_information.h"
5#include "downward/pdbs/pattern_database.h"
6#include "downward/pdbs/pattern_information.h"
7
8#include <memory>
9#include <vector>
10
11namespace utils {
12class LogProxy;
13class RandomNumberGenerator;
14} // namespace utils
15
16namespace pdbs {
17/*
18 This function implements the CEGAR algorithm for computing disjoint pattern
19 collections.
20
21 In a nutshell, it receives a concrete task plus a (sub)set of its goals in a
22 randomized order. Starting from the pattern collection consisting of a
23 singleton pattern for each goal variable, it repeatedly attempts to execute
24 an optimal plan of each pattern in the concrete task, collects reasons why
25 this is not possible (so-called flaws) and refines the pattern in question
26 by adding a variable to it.
27
28 Further parameters allow blacklisting a (sub)set of the non-goal variables
29 which are then never added to the collection, limiting PDB and collection
30 size, setting a time limit and switching between computing regular or
31 wildcard plans, where the latter are sequences of parallel operators
32 inducing the same abstract transition.
33*/
34extern PatternCollectionInformation generate_pattern_collection_with_cegar(
35 int max_pdb_size,
36 int max_collection_size,
37 double max_time,
38 bool use_wildcard_plans,
39 utils::LogProxy& log,
40 const std::shared_ptr<utils::RandomNumberGenerator>& rng,
41 const std::shared_ptr<AbstractTask>& task,
42 const std::vector<FactPair>& goals,
43 std::unordered_set<int>&& blacklisted_variables =
44 std::unordered_set<int>());
45
46/*
47 This function implements the CEGAR algorithm as described above, however
48 restricted to a single goal and therefore guaranteed to generate a single
49 pattern instead of a pattern collection.
50*/
51extern PatternInformation generate_pattern_with_cegar(
52 int max_pdb_size,
53 double max_time,
54 bool use_wildcard_plans,
55 utils::LogProxy& log,
56 const std::shared_ptr<utils::RandomNumberGenerator>& rng,
57 const std::shared_ptr<AbstractTask>& task,
58 const FactPair& goal,
59 std::unordered_set<int>&& blacklisted_variables =
60 std::unordered_set<int>());
61
62} // namespace pdbs
63
64#endif