00001 #ifndef actasp_MultiPolicyExecutor_h__guard 00002 #define actasp_MultiPolicyExecutor_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 00019 class MultiPolicyExecutor : public ActionExecutor { 00020 public: 00021 00022 MultiPolicyExecutor(AspKR* kr, MultiPlanner *planner, ActionSelector *selector, 00023 const std::map<std::string, Action * >& actionMap, double suboptimality); 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 ~MultiPolicyExecutor(); 00037 00038 private: 00039 00040 //state 00041 bool isGoalReached; 00042 bool hasFailed; 00043 unsigned int actionCounter; 00044 bool newAction; 00045 Action *active; 00046 00047 //KR stuff 00048 AspKR* kr; 00049 MultiPlanner *planner; 00050 std::vector<actasp::AspRule> goalRules; 00051 00052 MultiPolicy policy; 00053 00054 //customization 00055 double suboptimality; 00056 ActionSelector *selector; 00057 std::map<std::string, Action * > actionMap; 00058 00059 //observers 00060 std::list<ExecutionObserver*> executionObservers; 00061 00062 }; 00063 00064 } 00065 00066 #endif