AuxFactor Class Reference

Stores all relevant information about a factor. More...

#include <auxfactor.h>

Inheritance diagram for AuxFactor:

Factor List of all members.

Public Member Functions

 AuxFactor (Array< Predicate * > *formula)
 ~AuxFactor ()
double getProb ()
 Computes the probability of this auxiliary factor.
Array< Predicate * > * getFormula ()

Detailed Description

Stores all relevant information about a factor.

Definition at line 75 of file auxfactor.h.


Member Function Documentation

double AuxFactor::getProb (  )  [inline]

Computes the probability of this auxiliary factor.

This is the product of the probabilities of the attached nodes.

Definition at line 102 of file auxfactor.h.

References Node::getProbs(), Predicate::getSense(), Factor::links_, and Array< Type >::size().

Referenced by BP::infer().

00103   {
00104     Node* node;
00105     double prob = 1.0;
00106     for (int lno = 0; lno < links_->size(); lno++)
00107     {
00108       int predIndex = (*links_)[lno]->getPredIndex();
00109       node = (*links_)[lno]->getNode();
00110       double probs[2];
00111       node->getProbs(probs);         
00112 
00113       Predicate *pred = (*formula_)[predIndex];
00114       if (pred->getSense()) prob *= probs[1];
00115       else prob *= probs[0];
00116     }
00117     return prob;
00118   }


The documentation for this class was generated from the following file:
Generated on Sun Jun 7 11:55:22 2009 for Alchemy by  doxygen 1.5.1