/// \file
/// \brief Defines abstract base class InfAlg, its descendants DAIAlg<T>, the specializations DAIAlgFG and DAIAlgRG and some generic inference methods.
+/// \todo Improve documentation
#ifndef __defined_libdai_daialg_h
/// InfAlg is an abstract base class, defining the common interface of all inference algorithms in libDAI.
+/** \todo General marginalization functions like calcMarginal now copy a complete InfAlg object. Instead,
+ * it would make more sense that they construct a new object without copying the FactorGraph or RegionGraph.
+ * Or they can simply be made methods of the general InfAlg class.
+ * \idea Use a PropertySet as output of an InfAlg, instead of functions like maxDiff() and Iterations().
+ */
class InfAlg {
public:
/// Virtual desctructor (needed because this class contains virtual functions)
/// Combines an InfAlg and a graphical model, e.g., a FactorGraph or RegionGraph
/** \tparam GRM Should be castable to FactorGraph
+ * \todo 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?).
*/
template <class GRM>
class DAIAlg : public InfAlg, public GRM {
/// Construct from GRM
DAIAlg( const GRM &grm ) : InfAlg(), GRM(grm) {}
- /// Copy constructor
- DAIAlg( const DAIAlg & x ) : InfAlg(x), GRM(x) {}
-
- /// Assignment operator
- DAIAlg & operator=( const DAIAlg &x ) {
- if( this != &x ) {
- InfAlg::operator=(x);
- GRM::operator=(x);
- }
- return *this;
- }
-
/// Save factor I
void backupFactor( size_t I ) { GRM::backupFactor( I ); }
/// Save Factors involving ns