state_utils.cpp
Go to the documentation of this file.
00001 
00002 #include <actasp/state_utils.h>
00003 
00004 namespace actasp {
00005 
00006   bool stateEquals::operator()(const std::set<AspFluent>& otherstate) const {
00007 
00008     if (state.size() != otherstate.size()) {
00009       return false;
00010     }
00011     std::set<AspFluent>::const_iterator thisIt = state.begin();
00012     std::set<AspFluent>::const_iterator otherIt = otherstate.begin();
00013     for(; thisIt!=state.end(); ++thisIt) {
00014       std::string thisstring = thisIt->toString(0);
00015       std::string otherstring = otherIt->toString(0);
00016       if (thisstring.compare(otherstring)!=0) { //different
00017         return false;
00018       }
00019       ++otherIt;
00020     }
00021     return true; //at this point..
00022   }
00023   
00024 }
00025 
00026 //this class became a template, this file is here for a syntax check
00027 
00028 // using namespace std;
00029 // 
00030 // namespace actasp {
00031 
00032   
00033 
00034 // bool  StateComparator::operator()(const std::set<AspFluent> &first,const std::set<AspFluent> &second) const {
00035 //   if (first.size() != second.size())
00036 //     return first.size() < second.size();
00037 // 
00038 //   //they have the same number of fluents
00039 //   set<AspFluent>::const_iterator thisV = first.begin();
00040 //   set<AspFluent>::const_iterator otherV = second.begin();
00041 // 
00042 //   ActionComparator lessThen; //ignores the time steps!
00043 // 
00044 //   for (; thisV != first.end(); ++thisV, ++otherV) {
00045 //     //this comparison is costly, so I'm using this unelegant expression to minimize the calls to it.
00046 //     if (lessThen(*thisV , *otherV))
00047 //       return true;
00048 //     if (lessThen(*otherV , *thisV))
00049 //       return false;
00050 //   }
00051 // 
00052 //   //they are the same
00053 //   return false;
00054 // }
00055 // 
00056 // 
00057 // bool  StateComparatorRef::operator()(const std::set<AspFluentRef> &first,const std::set<AspFluentRef> &second) const {
00058 //   if (first.size() != second.size())
00059 //     return first.size() < second.size();
00060 // 
00061 //   //they have the same number of fluents
00062 //   set<AspFluentRef>::const_iterator thisV = first.begin();
00063 //   set<AspFluentRef>::const_iterator otherV = second.begin();
00064 // 
00065 //   ActionComparator lessThen; //ignores the time steps!
00066 // 
00067 //   for (; thisV != first.end(); ++thisV, ++otherV) {
00068 //     //this comparison is costly, so I'm using this unelegant expression to minimize the calls to it.
00069 //     if (lessThen(*thisV , *otherV))
00070 //       return true;
00071 //     if (lessThen(*otherV , *thisV))
00072 //       return false;
00073 //   }
00074 // 
00075 //   //they are the same
00076 //   return false;
00077 // }
00078 
00079 
00080 // }
00081 


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