OLD | NEW |
1 #ifndef OPEN_LISTS_OPEN_LIST_BUCKETS_H | 1 #ifndef OPEN_LISTS_OPEN_LIST_BUCKETS_H |
2 #define OPEN_LISTS_OPEN_LIST_BUCKETS_H | 2 #define OPEN_LISTS_OPEN_LIST_BUCKETS_H |
3 | 3 |
4 #include "open_list.h" | 4 #include "open_list.h" |
5 #include "../scalar_evaluator.h" | 5 #include "../scalar_evaluator.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 class Options; | 11 class Options; |
12 | 12 |
13 template<class Entry> | 13 template<class Entry> |
14 class BucketOpenList : public OpenList<Entry> { | 14 class BucketOpenList : public OpenList<Entry> { |
15 typedef std::deque<Entry> Bucket; | 15 typedef std::deque<Entry> Bucket; |
16 std::vector<Bucket> buckets; | 16 std::vector<Bucket> buckets; |
17 mutable int lowest_bucket; | 17 mutable int lowest_bucket; |
18 int size; | 18 int size; |
19 | 19 |
20 ScalarEvaluator *evaluator; | 20 ScalarEvaluator *evaluator; |
21 int last_evaluated_value; | 21 int last_evaluated_value; |
22 bool last_preferred; | 22 bool last_preferred; |
23 bool dead_end; | 23 bool dead_end; |
24 bool dead_end_reliable; | 24 bool dead_end_reliable; |
25 protected: | 25 protected: |
26 ScalarEvaluator *get_evaluator() {return evaluator; } | 26 ScalarEvaluator *get_evaluator() {return evaluator; } |
| 27 void evaluate(int g, bool preferred); |
| 28 bool is_last_evaluated_dead_end() const; |
27 | 29 |
28 public: | 30 public: |
29 BucketOpenList(const Options &opts); | 31 BucketOpenList(const Options &opts); |
30 ~BucketOpenList(); | 32 ~BucketOpenList(); |
31 | 33 |
32 int insert(const Entry &entry); | 34 int insert(const Entry &entry); |
33 Entry remove_min(std::vector<int> *key = 0); | 35 Entry remove_min(std::vector<int> *key = 0); |
34 bool empty() const; | 36 bool empty() const; |
35 void clear(); | 37 void clear(); |
36 | 38 |
37 void evaluate(int g, bool preferred); | |
38 bool is_dead_end() const; | |
39 bool dead_end_is_reliable() const; | 39 bool dead_end_is_reliable() const; |
40 void get_involved_heuristics(std::set<Heuristic *> &hset); | 40 void get_involved_heuristics(std::set<Heuristic *> &hset); |
41 | 41 |
42 static OpenList<Entry> *_parse(OptionParser &parser); | 42 static OpenList<Entry> *_parse(OptionParser &parser); |
43 }; | 43 }; |
44 | 44 |
45 #include "open_list_buckets.cc" | 45 #include "open_list_buckets.cc" |
46 | 46 |
47 // HACK! Need a better strategy of dealing with templates, also in the Makefile. | 47 // HACK! Need a better strategy of dealing with templates, also in the Makefile. |
48 | 48 |
49 #endif | 49 #endif |
OLD | NEW |