13 #ifndef __defined_libdai_fbp_h
14 #define __defined_libdai_fbp_h
67 FBP() :
BP(), _weight() {}
84 virtual std::string
name()
const {
return "FBP"; }
90 Real Weight(
size_t I )
const {
return _weight[I]; }
102 void setWeights(
const std::vector<Real> &c ) { _weight = c; }
FBP(const FactorGraph &fg, const PropertySet &opts)
Construct from FactorGraph fg and PropertySet opts.
Definition: fbp.h:74
virtual std::string name() const
Returns the name of the algorithm.
Definition: fbp.h:84
Defines class BP, which implements (Loopy) Belief Propagation.
virtual void construct()
Helper function for constructors.
Definition: fbp.cpp:154
void setWeights(const std::vector< Real > &c)
Sets the weights of all factors simultaenously.
Definition: fbp.h:102
Approximate inference algorithm "Fractional Belief Propagation" [WiH03].
Definition: fbp.h:59
Represents a factor graph.
Definition: factorgraph.h:65
FactorGraph & fg()
Returns reference to underlying FactorGraph.
Definition: daialg.h:221
double Real
Real number (alias for double, which could be changed to long double if necessary) ...
Definition: util.h:98
virtual Real logZ() const
Returns the logarithm of the (approximated) partition sum (normalizing constant of the factor graph)...
Definition: fbp.cpp:26
Defines the DAI_ENUM macro, which can be used to define an enum with additional functionality.
const std::vector< Real > & Weights() const
Returns constant reference to vector of all factor weights.
Definition: fbp.h:94
virtual void calcNewMessage(size_t i, size_t _I)
Calculate the updated message from the _I 'th neighbor of variable i to variable i.
Definition: fbp.cpp:101
virtual void setProperties(const PropertySet &opts)
Definition: bp.cpp:33
virtual Prob calcIncomingMessageProduct(size_t I, bool without_i, size_t i) const
Calculate the product of factor I and the incoming messages.
Definition: fbp.cpp:44
void setWeight(size_t I, Real c)
Sets the weight of the I 'th factor to c.
Definition: fbp.h:97
Defines the Property and PropertySet classes, which are mainly used for managing parameters of infere...
Approximate inference algorithm "(Loopy) Belief Propagation".
Definition: bp.h:63
Represents a set of properties, mapping keys (of type PropertyKey) to values (of type PropertyValue) ...
Definition: properties.h:73
FBP()
Default constructor.
Definition: fbp.h:68
virtual void calcBeliefF(size_t I, Prob &p) const
Calculates unnormalized belief of factor I.
Definition: fbp.h:115
Namespace for libDAI.
Definition: alldai.cpp:16
Defines the FactorGraph class, which represents factor graphs (e.g., Bayesian networks or Markov rand...
Defines the general interface for inference methods in libDAI (classes InfAlg, DaiAlg<>, DaiAlgFG and DaiAlgRG).
Allows the user to specify which algorithms will be built into libDAI.
std::vector< Real > _weight
Factor weights (indexed by factor ID)
Definition: fbp.h:62
virtual FBP * construct(const FactorGraph &fg, const PropertySet &opts) const
Returns a pointer to a newly constructed inference algorithm.
Definition: fbp.h:83
virtual FBP * clone() const
Returns a pointer to a new, cloned copy of *this (i.e., virtual copy constructor) ...
Definition: fbp.h:82
Real Weight(size_t I) const
Returns weight of the I 'th factor.
Definition: fbp.h:91