libDAI
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dai::BP_dual Class Reference

Calculates both types of BP messages and their normalizers from an InfAlg. More...

#include <dai/bp_dual.h>

Classes

struct  _edges_t
 Convenience label for storing edge properties. More...
 
struct  beliefs
 Groups together the data structures for storing the two types of beliefs and their normalizers. More...
 
struct  messages
 Groups together the data structures for storing the two types of messages and their normalizers. More...
 

Public Member Functions

 BP_dual (const InfAlg *ia)
 Construct BP_dual object from (converged) InfAlg object's beliefs and factors. More...
 
const FactorGraphfg () const
 Returns the underlying FactorGraph. More...
 
ProbmsgM (size_t i, size_t _I)
 Returns reference to factor->variable message (I -> i) More...
 
const ProbmsgM (size_t i, size_t _I) const
 Returns constant reference to factor->variable message (I -> i) More...
 
ProbmsgN (size_t i, size_t _I)
 Returns reference to variable -> factor message (i -> I) More...
 
const ProbmsgN (size_t i, size_t _I) const
 Returns constant reference to variable -> factor message (i -> I) More...
 
RealzM (size_t i, size_t _I)
 Returns reference to normalizer for factor->variable message (I -> i) More...
 
const RealzM (size_t i, size_t _I) const
 Returns constant reference to normalizer for factor->variable message (I -> i) More...
 
RealzN (size_t i, size_t _I)
 Returns reference to normalizer for variable -> factor message (i -> I) More...
 
const RealzN (size_t i, size_t _I) const
 Returns constant reference to normalizer for variable -> factor message (i -> I) More...
 
Factor beliefV (size_t i) const
 Returns belief of variable i. More...
 
Factor beliefF (size_t I) const
 Returns belief of factor I. More...
 
Real beliefVZ (size_t i) const
 Returns normalizer for belief of variable i. More...
 
Real beliefFZ (size_t I) const
 Returns normalizer for belief of factor I. More...
 

Protected Member Functions

void init ()
 Does all necessary preprocessing. More...
 
void regenerateMessages ()
 Allocates space for _msgs. More...
 
void regenerateBeliefs ()
 Allocates space for _beliefs. More...
 
void calcMessages ()
 Calculate all messages from InfAlg beliefs. More...
 
void calcNewM (size_t i, size_t _I)
 Update factor->variable message (i -> I) More...
 
void calcNewN (size_t i, size_t _I)
 Update variable->factor message (I -> i) More...
 
void calcBeliefs ()
 Calculate all variable and factor beliefs from messages. More...
 
void calcBeliefV (size_t i)
 Calculate belief of variable i. More...
 
void calcBeliefF (size_t I)
 Calculate belief of factor I. More...
 

Protected Attributes

messages _msgs
 Stores all messages. More...
 
beliefs _beliefs
 Stores all beliefs. More...
 
const InfAlg_ia
 Pointer to the InfAlg object. More...
 

Detailed Description

Calculates both types of BP messages and their normalizers from an InfAlg.

BP_dual calculates "dual" versions of BP messages (both messages from factors to variables and messages from variables to factors), and normalizers, given an InfAlg. These are computed from the variable and factor beliefs of the InfAlg. This class is used primarily by BBP.

Author
Frederik Eaton

Constructor & Destructor Documentation

dai::BP_dual::BP_dual ( const InfAlg ia)
inline

Construct BP_dual object from (converged) InfAlg object's beliefs and factors.

Warning
A pointer to the the InfAlg object is stored, so the object must not be destroyed before the BP_dual is destroyed.

Member Function Documentation

void dai::BP_dual::init ( )
protected

Does all necessary preprocessing.

void dai::BP_dual::regenerateMessages ( )
protected

Allocates space for _msgs.

void dai::BP_dual::regenerateBeliefs ( )
protected

Allocates space for _beliefs.

void dai::BP_dual::calcMessages ( )
protected

Calculate all messages from InfAlg beliefs.

void dai::BP_dual::calcNewM ( size_t  i,
size_t  _I 
)
protected

Update factor->variable message (i -> I)

void dai::BP_dual::calcNewN ( size_t  i,
size_t  _I 
)
protected

Update variable->factor message (I -> i)

void dai::BP_dual::calcBeliefs ( )
protected

Calculate all variable and factor beliefs from messages.

void dai::BP_dual::calcBeliefV ( size_t  i)
protected

Calculate belief of variable i.

void dai::BP_dual::calcBeliefF ( size_t  I)
protected

Calculate belief of factor I.

const FactorGraph& dai::BP_dual::fg ( ) const
inline

Returns the underlying FactorGraph.

Prob& dai::BP_dual::msgM ( size_t  i,
size_t  _I 
)
inline

Returns reference to factor->variable message (I -> i)

const Prob& dai::BP_dual::msgM ( size_t  i,
size_t  _I 
) const
inline

Returns constant reference to factor->variable message (I -> i)

Prob& dai::BP_dual::msgN ( size_t  i,
size_t  _I 
)
inline

Returns reference to variable -> factor message (i -> I)

const Prob& dai::BP_dual::msgN ( size_t  i,
size_t  _I 
) const
inline

Returns constant reference to variable -> factor message (i -> I)

Real& dai::BP_dual::zM ( size_t  i,
size_t  _I 
)
inline

Returns reference to normalizer for factor->variable message (I -> i)

const Real& dai::BP_dual::zM ( size_t  i,
size_t  _I 
) const
inline

Returns constant reference to normalizer for factor->variable message (I -> i)

Real& dai::BP_dual::zN ( size_t  i,
size_t  _I 
)
inline

Returns reference to normalizer for variable -> factor message (i -> I)

const Real& dai::BP_dual::zN ( size_t  i,
size_t  _I 
) const
inline

Returns constant reference to normalizer for variable -> factor message (i -> I)

Factor dai::BP_dual::beliefV ( size_t  i) const
inline

Returns belief of variable i.

Factor dai::BP_dual::beliefF ( size_t  I) const
inline

Returns belief of factor I.

Real dai::BP_dual::beliefVZ ( size_t  i) const
inline

Returns normalizer for belief of variable i.

Real dai::BP_dual::beliefFZ ( size_t  I) const
inline

Returns normalizer for belief of factor I.

Member Data Documentation

messages dai::BP_dual::_msgs
protected

Stores all messages.

beliefs dai::BP_dual::_beliefs
protected

Stores all beliefs.

const InfAlg* dai::BP_dual::_ia
protected

Pointer to the InfAlg object.


The documentation for this class was generated from the following files: