AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
search_common.h
1#ifndef SEARCH_ALGORITHMS_SEARCH_COMMON_H
2#define SEARCH_ALGORITHMS_SEARCH_COMMON_H
3
4/*
5 This module contains functions for creating open list factories used
6 by the search algorithms.
7
8 TODO: Think about where this code should ideally live. One possible
9 ordering principle: avoid unnecessary plug-in dependencies.
10
11 This code currently depends on multiple different open list
12 implementations, so it would be good if it would not be a dependency
13 of search algorithms that don't need all these open lists. Under this
14 maxim, EHC should not depend on this file. A logical solution might
15 be to move every creation function that only uses one particular
16 open list type into the header for this open list type, and leave
17 this file for cases that require more complex set-up and are common
18 to eager and lazy search.
19*/
20
21#include <memory>
22#include <vector>
23
24#include "downward/utils/logging.h"
25
26class Evaluator;
27class OpenListFactory;
28
29namespace search_common {
30
31/*
32 Create open list factory for the eager_greedy or lazy_greedy plugins.
33
34 This is usually an alternation open list with:
35 - one sublist for each evaluator, considering all successors
36 - one sublist for each evaluator, considering only preferred successors
37
38 However, the preferred-only open lists are omitted if no preferred
39 operator evaluators are used, and if there would only be one sublist
40 for the alternation open list, then that sublist is returned
41 directly.
42*/
43extern std::shared_ptr<OpenListFactory> create_greedy_open_list_factory(
44 const std::vector<std::shared_ptr<Evaluator>>& evals,
45 const std::vector<std::shared_ptr<Evaluator>>& preferred_evaluators,
46 int boost);
47
48/*
49 Create open list factory for the lazy_wastar plugin.
50
51 This works essentially the same way as parse_greedy (see
52 documentation there), except that the open lists use evalators based
53 on g + w * h rather than using h directly.
54*/
55extern std::shared_ptr<OpenListFactory> create_wastar_open_list_factory(
56 const std::vector<std::shared_ptr<Evaluator>>& base_evals,
57 const std::vector<std::shared_ptr<Evaluator>>& preferred,
58 int boost,
59 int weight,
60 utils::Verbosity verbosity);
61
62/*
63 Create open list factory and f_evaluator (used for displaying progress
64 statistics) for A* search.
65
66 The resulting open list factory produces a tie-breaking open list
67 ordered primarily on g + h and secondarily on h.
68*/
69extern std::
70 pair<std::shared_ptr<OpenListFactory>, const std::shared_ptr<Evaluator>>
71 create_astar_open_list_factory_and_f_eval(
72 const std::shared_ptr<Evaluator>& h_eval,
73 utils::Verbosity verbosity);
74} // namespace search_common
75
76#endif