* Now compiles also under Visual C++.
* Added Exceptions framework.
* Replaced ENUM2,ENUM3,ENUM4,ENUM5,ENUM6 by single DAI_ENUM macro.
+* Removed utils/remove_short_loops and matlab/remove_short_loops.
* Added more features to utils/createfg for creating factor graphs.
* Pervasive change of BipartiteGraph implementation (based on an idea by
Giuseppe Passino). BipartiteGraph no longer stores the node properties
std::set<Var>, which yields a significant speed improvement.
* Improved MaxSpanningTreePrims algorithm (uses boost::graph)
* Small optimization in Diffs
+* Replaced Complex with real numbers (negative potentials is just not
+ used enough to warrant the additional "complexity" :))
+* Moved Properties and MaxDiff frameworks from InfAlg to each individual
+ inference algorithm, because the Properties framework was not as
+ convenient as I hoped, and not every inference algorithm needs a maxdiff
+ variable. Also, replaced some FactorGraph functionality in InfAlg by a
+ function that returns the FactorGraph. The result is cleaner (less
+ entangled) code.
* Improved ClusterGraph implementation, yielding significant speedups
for the JunctionTree algorithm on large factorgraphs.
* Improved documetation
removed ExactMarginal(const VarSet &)
removed ExactlogZ()
moved isConnected() to BipartiteGraph
+ removed updatedFactor(size_t)
+ removed _normtype and NormType()
- RegionGraph::
nr_ORs() -> nrORs()
nr_IRs() -> nrIRs()
- Factor::max() -> Factor::maxVal()
- toc() in util.h now returns seconds as a double
- VarSet::operator&&
+ - Properties -> PropertySet
libDAI-0.2.1 (2008-05-26)
all : $(TARGETS)
echo -e "\a"
-matlabs : matlab/dai.$(MEXEXT) matlab/dai_readfg.$(MEXEXT) matlab/dai_writefg.$(MEXEXT) matlab/dai_removeshortloops.$(MEXEXT) matlab/dai_potstrength.$(MEXEXT)
+matlabs : matlab/dai.$(MEXEXT) matlab/dai_readfg.$(MEXEXT) matlab/dai_writefg.$(MEXEXT) matlab/dai_potstrength.$(MEXEXT)
$(LIB)/libdai.a : bipgraph.o daialg.o alldai.o clustergraph.o factorgraph.o properties.o regiongraph.o util.o weightedgraph.o x2x.o exceptions.o $(OBJECTS)
ar rcs $(LIB)/libdai.a bipgraph.o daialg.o alldai.o clustergraph.o factorgraph.o properties.o regiongraph.o util.o weightedgraph.o x2x.o exceptions.o $(OBJECTS)
tests : tests/test
-utils : utils/createfg utils/fg2dot utils/remove_short_loops utils/fginfo
+utils : utils/createfg utils/fg2dot utils/fginfo
testregression : tests/test
echo Testing...this can take a while...
doxygen doxygen.conf
clean :
- rm *.o example matlab/*.$(MEXEXT) matlab/*.o tests/test utils/fg2dot utils/createfg utils/remove_short_loops utils/fginfo $(LIB)/libdai.a; echo
+ rm *.o example matlab/*.$(MEXEXT) matlab/*.o tests/test utils/fg2dot utils/createfg utils/fginfo $(LIB)/libdai.a; echo
rm -R doc; echo
bipgraph.o : $(SRC)/bipgraph.cpp $(HEADERS)
matlab/dai_writefg.$(MEXEXT) : matlab/dai_writefg.cpp $(HEADERS) factorgraph.o matlab/matlab.o
$(MEX) $(MEXFLAGS) -o matlab/dai_writefg matlab/dai_writefg.cpp factorgraph.o matlab/matlab.o
-matlab/dai_removeshortloops.$(MEXEXT) : matlab/dai_removeshortloops.cpp $(HEADERS) factorgraph.o matlab/matlab.o
- $(MEX) $(MEXFLAGS) -o matlab/dai_removeshortloops matlab/dai_removeshortloops.cpp factorgraph.o matlab/matlab.o
-
matlab/dai_potstrength.$(MEXEXT) : matlab/dai_potstrength.cpp $(HEADERS) matlab/matlab.o
$(MEX) $(MEXFLAGS) -o matlab/dai_potstrength matlab/dai_potstrength.cpp matlab/matlab.o
utils/fg2dot : utils/fg2dot.cpp $(HEADERS) factorgraph.o exceptions.o
$(CC) $(CCFLAGS) -o utils/fg2dot utils/fg2dot.cpp factorgraph.o exceptions.o
-utils/remove_short_loops : utils/remove_short_loops.cpp $(HEADERS) factorgraph.o exceptions.o
- $(CC) $(CCFLAGS) -o utils/remove_short_loops utils/remove_short_loops.cpp factorgraph.o exceptions.o
-
utils/fginfo : utils/fginfo.cpp $(HEADERS) factorgraph.o bipgraph.o exceptions.o
$(CC) $(CCFLAGS) -o utils/fginfo utils/fginfo.cpp factorgraph.o bipgraph.o exceptions.o
utils/createfg.cpp
exceptions.h
exceptions.cpp
+enum.h
DOCUMENTATION READY:
- bipgraph.h, bipgraph.cpp
+++ /dev/null
-/* Copyright (C) 2006-2008 Joris Mooij [j dot mooij at science dot ru dot nl]
- Radboud University Nijmegen, The Netherlands
-
- This file is part of libDAI.
-
- libDAI is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- libDAI is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with libDAI; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-
-/*=================================================================*
- * *
- * This is a MEX-file for MATLAB. *
- * *
- * [psi_out] = dai_removeshortloops(psi_in); *
- * *
- *=================================================================*/
-
-
-#include <iostream>
-#include "mex.h"
-#include "matlab.h"
-#include "factorgraph.h"
-
-
-using namespace std;
-
-
-/* Input Arguments */
-
-#define PSI_IN prhs[0]
-#define NR_IN 1
-
-
-/* Output Arguments */
-
-#define PSI_OUT plhs[0]
-#define NR_OUT 1
-
-
-void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray*prhs[] ) {
- // Check for proper number of arguments
- if ((nrhs != NR_IN) || (nlhs != NR_OUT)) {
- mexErrMsgTxt("Usage: [psi_out] = dai_removeshortloops(psi_in);\n\n"
- "\n"
- "INPUT: psi_in = linear cell array containing the factors\n"
- " (psi{i} is a structure with a Member field\n"
- " and a P field, like a CPTAB).\n"
- "\n"
- "OUTPUT: psi_out = linear cell array containing the factors of psi_in,\n"
- " where factors have been merged to prevent short loops\n"
- " of length 4 in the factor graph (i.e. loops of type\n"
- " var1-factor1-var2-factor2-var1),\n");
- }
-
- // Get the factors from PSI_IN
- vector<Factor> psi = mx2Factors(PSI_IN, 0);
-
- // Remove the short loops
- RemoveShortLoops(psi);
-
- // Hand over results to MATLAB
- PSI_OUT = Factors2mx(psi);
-
-
- return;
-}
+++ /dev/null
-% [psi_out] = dai_removeshortloops (psi_in)
-%
-% INPUT: psi_in = linear cell array containing the factors
-% (psi{i} is a structure with a Member field
-% and a P field, like a CPTAB).
-%
-% OUTPUT: psi_out = linear cell array containing the factors of psi_in,
-% where factors have been merged to prevent short loops
-% of length 4 in the factor graph (i.e. loops of type
-% var1-factor1-var2-factor2-var1).
+++ /dev/null
-/* Copyright (C) 2006-2008 Joris Mooij [j dot mooij at science dot ru dot nl]
- Radboud University Nijmegen, The Netherlands
-
- This file is part of libDAI.
-
- libDAI is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- libDAI is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with libDAI; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-
-#include <iostream>
-#include <cstdlib>
-#include <dai/factorgraph.h>
-
-
-using namespace dai;
-using namespace std;
-
-
-int main( int argc, char *argv[] ) {
- if( argc != 3 ) {
- cout << "Usage: " << argv[0] << " <in.fg> <out.fg>" << endl << endl;
- cout << "Merges short loops (of length 4 in the factor graph) in <in.fg>" << endl;
- cout << "and writes result to <out.fg>." << endl;
- cout << "Returns 2 in case of error reading <in.fg>, 1 if there are no" << endl;
- cout << "short loops present and 0 if short loops have been merged." << endl;
- return 1;
- } else {
- // Read factorgraph
- FactorGraph fg;
- char *infile = argv[1];
-
- if( fg.ReadFromFile( infile ) ) {
- cerr << "Error reading file " << infile << endl;
- return 2;
- } else {
- vector<Factor> fg_facs;
-
- fg_facs.reserve( fg.nrFactors() );
- for( size_t I = 0; I < fg.nrFactors(); I++ )
- fg_facs.push_back( fg.factor(I) );
-
- if( hasShortLoops( fg_facs) ) {
- RemoveShortLoops( fg_facs );
- FactorGraph newfg( fg_facs );
- newfg.WriteToFile( argv[2] );
- return 0;
- } else {
- fg.WriteToFile( argv[2] );
- return 1;
- }
- }
- }
-}