21 #include "precondition_visitor.h" 24 using namespace pddl_parser;
44 : parent_(parent), sub_counter_(sub_counter), is_main_(is_main)
58 return vector<string>({a});
72 stringstream namestream;
73 namestream << parent_ << sub_counter_;
74 string name = namestream.str();
84 res.push_back(
string(
"(domain-precondition" 99 res.insert(res.end(), args.begin(), args.end());
109 res.push_back(
string(
"(domain-precondition" 116 " (type conjunction)" 121 stringstream child_name;
122 child_name << name << 1;
123 name = child_name.str();
125 new_parent = parent_;
128 string constants =
"";
131 if (p_strings.size() != 1) {
134 string p_string = p_strings[0];
135 if (p_string[0] ==
'?') {
137 if (p_string.length() <= 1) {
140 params +=
" " + p_string.substr(1);
145 constants +=
" " + p_string;
148 string predicate_string;
151 predicate_string =
" (equality TRUE)";
153 predicate_string =
" (predicate " + p.
function +
")";
156 res.push_back(
string(
"(domain-atomic-precondition" 161 + name +
")" + predicate_string +
" (param-names (create$" + params
163 " (param-constants (create$" Atom function
The name of the predicate for atomic formulae, 'and' for a conjunction, 'or' for a disjunction,...
A PDDL formula (either part of a precondition or an effect(.
Exception thrown by the parser if an error occurs during parsing.
PreconditionToCLIPSFactVisitor(const std::string &parent, int sub_counter, bool is_main=false)
Constructor.
std::vector< std::string > operator()(pddl_parser::Atom &a) const
Translate an Atom into a vector of strings.
std::vector< Expression > arguments
The arguments of the predicate or the subformulae of the compound formula.