42 double probability = 0.0;
45 unsigned int numberOfValidHypotheses = 0;
48 unsigned int numberOfEvidence = pNumberOfEvidence + 1;
51 for(
unsigned int h = 0; h < pow(numberOfEvidence, pNumberOfSlots); h++)
57 std::vector<unsigned int> assignments;
60 unsigned int numberOfFilledSlots = 0;
63 for(
unsigned int s = 0;
s < pNumberOfSlots;
s++)
66 unsigned int part = (h / ((
unsigned int) pow(numberOfEvidence,
s)) ) % numberOfEvidence;
69 if(part > 0 &&
std::find(assignments.begin(), assignments.end(), part) != assignments.end())
73 if(
s == 0 && part == 0)
78 assignments.push_back(part);
82 numberOfFilledSlots++;
90 double lambda = pNumberOfEvidence + 1;
93 for(
unsigned int i = 2; i <= numberOfFilledSlots; i++)
101 probability += pow(1.0 / (
mVolumeOfWorkspace * 2.0 * pow(M_PI, 2.0)), numberOfFilledSlots)
103 * pow(0.5, numberOfFilledSlots)
104 * (pow(lambda, numberOfFilledSlots) / faculty) * exp(-lambda);
107 numberOfValidHypotheses++;
111 if(numberOfValidHypotheses > 0)
112 probability /= numberOfValidHypotheses;
BackgroundInferenceAlgorithm()
void load(boost::property_tree::ptree &pPt)
double mVolumeOfWorkspace
bool find(const std::vector< double > &in, double toFind)
unsigned int mNumberOfObjectClasses
double calculateProbabilityOfBackgroundSceneObject(unsigned int pNumberOfEvidence, unsigned int pNumberOfSlots)
~BackgroundInferenceAlgorithm()