00001 #ifndef _LW_UTIL_H_ 00002 #define _LW_UTIL_H_ 00003 00004 //#define WSCALE 10 00005 #define WEIGHT_EPSILON .0001 00006 00007 class LWUtil { 00008 00009 public: 00010 00011 static int mySign(int x) 00012 { 00013 return (x>0)?1:0; 00014 } 00015 00016 static void setAllActive(Domain * const & domain) 00017 { 00018 Array<Predicate*> gpreds; 00019 Predicate *gpred; 00020 00021 for(int predno = 0; predno < domain->getNumPredicates(); predno++) 00022 { 00023 gpreds.clear(); 00024 PredicateTemplate *ptemplate = (PredicateTemplate *)domain->getPredicateTemplate(predno); 00025 if(ptemplate->isEqualPredWithType()) 00026 continue; 00027 Predicate::createAllGroundings(predno, domain, gpreds); 00028 00029 for (int i = 0; i < gpreds.size(); i++) 00030 { 00031 gpred = gpreds[i]; 00032 bool evidence = domain->getDB()->getEvidenceStatus(gpred); 00033 if(!evidence) 00034 domain->getDB()->setActiveStatus(gpred,true); 00035 delete gpred; 00036 } 00037 } 00038 } 00039 00040 }; 00041 00042 #endif 00043