10 #ifndef SYMBOLIC_PDDL_H_
11 #define SYMBOLIC_PDDL_H_
17 #include <unordered_map>
21 #include "symbolic/action.h"
22 #include "symbolic/axiom.h"
23 #include "symbolic/derived_predicate.h"
24 #include "symbolic/formula.h"
25 #include "symbolic/object.h"
26 #include "symbolic/predicate.h"
27 #include "symbolic/proposition.h"
42 using ObjectTypeMap = std::unordered_map<std::string, std::vector<Object>>;
43 using AxiomContextMap =
44 std::unordered_map<std::string, std::vector<std::weak_ptr<Axiom>>>;
56 bool apply_axioms =
true);
76 bool IsValid(
bool verbose =
false, std::ostream& os = std::cout)
const;
171 const State& next_state)
const;
173 const std::string& action_call,
174 const std::set<std::string>& next_state)
const;
185 bool IsValidPlan(
const std::vector<std::string>& action_skeleton)
const;
193 const std::set<std::string>& state,
const std::string& action_name)
const;
200 const std::set<std::string>& state)
const;
202 void AddObject(
const std::string&
name,
const std::string& type);
203 void RemoveObject(
const std::string&
name);
205 const VAL::analysis* symbol()
const {
return analysis_.get(); }
210 const std::string&
name()
const;
226 void set_initial_state(
State&& state) { initial_state_ = std::move(state); }
228 const ObjectTypeMap& object_map()
const {
return object_map_; }
230 const std::vector<Object>& constants()
const {
return constants_; }
231 const std::vector<Object>& objects()
const {
return objects_; }
233 const std::vector<Action>& actions()
const {
return actions_; }
235 const std::vector<Predicate>& predicates()
const {
return predicates_; }
237 const std::vector<std::shared_ptr<Axiom>>& axioms()
const {
return axioms_; }
242 const AxiomContextMap&
axiom_map()
const {
return axiom_map_; }
244 const std::vector<DerivedPredicate>& derived_predicates()
const {
245 return derived_predicates_;
248 const StateIndex& state_index()
const {
return state_index_; }
250 const Formula& goal()
const {
return goal_; }
253 std::shared_ptr<VAL::analysis> analysis_;
254 std::string domain_pddl_;
255 std::string problem_pddl_;
257 std::vector<Object> constants_;
258 std::vector<Object> objects_;
259 ObjectTypeMap object_map_;
261 AxiomContextMap axiom_map_;
262 std::vector<Action> actions_;
263 std::vector<std::shared_ptr<Axiom>> axioms_;
265 std::vector<Predicate> predicates_;
266 std::vector<DerivedPredicate> derived_predicates_;
268 StateIndex state_index_;
270 State initial_state_;
274 std::set<std::string> Stringify(
const State& state);
275 std::pair<std::set<std::string>, std::set<std::string>> Stringify(
276 const PartialState& state);
277 std::vector<std::string> Stringify(
const std::vector<Action>& actions);
278 std::vector<std::vector<std::string>> Stringify(
279 const std::vector<std::vector<Object>>& arguments);
280 std::vector<std::string> Stringify(
const std::vector<Object>& objects);
282 std::ostream& operator<<(std::ostream& os,
const Pddl& pddl);
286 #endif // SYMBOLIC_PDDL_H_