$search
00001 /* 00002 * KnowledgeDatabase.h 00003 * 00004 * Created on: September, 2012 00005 * Author: sdries 00006 */ 00007 00008 #ifndef WM_KNOWLEDGEDATABASE_H_ 00009 #define WM_KNOWLEDGEDATABASE_H_ 00010 00011 #include <problib/pdfs/PMF.h> 00012 #include "wire/core/ClassModel.h" 00013 00014 #include <map> 00015 00016 namespace mhf { 00017 00018 class Evidence; 00019 class SemanticObject; 00020 00021 class KnowledgeDatabase { 00022 00023 public: 00024 00025 static KnowledgeDatabase& getInstance(); 00026 00027 virtual ~KnowledgeDatabase(); 00028 00029 void addClassModel(const std::string& class_name, ClassModel* model); 00030 00031 const PropertySet& getNewPDFs(const std::string& class_name) const; 00032 00033 const PropertySet& getClutterPDFs(const std::string& class_name) const; 00034 00035 const IStateEstimator* getEstimator(const std::string& class_name, const Attribute& attribute) const; 00036 00037 const pbl::PMF& getClassDistribution() const; 00038 00039 const std::map<std::string, ClassModel*>& getClassModels() const; 00040 00041 const ClassModel* getClassModel(const std::string& class_name) const; 00042 00043 void setPriorNew(double prior_new); 00044 00045 void setPriorExisting(double prior_existing); 00046 00047 void setPriorClutter(double prior_clutter); 00048 00049 double getPriorNew() const; 00050 00051 double getPriorExisting() const; 00052 00053 double getPriorClutter() const; 00054 00055 double getProbabilityNew(const Evidence& z); 00056 00057 double getProbabilityClutter(const Evidence& z); 00058 00059 double getProbabilityExisting(const Evidence& z, const SemanticObject& obj); 00060 00061 std::vector<Property> inferProperties(const PropertySet& prop_set, std::vector<Attribute>) const; 00062 00063 protected: 00064 00065 KnowledgeDatabase(); 00066 00067 static KnowledgeDatabase* instance_; 00068 00069 double prior_new_; 00070 00071 double prior_existing_; 00072 00073 double prior_clutter_; 00074 00075 pbl::PMF class_pmf_; 00076 00077 std::map<std::string, ClassModel*> class_models_; 00078 00079 }; 00080 00081 } 00082 00083 #endif /* PROPERTYDATABASE_H_ */