Go to the documentation of this file.00001
00002 #ifndef actasp_Reasoner_h__guard
00003 #define actasp_Reasoner_h__guard
00004
00005 #include <actasp/AspKR.h>
00006
00007 #include <actasp/AspFluent.h>
00008
00009 namespace actasp {
00010
00011 class QueryGenerator;
00012 class PartialPolicy;
00013
00014 struct Reasoner : public AspKR {
00015
00016 Reasoner(QueryGenerator *actualReasoner,unsigned int max_n,const ActionSet& allActions);
00017
00018 ActionSet availableActions() const throw();
00019
00020 AnswerSet currentStateQuery(const std::vector<actasp::AspRule>& query) const throw();
00021
00022 bool updateFluents(const std::vector<actasp::AspFluent> &observations) throw();
00023
00024 bool isPlanValid(const AnswerSet& plan, const std::vector<actasp::AspRule>& goal) const throw();
00025
00026 void resetCurrentState() throw();
00027
00028 void setCurrentState(const std::set<actasp::AspFluent>& newState) throw();
00029
00030 AnswerSet computePlan(const std::vector<actasp::AspRule>& goal) const throw (std::logic_error) ;
00031
00032 std::vector< AnswerSet > computeAllPlans(const std::vector<actasp::AspRule>& goal, double suboptimality) const throw (std::logic_error);
00033
00034 AnswerSet computeOptimalPlan(const std::vector<actasp::AspRule>& goal, bool filterActions, double suboptimality, bool minimum) const throw (std::logic_error);
00035
00036 virtual PartialPolicy* computePolicy(const std::vector<actasp::AspRule>& goal, double suboptimality) const throw (std::logic_error);
00037
00038 std::list< std::list<AspAtom> > query(const std::string &queryString, unsigned int timestep) const throw();
00039
00040 void setMaxTimeStep(unsigned int max_n) throw() {
00041 this->max_n = max_n;
00042 }
00043
00044 virtual ~Reasoner() {}
00045
00046 protected:
00047 QueryGenerator *clingo;
00048 unsigned int max_n;
00049 ActionSet allActions;
00050
00051 void computePolicyHelper(const std::vector<actasp::AspRule>& goal, double suboptimality, PartialPolicy* p) const throw (std::logic_error);
00052
00053 };
00054
00055 }
00056
00057 #endif