#include <node.h>
Public Member Functions | |
Node (int predId, SuperPred *const &superPred, Array< int > *const &constants, Domain *const &domain) | |
Constructor. | |
~Node () | |
Destructor. | |
int | getPredId () |
int | getSuperPredId () |
int | getParentSuperPredId () |
SuperPred * | getSuperPred () |
Array< int > * | getConstants () |
int | getGroundNodeCount () |
int | getNumLinks () |
Returns the number of links of (or number of factors attached to) this node. | |
Link * | getLink (int index) |
void | getMessage (int index, double msgs[]) |
Gets the incoming message from a certain link. | |
void | addAuxLink (Link *link) |
Adds an auxiliary link (factor along with all the relevant information about counts etc. | |
void | addLink (Link *link, double inpMsgs[2]) |
Adds the link (factor along with all the relevant information about counts etc. | |
void | addFactors (Array< Factor * > *const &allFactors, LinkIdToTwoWayMessageMap *const &lidToTWMsg) |
Adds the factors with appropriate counts, also add the node to the corresponding factor. | |
void | receiveMessage (double *inpMsgs, Link *const &link) |
Receives the message sent over a link. | |
double | getExp () |
double * | getProbs (double *const &probs) |
Gets the probabilities for this node - it is simply the product of messages coming at this node. | |
void | sendMessage () |
Sends the messages to all the factor nodes connected to this node. | |
void | sendAuxMessage () |
Sends the messages to all the auxiliary factor nodes connected to this node. | |
void | moveToNextStep () |
Updates the stored msgs and update the msgProduct. | |
ostream & | print (ostream &out) |
Definition at line 90 of file node.h.
void Node::getMessage | ( | int | index, | |
double | msgs[] | |||
) | [inline] |
void Node::addAuxLink | ( | Link * | link | ) | [inline] |
Adds an auxiliary link (factor along with all the relevant information about counts etc.
).
Definition at line 187 of file node.h.
References Array< Type >::append().
00188 { 00189 auxLinks_->append(link); 00190 }
void Node::addLink | ( | Link * | link, | |
double | inpMsgs[2] | |||
) | [inline] |
Adds the link (factor along with all the relevant information about counts etc.
).
Definition at line 196 of file node.h.
References Array< Type >::append(), and Link::getCount().
Referenced by addFactors().
00197 { 00198 links_->append(link); 00199 double *msgs; 00200 msgs = new double[2]; 00201 00202 double cnt = link->getCount(); 00203 for (int i = 0; i < 2; i++) 00204 { 00205 if (inpMsgs) 00206 { 00207 msgs[i] = inpMsgs[i]; 00208 } 00209 else 00210 { 00211 msgs[i] = 0; 00212 } 00213 msgProds_[i] = msgProds_[i] + cnt*msgs[i]; 00214 } 00215 00216 msgsArr_->append(msgs); 00217 msgs = new double[2]; 00218 nextMsgsArr_->append(msgs); 00219 }