dai::DAIAlg< GRM > Class Template Reference

Combines the abstract base class InfAlg with a graphical model (e.g., a FactorGraph or RegionGraph). More...

#include <dai/daialg.h>

Inheritance diagram for dai::DAIAlg< GRM >:

dai::InfAlg dai::BP dai::CBP dai::DecMAP dai::ExactInf dai::Gibbs dai::HAK dai::JTree dai::LC dai::MF dai::MR

List of all members.

Public Member Functions

Constructors/destructors
 DAIAlg ()
 Default constructor.
 DAIAlg (const GRM &grm)
 Construct from GRM.
Queries
FactorGraphfg ()
 Returns reference to underlying FactorGraph.
const FactorGraphfg () const
 Returns constant reference to underlying FactorGraph.
Changing the factor graph
void clamp (size_t i, size_t x, bool backup=false)
 Clamp variable with index i to value x (i.e. multiply with a Kronecker delta $\delta_{x_i, x}$).
void makeCavity (size_t i, bool backup=false)
 Sets all factors interacting with variable with index i to one.
Backup/restore mechanism for factors
void backupFactor (size_t I)
 Make a backup copy of factor I.
void backupFactors (const VarSet &vs)
 Make backup copies of all factors involving the variables in vs.
void restoreFactor (size_t I)
 Restore factor I from its backup copy.
void restoreFactors (const VarSet &vs)
 Restore the factors involving the variables in vs from their backup copies.


Detailed Description

template<class GRM>
class dai::DAIAlg< GRM >

Combines the abstract base class InfAlg with a graphical model (e.g., a FactorGraph or RegionGraph).

Inference algorithms in libDAI directly inherit from a DAIAlg, currently either from a DAIAlg<FactorGraph> or from a DAIAlg<RegionGraph>.

Template Parameters:
GRM Should be castable to FactorGraph
Idea:
A DAIAlg should not inherit from a FactorGraph or RegionGraph, but should store a reference to the graphical model object. This prevents needless copying of (possibly large) data structures. Disadvantage: the caller must not change the graphical model between calls to the inference algorithm (maybe a smart_ptr or some locking mechanism would help here?).

Constructor & Destructor Documentation

template<class GRM>
dai::DAIAlg< GRM >::DAIAlg (  )  [inline]

Default constructor.

template<class GRM>
dai::DAIAlg< GRM >::DAIAlg ( const GRM &  grm  )  [inline]

Construct from GRM.


Member Function Documentation

template<class GRM>
FactorGraph& dai::DAIAlg< GRM >::fg (  )  [inline, virtual]

Returns reference to underlying FactorGraph.

Implements dai::InfAlg.

template<class GRM>
const FactorGraph& dai::DAIAlg< GRM >::fg (  )  const [inline, virtual]

Returns constant reference to underlying FactorGraph.

Implements dai::InfAlg.

template<class GRM>
void dai::DAIAlg< GRM >::clamp ( size_t  i,
size_t  x,
bool  backup = false 
) [inline, virtual]

Clamp variable with index i to value x (i.e. multiply with a Kronecker delta $\delta_{x_i, x}$).

If backup == true, make a backup of all factors that are changed.

Implements dai::InfAlg.

template<class GRM>
void dai::DAIAlg< GRM >::makeCavity ( size_t  i,
bool  backup = false 
) [inline, virtual]

Sets all factors interacting with variable with index i to one.

If backup == true, make a backup of all factors that are changed.

Implements dai::InfAlg.

template<class GRM>
void dai::DAIAlg< GRM >::backupFactor ( size_t  I  )  [inline, virtual]

Make a backup copy of factor I.

Implements dai::InfAlg.

template<class GRM>
void dai::DAIAlg< GRM >::backupFactors ( const VarSet vs  )  [inline, virtual]

Make backup copies of all factors involving the variables in vs.

Implements dai::InfAlg.

template<class GRM>
void dai::DAIAlg< GRM >::restoreFactor ( size_t  I  )  [inline, virtual]

Restore factor I from its backup copy.

Implements dai::InfAlg.

template<class GRM>
void dai::DAIAlg< GRM >::restoreFactors ( const VarSet vs  )  [inline, virtual]

Restore the factors involving the variables in vs from their backup copies.

Implements dai::InfAlg.


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

Generated on Thu Aug 5 19:04:04 2010 for libDAI by  doxygen 1.5.5