X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=planner.h;h=55d572877e61641cbdce15d0186bee9b4da9c235;hb=92aca829cc32e9e4d5965259bd565e727469358d;hp=c74d536b5e5d03ac7f439921bd06a6793c2b715b;hpb=b177aeec472c3941b39b874a83883ff87a41919c;p=popboot.git diff --git a/planner.h b/planner.h index c74d536..55d5728 100644 --- a/planner.h +++ b/planner.h @@ -3,50 +3,41 @@ #include #include +#include +#include +#include #include "action.h" class Node; - - -namespace __gnu_cxx { - - template< typename CharT, typename Traits, typename Alloc > - struct hash< std::basic_string > { - size_t operator()(const std::basic_string& s) const { - - const std::collate& c = std::use_facet< std::collate >(std::locale()); - - return c.hash(s.c_str(), s.c_str() + s.size()); - -} - - }; - - template< typename CharT, typename Traits, typename Alloc > - struct hash< const std::basic_string > { //yes you need this version aswell! - -size_t operator()(const std::basic_string& s) const { - - const std::collate& c = std::use_facet< std::collate >(std::locale()); - - return c.hash(s.c_str(), s.c_str() + s.size()); - } - - }; -}; - class Planner { public: - Planner(std::vector actions, literals init, literals goal); + Planner(std::vector actions, Literals init, Literals goal); + ~Planner(); + + void execute(); + protected: void makePlan(Node* node); void addNode(Node* node); - + void executePlan(); + void replan(); + int cleanupExecution(); + int executeChildren(Node* node); + + sem_t _nodes; + sem_t _list; + std::queue _executedNodes; + Node* _start; - __gnu_cxx::hash_map _addedNodes; - __gnu_cxx::hash_map _actions; + Node* _finish; + __gnu_cxx::hash_map _addedEffects; + __gnu_cxx::hash_map _actionEffects; + Literals _init; + Literals _goal; + std::vector _addedNodes; + std::vector _actions; }; #endif