1 #ifndef __MODULE_PROBLEM_H__ 2 #define __MODULE_PROBLEM_H__ 8 #include "ModuleAction.h" 9 #include "ModuleGeneric.h" 17 START_PARALLEL, RESET_ENV_PARALLEL, END_PARALLEL, EXPRESSION
24 std::vector<std::string>* vn,
int rating) {
25 this->belief_ = belief;
27 this->action_ = action;
28 this->valuation_ = valuation;
29 this->variable_names_ = vn;
31 this->rating_ = rating;
46 std::vector<Value *>* get_valuation()
const {
47 return this->valuation_;
50 std::vector<std::string>* get_variable_names()
const {
51 return this->variable_names_;
54 int get_rating()
const {
62 std::vector<Value *>* valuation_;
63 std::vector<std::string>* variable_names_;
69 return lhs->get_rating() > rhs->get_rating();
75 StackElem(TagType type, std::string action_name,
int level) {
76 this->elem_type = type;
77 this->action_name = action_name;
79 this->parallel_end =
nullptr;
81 this->stored_to_add_partial =
nullptr;
82 this->stored_to_remove_partial =
nullptr;
84 this->stored_to_add =
nullptr;
85 this->stored_to_remove =
nullptr;
87 this->required_binding =
nullptr;
90 this->is_root_in_parallel =
false;
94 std::string action_name,
int level) {
95 this->elem_type = type;
96 this->action_name = action_name;
98 this->parallel_end =
nullptr;
100 this->stored_to_add_partial =
nullptr;
101 this->stored_to_remove_partial =
nullptr;
103 this->stored_to_add =
nullptr;
104 this->stored_to_remove =
nullptr;
106 this->required_binding = required_binding;
109 this->is_root_in_parallel =
false;
112 StackElem(TagType type,
StackElem* parallel_end, std::string action_name,
int level) {
113 this->elem_type = type;
114 this->action_name = action_name;
115 this->expr =
nullptr;
116 this->parallel_end = parallel_end;
118 this->stored_to_add_partial =
nullptr;
119 this->stored_to_remove_partial =
nullptr;
121 this->stored_to_add =
nullptr;
122 this->stored_to_remove =
nullptr;
124 this->required_binding =
nullptr;
127 this->is_root_in_parallel =
false;
130 std::string print() {
131 if (elem_type == START_PARALLEL)
132 return "START_PARALLEL";
133 if (elem_type == RESET_ENV_PARALLEL)
134 return "RESET_ENV_PARALLEL";
135 if (elem_type == END_PARALLEL)
136 return "END_PARALLEL";
137 if (elem_type == EXPRESSION)
138 return print_expression(expr);
145 database* stored_to_add_partial;
146 database* stored_to_remove_partial;
148 database* stored_to_add;
149 database* stored_to_remove;
152 bool is_root_in_parallel;
154 std::string action_name;
156 std::map<std::string, Value*>* required_binding;
170 std::vector<std::string>* _beliefs,
171 std::vector<std::string>* _actions,
174 std::vector<std::string>* _heuristics);
180 std::string get_name()
const;
182 module_type::type get_module_type()
const;
190 std::vector<std::string>* get_beliefs();
195 std::vector<std::string>* get_actions();
215 std::vector<ModuleGeneric*>* get_belief_modules();
225 std::vector<ModuleGeneric*>* get_action_modules();
230 void replace_actions(std::vector<std::string>* actions);
235 bool contains_action(std::string action_name);
238 ModuleGeneric* select_action(std::vector<ModuleGeneric*>* actions, std::vector<ModuleGeneric*>* composite);
239 std::vector<Value *>* select_valuation(std::vector<std::vector<Value *>*>* valuations);
240 ModuleGeneric* select_generic_module(std::vector<ModuleGeneric*>* modules);
242 bool find_and_apply_action(
int step, std::vector<std::string>& plan,
int& rating);
244 bool traverse_composite_expr(std::stack<StackElem>* composite_stack, std::stack<database*>* add_database_stack,
246 std::vector<ModuleGeneric*>* action_modules,
int step,
int steps_from_start, std::vector<std::string>& plan,
int& rating,
247 int best_rating, std::string previous_id);
249 std::vector<std::string>* beliefs;
250 std::vector<ModuleGeneric*>* belief_modules;
251 std::vector<std::string>* actions;
252 std::vector<ModuleGeneric*>* action_modules;
256 std::vector<std::string>* heuristics;
259 bool increase_rating_only;
260 bool strict_increase_rating_only;
261 bool composite_first;
263 bool disallow_failed_preconditions;
265 std::stack<StackElem>* composite_stack;
266 std::stack<database*>* remove_database_stack;
267 std::stack<database*>* add_database_stack;
269 std::stack<int>* selected_rating;
271 std::map<int, std::map<std::string, int>> composite_ratings;
class that implements a fact
Definition: Fact.h:14
Implementation of ModuleAction for modules with reasoning.
Definition: ModuleAction.h:21
Definition: Expression.h:10
Implementation of ModuleAction for modules with reasoning.
Definition: ModuleProblem.h:161
Definition: Application.cc:37
Generic class of module (only virtual methods)
Definition: ModuleGeneric.h:21
Definition: ModuleProblem.h:67
Definition: ModuleProblem.h:73
Definition: ModuleProblem.h:20