00001 #ifndef actasp_RLActionExecutor_h__guard 00002 #define actasp_RLActionExecutor_h__guard 00003 00004 #include <actasp/ActionExecutor.h> 00005 #include <actasp/MultiPolicy.h> 00006 #include <actasp/AspRule.h> 00007 00008 #include <vector> 00009 #include <list> 00010 00011 namespace actasp { 00012 00013 class AspKR; 00014 class MultiPlanner; 00015 class ActionSelector; 00016 class ExecutionObserver; 00017 class PlanningObserver; 00018 class Action; 00019 00020 class RLActionExecutor : public ActionExecutor { 00021 public: 00022 00023 RLActionExecutor(AspKR* kr, ActionSelector *selector, const std::map<std::string, Action * >& actionMap); 00024 00025 using ActionExecutor::setGoal; 00026 void setGoal(const std::vector<actasp::AspRule>& goalRules) throw(); 00027 00028 bool goalReached() const throw(); 00029 bool failed() const throw(); 00030 00031 void executeActionStep(); 00032 00033 void addExecutionObserver(ExecutionObserver *observer) throw(); 00034 void removeExecutionObserver(ExecutionObserver *observer) throw(); 00035 00036 ~RLActionExecutor(); 00037 00038 private: 00039 00040 //state 00041 bool isGoalReached; 00042 unsigned int actionCounter; 00043 bool newAction; 00044 Action *active; 00045 00046 //KR stuff 00047 AspKR* kr; 00048 std::vector<actasp::AspRule> goalRules; 00049 00050 //customization 00051 ActionSelector *selector; 00052 std::map<std::string, Action * > actionMap; 00053 00054 //observers 00055 std::list<ExecutionObserver*> executionObservers; 00056 00057 }; 00058 00059 } 00060 00061 #endif