AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
merge_strategy.h
1#ifndef MERGE_AND_SHRINK_MERGE_STRATEGY_H
2#define MERGE_AND_SHRINK_MERGE_STRATEGY_H
3
4#include <utility>
5
6namespace merge_and_shrink {
7class FactoredTransitionSystem;
8
9/*
10 A merge strategy dictates the order in which transition systems of the
11 factored transition system maintained by the merge-and-shrink heuristic
12 should be merged.
13
14 We distinguish three types of merge strategies: a stateless type, a
15 precomputed type, and a third unspecified type, which does not fit
16 either category.
17
18 Stateless merge strategies: they do not store any information and determine
19 the next merge soley based on the current factored transition system.
20
21 Precomputed merge strategies: they are represented in the form of a merge
22 tree (see class MergeTree). They return the next merge based on that
23 precomputed tree. This requires that the actual merge performed always
24 matches the one dictated by the precomputed strategy, i.e. it is mandatory
25 that the merge tree maintained by the precomputed strategy remains
26 synchronized with the current factored transition system.
27
28 Special merge strategies: these do not fit either of the other categories
29 and are usually a combination of existing stateless and/or precomputed merge
30 strategies. For example, the SCCs merge strategy (Sievers et al, ICAPS 2016)
31 needs to know which of the SCCs have been merged. While merging all variables
32 within an SCC, it makes use of a stateless merge strategy or a merge tree,
33 until that SCC has been entirely processed. There is currently no such merge
34 strategy in the Fast Downward repository.
35
36 NOTE: While stateless merge strategies have full control over the merge
37 order, this is not true for the specific implementation of merge tree,
38 because we always perform the next "left-most" merge in the merge tree.
39 See also the documentation in merge_tree.h.
40*/
41class MergeStrategy {
42protected:
43 const FactoredTransitionSystem &fts;
44public:
45 explicit MergeStrategy(const FactoredTransitionSystem &fts);
46 virtual ~MergeStrategy() = default;
47 virtual std::pair<int, int> get_next() = 0;
48};
49}
50
51#endif