AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
lazy_search.h
1#ifndef SEARCH_ALGORITHMS_LAZY_SEARCH_H
2#define SEARCH_ALGORITHMS_LAZY_SEARCH_H
3
4#include "downward/evaluation_context.h"
5#include "downward/evaluator.h"
6#include "downward/open_list.h"
7#include "downward/operator_id.h"
8#include "downward/search_algorithm.h"
9#include "downward/search_progress.h"
10#include "downward/search_space.h"
11
12#include "downward/utils/rng.h"
13
14#include <memory>
15#include <vector>
16
17class OpenListFactory;
18
19namespace lazy_search {
20class LazySearch : public SearchAlgorithm {
21protected:
22 std::unique_ptr<EdgeOpenList> open_list;
23
24 // Search behavior parameters
25 bool reopen_closed_nodes; // whether to reopen closed nodes upon finding
26 // lower g paths
27 bool randomize_successors;
28 bool preferred_successors_first;
29 std::shared_ptr<utils::RandomNumberGenerator> rng;
30
31 std::vector<Evaluator*> path_dependent_evaluators;
32 std::vector<std::shared_ptr<Evaluator>> preferred_operator_evaluators;
33
34 State current_state;
35 StateID current_predecessor_id;
36 OperatorID current_operator_id;
37 int current_g;
38 int current_real_g;
39 EvaluationContext current_eval_context;
40
41 virtual void initialize() override;
42 virtual SearchStatus step() override;
43
44 void generate_successors();
45 SearchStatus fetch_next_state();
46
47 void reward_progress();
48
49 std::vector<OperatorID> get_successor_operators(
50 const ordered_set::OrderedSet<OperatorID>& preferred_operators) const;
51
52public:
53 LazySearch(
54 const std::shared_ptr<OpenListFactory>& open,
55 bool reopen_closed,
56 const std::vector<std::shared_ptr<Evaluator>>& evaluators,
57 bool randomize_successors,
58 bool preferred_successors_first,
59 int random_seed,
60 OperatorCost cost_type,
61 int bound,
62 double max_time,
63 const std::string& description,
64 utils::Verbosity verbosity);
65
66 virtual void print_statistics() const override;
67};
68} // namespace lazy_search
69
70#endif