doxygen doxygen.conf\r
\r
clean :\r
- del *.obj example.exe matlab\*.$(MEXEXT) matlab\*.obj tests/test.exe utils\fg2dot.exe utils\createfg.exe utils\remove_short_loops.exe utils\fginfo.exe $(LIB)\libdai.lib\r
+ del *.obj example.exe matlab\*.$(MEXEXT) matlab\*.obj tests\test.exe utils\fg2dot.exe utils\createfg.exe utils\remove_short_loops.exe utils\fginfo.exe $(LIB)\libdai.lib\r
\r
\r
bipgraph.obj : $(SRC)/bipgraph.cpp $(HEADERS)\r
--- /dev/null
+- Idea: a FactorGraph and a RegionGraph are often equipped with
+extra properties for nodes and edges. The code to initialize those
+is often quite similar; maybe this can be abstracted to classes
+like ExtFactorGraph and ExtRegionGraph (Ext stands for Extended), e.g.
+template <typename NodeProperties, typename EdgeProperties>
+class ExtFactorGraph : public FactorGraph {
+ public:
+ std::vector<NodeProperties> nodeProps;
+ std::vector<std::vector<EdgeProperties> > edgeProps;
+ // blabla
+}
+A disadvantage of this approach may be worse cachability.
+- http://www.boost.org/development/requirements.html#Design_and_Programming
+- Would it be a good idea to cache second-order neighborhoods (delta's) in BipGraph?
+- Would it be a good idea to add the variable label -> index hashmap in FactorGraph,
+ to replace the linear searches that are performed every time for findVar()?
+ No, a better idea is to avoid calls to findVar() as much as possible.
+- Can the FactorGraph constructors be optimized further?
+- Move FactorGraph::_normType somewhere else (maybe to InfAlg or DAIAlg<T>)
+- Remove updatedFactor
+- Add Exceptions framework; this can e.g. be used as follows: if *.logZ() is
+called, it can return an exception if this method is not implemented, and the
+caller can catch this exception and handle it correctly. Then, you don't need
+a hasLogZ function/constant that tells whether this functionality is available.
+- Add an option to tests/test that it doesn't report the time needed; this is
+useful for the regression testing.
+
+DONE IN PREVIOUS COMMITS:
+- Added a few methods to BipartiteGraph
+- Improved ClusterGraph implementation (taken from SVN head)
+- Improved MaxSpanningTree algorithm (using boost::graph library, taken from SVN head)
+- Updated doxygen.conf
+- Made compatible with Visual C++
+- Merged improved index.h from svn
+- Rename stateSpace -> states
+- Optimized Diffs
+- Renamed Regenerate() -> create()
+
+TODO FOR RELEASE:
+- Test Visual C++ compatibility
+- Figure out which libraries are required and document in README
+ boost headers, boost::program_options library
+
+FILES IN SVN HEAD THAT ARE NO LONGER RELEVANT FOR GIT MASTER
+diffs.h
+index.h
+util.h
+util.cpp
+bipgraph.h
+weightedgraph.h
+clustergraph.h
+clustergraph.cpp
+varset.h
+var.h
+utils/createfg.cpp
Factor belief (const Var &n) const { return( _beliefs[findVar(n)] ); }
Factor belief (const VarSet &/*ns*/) const { assert( 0 == 1 ); return Factor(); }
std::vector<Factor> beliefs() const { return _beliefs; }
- Complex logZ() const { return NAN; }
+ Complex logZ() const { /*assert( 0 == 1 );*/ return 0.0; }
void CalcBelief (size_t i);
const Factor & belief (size_t i) const { return _beliefs[i]; };
const Factor & pancake (size_t i) const { return _pancakes[i]; };
Factor belief( const Var &n ) const;
Factor belief( const VarSet &/*ns*/ ) const { assert( 0 == 1 ); return Factor(); }
std::vector<Factor> beliefs() const;
- Complex logZ() const { return NAN; }
+ Complex logZ() const { /*assert( 0 == 1 );*/ return 0.0; }
void init() { assert( checkProperties() ); }
static const char *Name;
std::string identify() const;
#ifdef WINDOWS
- #include <xmath.h> // for NAN
#include <map>
#else
#include <tr1/unordered_map>
}
if( hasNaNs ) {
cout << "LC::run: initial _pancakes has NaNs!" << endl;
- return NAN;
+ return -1.0;
}
size_t nredges = nrEdges();
size_t _I = update_seq[t].second;
_pancakes[i] = NewPancake( i, _I, hasNaNs);
if( hasNaNs )
- return NAN;
+ return -1.0;
CalcBelief( i );
}
return 0.0;
} else
- return NAN;
+ return -1.0;
}
// Create inner regions - store them in the bipartite graph
IRs.reserve( betas.size() );
for( set<VarSet>::const_iterator beta = betas.begin(); beta != betas.end(); beta++ )
- IRs.push_back( Region(*beta,NAN) );
+ IRs.push_back( Region(*beta,0.0) );
// Create edges
vector<pair<size_t,size_t> > edges;
// Calculates counting numbers of inner regions based upon counting numbers of outer regions
vector<vector<size_t> > ancestors(nrIRs());
+ vector<bool> assigned(nrIRs(), false);
for( size_t beta = 0; beta < nrIRs(); beta++ ) {
- IR(beta).c() = NAN;
+ IR(beta).c() = 0.0;
for( size_t beta2 = 0; beta2 < nrIRs(); beta2++ )
if( (beta2 != beta) && IR(beta2) >> IR(beta) )
ancestors[beta].push_back(beta2);
do {
new_counting = false;
for( size_t beta = 0; beta < nrIRs(); beta++ ) {
- if( isnan( IR(beta).c() ) ) {
- bool has_nan_ancestor = false;
- for( vector<size_t>::const_iterator beta2 = ancestors[beta].begin(); (beta2 != ancestors[beta].end()) && !has_nan_ancestor; beta2++ )
- if( isnan( IR(*beta2).c() ) )
- has_nan_ancestor = true;
- if( !has_nan_ancestor ) {
+ if( !assigned[beta] ) {
+ bool has_unassigned_ancestor = false;
+ for( vector<size_t>::const_iterator beta2 = ancestors[beta].begin(); (beta2 != ancestors[beta].end()) && !has_unassigned_ancestor; beta2++ )
+ if( !assigned[*beta2] )
+ has_unassigned_ancestor = true;
+ if( !has_unassigned_ancestor ) {
double c = 1.0;
foreach( const Neighbor &alpha, nbIR(beta) )
c -= OR(alpha).c();
for( vector<size_t>::const_iterator beta2 = ancestors[beta].begin(); beta2 != ancestors[beta].end(); beta2++ )
c -= IR(*beta2).c();
IR(beta).c() = c;
+ assigned[beta] = true;
new_counting = true;
}
}
--- /dev/null
+test --aliases aliases.conf --filename %1 --methods JTREE_HUGIN JTREE_SHSH BP_SEQFIX BP_SEQRND BP_SEQMAX BP_PARALL BP_SEQFIX_LOG BP_SEQRND_LOG BP_SEQMAX_LOG BP_PARALL_LOG MF_SEQRND TREEEP TREEEPWC GBP_MIN GBP_DELTA GBP_LOOP3 GBP_LOOP4 HAK_MIN HAK_DELTA HAK_LOOP3 HAK_LOOP4 MR_RESPPROP_FULL MR_CLAMPING_FULL MR_EXACT_FULL MR_RESPPROP_LINEAR MR_CLAMPING_LINEAR MR_EXACT_LINEAR LCBP_FULLCAV_SEQFIX LCBP_FULLCAVin_SEQFIX LCBP_FULLCAV_SEQRND LCBP_FULLCAVin_SEQRND LCBP_FULLCAV_NONE LCBP_FULLCAVin_NONE LCBP_PAIRCAV_SEQFIX LCBP_PAIRCAVin_SEQFIX LCBP_PAIRCAV_SEQRND LCBP_PAIRCAVin_SEQRND LCBP_PAIRCAV_NONE LCBP_PAIRCAVin_NONE LCBP_UNICAV_SEQFIX LCBP_UNICAV_SEQRND