AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
variable_order_finder.h
1#ifndef TASK_UTILS_VARIABLE_ORDER_FINDER_H
2#define TASK_UTILS_VARIABLE_ORDER_FINDER_H
3
4#include "downward/task_proxy.h"
5
6#include <memory>
7#include <vector>
8
9namespace utils {
10class LogProxy;
11class RandomNumberGenerator;
12} // namespace utils
13
14namespace variable_order_finder {
15enum VariableOrderType {
16 CG_GOAL_LEVEL,
17 CG_GOAL_RANDOM,
18 GOAL_CG_LEVEL,
19 RANDOM,
20 LEVEL,
21 REVERSE_LEVEL
22};
23
24extern void dump_variable_order_type(
25 VariableOrderType variable_order_type,
26 utils::LogProxy& log);
27
28/*
29 NOTE: VariableOrderFinder keeps a copy of the task proxy passed to the
30 constructor. Therefore, users of the class must ensure that the underlying
31 task lives at least as long as the variable order finder.
32*/
33class VariableOrderFinder {
34 TaskProxy task_proxy;
35 const VariableOrderType variable_order_type;
36 std::vector<int> selected_vars;
37 std::vector<int> remaining_vars;
38 std::vector<bool> is_goal_variable;
39 std::vector<bool> is_causal_predecessor;
40
41 void select_next(int position, int var_no);
42
43public:
44 VariableOrderFinder(
45 const TaskProxy& task_proxy,
46 VariableOrderType variable_order_type,
47 const std::shared_ptr<utils::RandomNumberGenerator>& rng = nullptr);
48 ~VariableOrderFinder() = default;
49 bool done() const;
50 int next();
51};
52} // namespace variable_order_finder
53
54#endif