AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
shrink_fh.h
1#ifndef MERGE_AND_SHRINK_SHRINK_FH_H
2#define MERGE_AND_SHRINK_SHRINK_FH_H
3
4#include "downward/merge_and_shrink/shrink_bucket_based.h"
5
6#include <vector>
7
8namespace merge_and_shrink {
9/*
10 NOTE: In case where we must merge across buckets (i.e. when
11 the number of (f, h) pairs is larger than the number of
12 permitted abstract states), this shrink strategy will *not* make
13 an effort to be at least be h-preserving.
14
15 This could be improved, but not without complicating the code.
16 Usually we set the number of abstract states large enough that we
17 do not need to merge across buckets. Therefore the complication
18 might not be worth the code maintenance cost.
19*/
20class ShrinkFH : public ShrinkBucketBased {
21public:
22 enum class HighLow { HIGH, LOW };
23
24private:
25 const HighLow f_start;
26 const HighLow h_start;
27
28 std::vector<Bucket> ordered_buckets_use_vector(
29 const TransitionSystem& ts,
30 const Distances& distances,
31 int max_f,
32 int max_h) const;
33 std::vector<Bucket> ordered_buckets_use_map(
34 const TransitionSystem& ts,
35 const Distances& distances) const;
36
37protected:
38 virtual std::string name() const override;
39 virtual void
40 dump_strategy_specific_options(utils::LogProxy& log) const override;
41
42 virtual std::vector<Bucket> partition_into_buckets(
43 const TransitionSystem& ts,
44 const Distances& distances) const override;
45
46public:
47 ShrinkFH(HighLow shrink_f, HighLow shrink_h, int random_seed);
48
49 virtual bool requires_init_distances() const override { return true; }
50
51 virtual bool requires_goal_distances() const override { return true; }
52};
53} // namespace merge_and_shrink
54
55#endif