AnyPlan.cpp
Go to the documentation of this file.
00001 #include <actasp/planners/AnyPlan.h>
00002 
00003 #include <actasp/MultiPlanner.h>
00004 #include <actasp/Action.h>
00005 
00006 #include <cstdlib>
00007 
00008 using namespace std;
00009 
00010 namespace actasp {
00011 
00012 AnyPlan::AnyPlan(actasp::MultiPlanner *actualPlanner, double suboptimality) : 
00013         actualPlanner(actualPlanner),
00014         suboptimality(suboptimality){}
00015 
00016 AnswerSet AnyPlan::computePlan(const std::vector<actasp::AspRule>& goal) const throw (std::logic_error) {
00017 
00018         vector< AnswerSet > allPlans = actualPlanner->computeAllPlans(goal,suboptimality);
00019 
00020         if (allPlans.empty())
00021                 return AnswerSet();
00022 
00023         //pick one plan and return it, destroy the others
00024 
00025         int picked =rand() % allPlans.size();
00026 
00027         return allPlans[picked];
00028 
00029 }
00030 
00031 }


bwi_kr_execution
Author(s): Matteo Leonetti, Piyush Khandelwal
autogenerated on Thu Jun 6 2019 17:57:36