Added toString(const T&), cleaned up utils/uai2fg and added tests/twofactors.fg
[libdai.git] / ChangeLog
1 git master HEAD
2 ---------------
3
4 * Made all "verbose" properties optional
5 * Unit tests should now also work on WINDOWS
6 * [Stefano Pellegrini] Fixed bug in JTree::findMaximum()
7 * Fixed some bugs in the MatLab interface build system
8 * Fixed a bug in utils/fginfo.cpp
9 * Added utils/uai2fg, a utility to convert the UAI inference competition file
10 formats to the libDAI factor graph file format
11 * utils/createfg now has a new factor type ('ISINGUNIFORM') and the old
12 'ISING' factor type has been renamed to 'ISINGGAUSS'
13 * tests/testdai option "marginals" now has five possible values: NONE
14 outputs no marginals, VAR only variable marginals, FAC only factor
15 marginals, VARFAC both types of marginals, and ALL outputs all
16 marginals calculated by the algorithm.
17 * Improved mf.h/cpp:
18 - Added an "init" option that allows to initialize randomly
19 - Added an "updates" option that allows to choose between standard
20 mean field and "hard-spin" mean field
21 * Improved exactinf.h/cpp:
22 - Added ExactInf::findMaximum()
23 * Improved treeep.h/cpp:
24 - changed TreeEP::construct( const RootedTree& ) into
25 TreeEP::construct( const FactorGraph&, const RootedTree& )
26 - Now also supports disconnected factor graphs
27 * Improved jtree.h/cpp:
28 - changed JTree::construct( const std::vector<VarSet>&, bool ) into
29 JTree::construct( const FactorGraph&, const std::vector<VarSet>&, bool )
30 - changed JTree::GenerateJT( const std::vector<VarSet> & )
31 into JTree::GenerateJT( const FactorGraph &, const std::vector<VarSet> & )
32 - Now also supports disconnected factor graphs
33 - Fixed a bug in JTree::findMaximum() and simplified the code
34 * Improved regiongraph.h/cpp:
35 - Made (previously public) members RegionGraph::G, RegionGraph::ORs,
36 RegionGraph::IRs and RegionGraph::fac2OR protected.
37 - Removed partial constructor RegionGraph::RegionGraph( const FactorGraph& fg )
38 - Added some error checking code
39 - Renamed RegionGraph::calcCountingNumbers() into
40 RegionGraph::calcCVMCountingNumbers() and made it protected, because
41 exposing it to the world serves no purpose.
42 - Added RegionGraph::DAG() accessor which returns a reference to the
43 region graph DAG structure (currently implemented as a BipartiteGraph)
44 - Made RegionGraph::RecomputeORs(), RegionGraph::RecomputeORs( const VarSet& )
45 and RegionGraph::RecomputeOR( size_t ) protected and renamed them by changing
46 the "Recompute" into "recompute", because exposing them to the world serves no
47 purpose.
48 - RegionGraph::WriteToFile( const char* ), RegionGraph::ReadFromFile( const char * )
49 and RegionGraph::printDot( std::ostream& ) incorrectly called their respective
50 FactorGraph ancestor methods; this has been corrected by letting them throw a
51 NOT_IMPLEMENTED exception.
52 - Changed the way a RegionGraph is streamed to an std::ostream.
53 * Improved clustergraph.h/cpp:
54 - Made (previously public) members ClusterGraph::G, ClusterGraph::vars and
55 ClusterGraph::clusters private and added ClusterGraph::bipGraph(),
56 ClusterGraph::vars() and ClusterGraph::clusters() methods which offer
57 read-only access to these members.
58 - Deprecated ClusterGraph::toVector()
59 - Added ClusterGraph::nrVars() method
60 - Renamed ClusterGraph::size() method into ClusterGraph::nrClusters()
61 - Added ClusterGraph::var( size_t ) method
62 - Added ClusterGraph::cluster( size_t ) method
63 * Improved factorgraph.h/cpp:
64 - FactorGraph::clamped() now contains a delta factor for the clamped variable
65 - Renamed FactorGraph::Cliques() into FactorGraph::maximalFactorDomains()
66 - Added FactorGraph::MarkovGraph()
67 - Fixed bug in FactorGraph::clone()
68 - FactorGraph::findVars( const VarSet& ) now returns a SmallSet<size_t>
69 and its argument now has a const-qualifier (which fixes a small bug).
70 - Made (previously public) member FactorGraph::G private and added the
71 FactorGraph::bipGraph() method, which offers read-only access to it.
72 - Deprecated the iterator interface:
73 o FactorGraph::iterator typedef
74 o FactorGraph::const_iterator typedef
75 o FactorGraph::begin() members
76 o FactorGraph::end() members
77 - Deprecated FactorGraph::factor(size_t) which offered write access to a factor
78 because using this functionality in the descendant RegionGraph is dangerous,
79 as the outer regions are not automatically recomputed.
80 * Improved factor.h/cpp:
81 - Fixed bug in min( const TFactor<T> &, const TFactor<T> & )
82 - Fixed bug in max( const TFactor<T> &, const TFactor<T> & )
83 - Added TFactor<T>::takeAbs()
84 - Added TFactor<T>::takeExp()
85 - Added TFactor<T>::takeLog( bool )
86 - Added TFactor<T>::operator-() const
87 - Added TFactor<T>::sumAbs() const
88 - Added TFactor<T>::operator==( const TFactor<T> &y )
89 - Renamed TFactor<T>::states() into TFactor<T>::nrStates()
90 - Added TFactor<T>::get(size_t) and TFactor<T>::set(size_t,T) operators;
91 get() is equivalent to "operator[](size_t) const" and set() should
92 be used instead of the non-const operator[], which has been deprecated
93 * Improved prob.h/cpp:
94 - Deprecated TProb::TProb( TIterator begin, TIterator end, size_t sizeHint=0 )
95 constructor: the sizeHint argument no longer defaults to 0
96 - Deprecated TProb::accumulate( T init, binOp op1, unOp op2 );
97 instead, TProb::accumulateSum( T init, unOp op ) and
98 TProb::accumulateMax( T init, unOp op, bool minimize ) should be used.
99 - Deprecated TProb::NormType and TProb::DistType;
100 ProbNormType and ProbDistType should be used instead.
101 - Added TProb<T>::operator==( const TProb<T> &q )
102 - TProb<T>::accumulate() now also applies op2 to init
103 - Fixed bug by renaming TProb<T>::operator<=() to TProb<T>::operator<()
104 - TProb<T>& operator/= (T x) now yields 0 when dividing by 0
105 - Changed format of TProb<T> when streamed to an ostream
106 - Added TProb<T>::get(size_t) and TProb<T>::set(size_t,T) operators;
107 get() is equivalent to "operator[](size_t) const" and set() should
108 be used instead of the non-const operator[], which has been deprecated
109 - Added TProb<T>::resize(size_t)
110 * Improved index.h/cpp:
111 - Added multifor::reset()
112 * Improved properties.h/cpp:
113 - Renamed PropertySet::Set() -> PropertySet::set()
114 - Renamed PropertySet::Get() -> PropertySet::get()
115 - Renamed PropertySet::GetAs<T>() -> PropertySet::getAs<T>()
116 - Renamed PropertySet::ConvertTo<T>() -> PropertySet::convertTo<T>()
117 - Added PropertySet::size()
118 - Added PropertySet::clear()
119 - Added PropertySet::erase()
120 - Fixed bug in PropertySet::setAsString<T>()
121 * Improved util.h/cpp:
122 - Added std::string toString( const T& x )
123 - Fixed a bug in rnd_seed()
124 - Removed max( const std::vector<Real> &v )
125 * Improved weightedgraph.h/cpp:
126 - Renamed MaxSpanningTreePrims into MaxSpanningTree
127 - Renamed MinSpanningTreePrims into MinSpanningTree
128 - Added option to MaxSpanningTree and MinSpanningTree for
129 choosing between Prim's algorithm and Kruskal's algorithm
130 - Better error checking in RootedTree constructor
131 - The vertices in DEdge and UEdge are now named "first" and "second"
132 for compatibility with a std::pair<size_t,size_t>
133 - Added GraphEL::GraphEL( const GraphAL& G ) constructor
134 * Improved bipgraph.h/cpp:
135 - Fixed bug in BipartiteGraph::eraseNode1()
136 - Fixed bug in BipartiteGraph::eraseNode2()
137 - Fixed bug in BipartiteGraph::isTree()
138 - Added BipartiteGraph::hasEdge()
139 - Added BipartiteGraph::findNb1()
140 - Added BipartiteGraph::findNb2()
141 - BipartiteGraph::delta1() and BipartiteGraph::delta2() now
142 return a SmallSet<size_t> instead of a vector<size_t>
143 - Added BipartiteGraph::operator==( const BipartiteGraph& )
144 - Added BipartiteGraph( size_t nr1, size_t nr2 ) constructor
145 - Added operator<<( std::ostream&, const BipartiteGraph& )
146 * Improved graph.h/cpp:
147 - Fixed bug in GraphAL::nrEdges()
148 - Fixed bug in GraphAL::addEdge()
149 - Fixed bug in GraphAL::isTree()
150 - Fixed bug in GraphAL::eraseNode()
151 - Fixed bug in GraphAL::printDot()
152 - Fixed bug in createGraphGrid3D()
153 - Fixed bug in createGraphRegular()
154 - Added GraphAL::hasEdge(size_t,size_t)
155 - Added GraphAL::operator==( const GraphAL& )
156 - Added operator<<( std::ostream&, const GraphAL& )
157 * Improved smallset.h/cpp:
158 - The sizeHint argument of the iterator constructor
159 SmallSet::SmallSet( TIterator begin, TIterator end, size_t sizeHint=0 )
160 no longer has a default value in order to avoid confusion with the
161 SmallSet::SmallSet( const T &t1, const T &t2 )
162 constructor.
163 - Added SmallSet::insert( const T& t ) method
164 * Removed RandomDRegularGraph(), please use createGraphRegular() instead
165 * Compressed Makefile
166 * Added unit tests for var, smallset, varset, graph, bipgraph,
167 weightedgraph, enum, util, exceptions, properties, index, prob,
168 factor, factorgraph, clustergraph, regiongraph, daialg, alldai
169 * Added unit testing framework
170 * Added initialization of TRWBP weights by sampling spanning trees
171 * Cleaned up MR code:
172 - rewrote response propagation implementation with help of BBP
173 - now uses GraphAL to represent the Markov graph
174 - miscellaneous smaller cleanups
175 * Fixed bug in BBPCostFunction::operator=() which prevented the desired
176 assignment from happening
177 * [Stefano Pellegrini] Fixed bug in BP[logdomain=1,inference=MAXPROD]
178 * Removed deprecated functionality
179 * Updated ChangeLog for libDAI-0.2.4 (forgot a few entries)
180
181
182 libDAI-0.2.4 (2010-02-11)
183 -------------------------
184
185 New features:
186 * Implemented Tree-Reweighted BP
187 * [Frederik Eaton] Implemented Fractional Belief Propagation
188
189 Miscellaneous improvements:
190 * Improved documentation
191 * [Frederik Eaton] Added constructors for BBPCostFunction
192 * [Frederik Eaton] Added accessor/mutator for the elements of a SmallSet<>
193 * [Frederik Eaton] Added unary minus to TProb<>
194 * [Frederik Eaton] Added Hellinger distance to TProb<>::DistType
195 * [Frederik Eaton] Two small patches for src/jtree.cpp and utils/createfg.cpp
196 * tests/testdai option "marginals" now has three possible values: NONE
197 outputs no marginals, VAR only variable marginals, and ALL outputs all
198 marginals calculated by the algorithm.
199 * Strengthened convergence criteria of various algorithms
200 * Added GraphAL, an adjacency list implementation for graphs,
201 similar to (but simpler than) BipartiteGraph
202 * Added some functionality to create various standard factors
203 (the functions whose names start with "createFactor")
204 * Added examples example_sprinkler_gibbs and example_sprinkler_em
205 * Implemented various heuristics for choosing a variable elimination sequence
206 in JTree
207 * Added BETHE method for GBP/HAK cluster choice
208 * Made alias support official part of the library
209
210 Build system:
211 * Moved platform independent build options into Makefile.ALL
212 * Windows platform now needs Boost 1.37 or higher
213
214 Code cleanup:
215 * Cleaned up utils/createfg and tests/testdai
216 * Cleanup of some duplicate code in BP, FBP, TRWBP
217
218 Interface changes (the old interface is marked obsolete and will be removed in the next release):
219 * Removed obsolete/deprecated stuff
220 * Renamed Graph into GraphEL (for Graph, implemented as Edge List)
221 * Renamed some functions of BipartiteGraph:
222 add1() -> addNode1()
223 erase1() -> eraseNode1()
224 nr1() -> nrNodes1()
225 add2() -> addNode2()
226 erase2() -> eraseNode2()
227 nr2() -> nrNodes2()
228 * Renamed some functions in ClusterGraph:
229 ClusterGraph::eliminationCost() -> ::eliminationCost_MinFill()
230 ClusterGraph::VarElim() -> ClusterGraph::VarElim( sequentialVariableElimination( ElimSeq ) )
231 ClusterGraph::VarElim_MinFill() -> ClusterGraph::VarElim( greedyVariableElimination( eliminationCost_MinFill ) )
232 * Changed interface of one RegionGraph constructor
233 * Renamed "Clamped BP" into "Conditioned BP"
234
235 Bug fixes:
236 * Fixed regression in scripts/regenerate-properties (now all errors are
237 gathered before throwing the exception, as used to be the case)
238 * Fixed FTBFS errors on MACOSX (thanks to Sebastian Riedel for reporting this bug)
239 * [Alexander Schwing] Fixed error in BP that occured with damping
240 and using log-domain updates
241 * Fixed bug in HAK for trivial region graphs (with only one outer region
242 and no inner regions), reported by Alejandro Lage.
243 * Fixed long-standing bug in TreeEP (now, within-loop propagation optimization works)
244
245
246 libDAI-0.2.3 (2009-11-16)
247 -------------------------
248
249 New features:
250 * Complete doxygen documentation (although more detailed documentation still
251 has to be written)
252 * [Charles Vaske] Added parameter learning for conditional probabilities by
253 Expectation Maximization
254 * [Patrick Pletscher] Added SWIG wrapper code for experimental python and
255 octave interfaces
256 * Added Max-Product functionality to JTree
257 * [Frederik Eaton] Added Back-Belief-Propagation
258 * [Frederik Eaton] Added approximate inference method "Clamped Belief Propagation"
259 * [Frederik Eaton] Added approximate inference method "Gibbs sampling"
260
261 Code cleanup:
262 * Updated copyright headers
263 * Cleaned up error handling by introducing the DAI_THROWE macro
264 * Introduced DAI_DEBASSERT macro to abbreviate a common pattern
265 * Replaced the standard assert() macro by DAI_ASSERT, which throws a
266 dai::Exception and is even active if NDEBUG is defined
267 * Removed all the virtual default constructors *::create(), as they are not used
268 * [Frederik Eaton] Removed unnecessary copy constructors and assignment operators
269 * [Frederik Eaton] Change cout to cerr in warnings and error messages
270
271 Miscellaneous improvements:
272 * BipartiteGraph:
273 - Added eraseEdge( size_t n1, size_t n2 )
274 - [Frederik Eaton] Improved documentation of Neighbor
275 * TProb<T>:
276 - Added divided_by(const TProb<T>&) const
277 - Added constructor TProb<T>( const std::vector<S> &v )
278 - Added size_t draw(), which draws a random index
279 - [Frederik Eaton] Added setUniform()
280 - [Frederik Eaton] Added sumAbs()
281 - [Frederik Eaton] Added argmax()
282 - [Giuseppe Passino] Added begin(), end()
283 * TFactor<T>:
284 - [Giuseppe Passino] Added begin(), end()
285 - [Charles Vaske] Added TFactor( const std::vector<Var> &vars, const std::vector<T> &p ),
286 which reorders variables to canonical ordering before storing the table
287 - Added constructor TFactor<T>( const VarSet &vars, const std::vector<S> &v )
288 - Extended functionality of TFactor<T>::operators +,-,+=,-= to handle different VarSets
289 - Added TFactor<T>::maxMarginal (similar to marginal but with max instead of sum)
290 * State:
291 - [Giuseppe Passino] Added prefix ++ operator
292 * Permute:
293 - [Charles Vaske] Added constructor in Permute for canonical variable ordering
294 * FactorGraph:
295 - [Frederik Eaton] Added clampVar()
296 - [Frederik Eaton] Added clampFactor()
297 - [Giuseppe Passino] Added begin(), end()
298 * PropertySet:
299 - Added keys(), for getting all keys
300 - [Frederik Eaton] Added default constructor
301 - [Frederik Eaton] Added constructor from string
302 * InfAlg:
303 - Added setProperties(), getProperties() and printProperties()
304 - [Frederik Eaton] Added beliefV(), beliefF()
305 * ExactInf:
306 - Added calcMarginal(const VarSet &)
307 * HAK:
308 - Added "init" parameter to allow for random initialization
309 * BP:
310 - [Giuseppe Passino] Added findMaximum(), which can be used after running
311 max-product BP to construct a global state with maximum probability
312 * JTree:
313 - Added findMaximum(), which can be used after running
314 max-product JTree to construct a global state with maximum probability
315 * MatLab interface:
316 - MEX file dai now also returns variable and factor beliefs
317 - [Sebastian Nowozin] MEX file dai now also optionally returns the MAP state
318 (only for BP and JTree)
319 * README is now created automatically from doxygen documentation
320 * [Frederik Eaton] Added script for automatically generating properties code (used by CBP and BBP)
321 * [Frederik Eaton] Added newInfAlgFromString to alldai.h/cpp
322 * [Frederik Eaton] Added some utility macros (DAI_PV, DAI_DMSG, DAI_IFVERB)
323 and functions (concat(),rnd()) to util.h
324 * Changed output stream operator<< for Var and VarSet
325 * [Frederik Eaton] Improved parsing code in tests/testdai to allow recursive
326 alias substitutions
327 * [Frederik Eaton] Added useful aliases to aliases.conf
328 * [Giuseppe Passino] Optimised maximum-residual BP by using a reversed ordered
329 set instead of the linear search (which can yield enormous speedups - a
330 factor 500 has been measured on a binary Ising grid with 128x128 variables!)
331 * Added debug assertions to Var which check for inconsistent dimensions of
332 variables with the same labels
333 * toc() now returns POSIX system time with maximum accuracy of microseconds
334 * Exception objects now remember their error code
335 * Examples:
336 - Moved example.cpp to examples/
337 - Added examples/example_bipgraph.cpp
338 - Added examples/example_varset.cpp
339 - Added examples/example_sprinkler.cpp
340 - Added examples/example_permute.cpp
341 - Added python and octave ports for examples/example_sprinkler.cpp
342
343 Build system:
344 * Improved Makefile:
345 - Merged Makefile.win and Makefile.shared into Makefile
346 - Macros DAI_VERSION and DAI_DATE have been introduced,
347 in order to store this information in a central place
348 - Introduced CCNODEBUGFLAGS in Makefile
349 - Switched Makefile.win to GNU Make syntax
350 - [Frederik Eaton] Added TAGS, lib targets to Makefile
351 * Compatibility:
352 - [Peter Gober] libDAI can now be built on Cygwin
353 - [Dan Preston] libDAI can now be built on Mac OS X
354 - Changed regression test so that it also works under Windows
355
356 Interface changes (the old interface is marked obsolete and will be removed in the next release):
357 * Var:
358 - Variable labels are now nonnegative (of type size_t)
359 * VarSet:
360 - Replaced calcState() by non-member calcLinearState()
361 - Replaced calcStates() by non-member calcState()
362 * Permute:
363 - Renamed convert_linear_index into convertLinearIndex
364 * TProb<>:
365 - Replaced log0() by log(true)
366 - Replaced takeLog0() by takeLog(true)
367 - Removed hasNonPositives()
368 - Renamed minVal() to min()
369 - Renamed maxVal() to max()
370 - Renamed totalSum() to sum()
371 * TFactor<>:
372 - Replaced log0() by TFactor<T>::log(true)
373 - Removed divided_by, use operator/ instead
374 - Removed divide, use operator/= instead
375 - Removed partSum(const VarSet&), use marginal(const VarSet&,false) instead
376 - Renamed minVal() to min()
377 - Renamed maxVal() to max()
378 - Renamed totalSum() to sum()
379 * FactorGraph:
380 - Changed clamp and clamp interfaces (the variable to be
381 clamped is now indicated by its index, not as a Var)
382 * RegionGraph:
383 - Renamed Check_Counting_Numbers into checkCountingNumbers
384 - Renamed Calc_Counting_Numbers into calcCountingNumbers
385 * Miscellaneous:
386 - Renamed Treewidth(const FactorGraph &) into boundTreewidth(const FactorGraph &)
387 - Replaced UEdgeVec by Graph
388 - Replaced DEdgeVec by new RootedTree class
389 - Moved functionality of GrowRootedTree() into constructor of RootedTree
390 - Merged calcPairBeliefsNew() into calcPairBeliefs()
391 - Removed calcMarginal2ndO()
392 - Renamed smallSet<T> to SmallSet<T>
393 - Removed class Diffs
394 - [Frederik Eaton] Added backwards compatibility layer for edge interface to
395 BipartiteGraph and FactorGraph (which will be obsoleted soon)
396
397 Bug fixes:
398 * Fixed reversal of min and max in
399 TFactor<T> min( const TFactor<T> &, const TFactor<T> & )
400 TFactor<T> max( const TFactor<T> &, const TFactor<T> & )
401 * [Sebastian Nowozin] Fixed memory leak in MEX file dai
402 * [Frederik Eaton] In PropertySet::getStringAs(), check for typeid(ValueType)
403 before typeid(std::string) (this fixes a strange bug for empty string property)
404 * Added work-around for bug in Boost Graph Library
405 * Fixed bug in MaxSpanningTree (it wrongly assumed that the tree was not empty).
406 * Fixed bug in calcMarginal and calcPairBeliefs where states with zero probability
407 mass were clamped, leading to NaNs or assertion errors (thanks to Dan Preston
408 for reporting this)
409
410
411 libDAI-0.2.2 (2008-09-30)
412 -------------------------
413
414 New features:
415 * Approximate inference methods now report the number of iterations needed.
416 * Added damping to various algorithms to improve convergence properties.
417 * Added more features to utils/createfg for creating factor graphs.
418 * Added ExactInf class for brute force exact inference.
419 * [Giuseppe Pasino] Added "logdomain" property to BP, a boolean that controls
420 whether calculations are done in the log-domain or in the linear domain;
421 doing calculations in the log-domain may help if the numerical range
422 of a double is too small.
423 * [Claudio Lima] Added Max-Product functionality to BP.
424 * Improved documentation.
425
426 Improved architecture:
427 * Added Exceptions framework.
428 * Pervasive change of BipartiteGraph implementation (based on an idea by
429 Giuseppe Passino). BipartiteGraph no longer stores the node properties
430 (former _V1 and _V2), nor does it store a dense adjacency matrix anymore,
431 nor an edge list. Instead, it stores the graph structure as lists of
432 neighboring nodes. This yields a significant memory/speed improvement for
433 large factor graphs, and is more elegant as well. Iterating over neighbors is
434 made easy by using boost::foreach.
435 * Added conditional compilation of inference methods.
436 * VarSet is now implemented using a std::vector<Var> instead of a
437 std::set<Var>, which yields a significant speed improvement. Furthermore,
438 the implementation has been generalized, resulting in the small_set<T> class
439 which can be used to represent sets of small cardinality; VarSet is the
440 specialization with T = Var.
441 * Improved ClusterGraph implementation, yielding significant speedups
442 for the JunctionTree algorithm on large factorgraphs.
443
444 Code cleanup:
445 * Moved everything into namespace "dai".
446 * Renamed DEBUG to DAI_DEBUG to avoid conflicts.
447 * Replaced ENUM2,ENUM3,ENUM4,ENUM5,ENUM6 by single DAI_ENUM macro.
448 * Removed utils/remove_short_loops and matlab/remove_short_loops.
449 * Replaced sub_nb class in mr.h by boost::dynamic_bitset.
450 * Improved index.h:
451 - Renamed Index -> IndexFor
452 - Added some .reserve()'s to IndexFor methods which yields a
453 25% speedup of testregression
454 - Replaced multind by Permute
455 - Added MultiFor
456 - Added State
457 * New funcstionality of factor.h.
458 * Moved Properties and MaxDiff frameworks from InfAlg to each individual
459 inference algorithm, because the Properties framework was not as
460 convenient as I hoped, and not every inference algorithm needs a maxdiff
461 variable. Also, replaced some FactorGraph functionality in InfAlg by a
462 function that returns the FactorGraph. The result is cleaner (less
463 entangled) code.
464 * Removed x2x.
465 * Replaced Complex with real numbers (negative potentials are just too rare
466 to warrant the additional "complexity" :)).
467
468 Miscellaneous improvements:
469 * Now compiles also with MS Visual C++ (thanks to Jiuxiang Hu) and with
470 GCC under cygwin.
471 * Contributions by Peter Gober:
472 - Renamed variable _N in mr.* for compatibility with g++ under cygwin.
473 * Misc contributions by Giuseppe Passino:
474 - removed "using namespace std;" from header files - bad practice;
475 - moved header files in include/dai and sources in src;
476 - changed #ifndefs to GNU style;
477 - added extra warning checks (-W -Wextra) and fixed resulting warnings;
478 - dai::TProb:
479 o removed copy constructor and assignment operators (redundant);
480 o implementation of some methods via STL algorithms;
481 o added methods takeExp, takeLog, takeLog0 for transformation in-place;
482 o explicit constructor (prevents implicit conversion from size_t to TProb);
483 o added operator+,+=,-,-=, with argument T (for calculations in log-scale);
484 * Misc contributions by Christian Wojek:
485 - New FactorGraph constructor that constructs from given ranges of factors
486 and variables;
487 - Optimization of FactorGraph constructors using tr1::unordered_map.
488 * FactorGraph constructors no longer check for short loops (huge speed
489 increase for large factor graphs), nor for negative entries. Also, the
490 normtype is now Prob::NORMPROB by default.
491 * Improved MaxSpanningTreePrims algorithm (uses boost::graph).
492
493 Interface changes:
494 * VarSet::
495 - VarSet::stateSpace() -> nrStates(const VarSet &)
496 - VarSet( const std::set<Var> ) -> VarSet( begin, end, sizeHint=0 )
497 - VarSet( const std::vector<Var> ) -> VarSet( begin, end, sizeHint=0 )
498 - removed bool operator||
499 - operator&&(const VarSet&) -> intersects(const VarSet&)
500 - operator&&(const Var&) -> contains(const Var&)
501 * FactorGraph::
502 - delta(const Var &) -> delta(size_t)
503 - Delta(const Var &) -> Delta(size_t)
504 - makeCavity(const Var &) -> makeCavity(size_t)
505 - vars() -> vars
506 - factors() -> factors
507 - removed MakeFactorCavity(size_t)
508 - removed ExactMarginal(const VarSet &)
509 - removed ExactlogZ()
510 - removed updatedFactor(size_t)
511 - removed _normtype and NormType()
512 - removed hasShortLoops(...) and removeShortLoops(...)
513 - WriteToDotFile(const char *filename) -> printDot( std::ostream& os )
514 - undoProb(size_t) -> restoreFactor(size_t)
515 - saveProb(size_t) -> backupFactor(size_t)
516 - undoProbs(const VarSet &) -> restoreFactors(const VarSet &)
517 - saveProbs(const VarSet &) -> backupFactors(const VarSet &)
518 - ReadFromFile(const char*) returns void (throws on error)
519 - WriteToFile(const char*) returns void (throws on error)
520 - removed hasNegatives()
521 * RegionGraph::
522 - nr_ORs() -> nrORs()
523 - nr_IRs() -> nrIRs()
524 - ORs() -> ORs
525 - IRs() -> IRs
526 * *::Regenerate() -> *::construct()
527 * Renamed Index -> IndexFor
528 * Diffs:
529 - max() -> maxDiff()
530 - max_size() -> maxSize()
531 * Prob::max() -> Prob::maxVal()
532 * Factor::
533 - max() -> maxVal()
534 - part_sum() -> partSum()
535 * toc() in util.h now returns seconds as a double
536 * VarSet::operator&&
537 * Properties -> PropertySet
538
539
540 libDAI-0.2.1 (2008-05-26)
541 -------------------------
542
543 Bugfix release.
544 * added missing cstdio header in util.h
545 * fixed Properties in MR_CLAMPING_* and MR_EXACT_*
546 * added description of the factor graph fileformat
547 * improved Makefile
548
549
550 libDAI-0.2.0 (2006-11-30)
551 -------------------------
552
553 First public release.
554
555
556 0.1.5 (2006-11-30)
557 ------------------
558
559 Regressions
560
561 - tests/testlcbp and tests/testlcbp are broken.
562 - EXACT method does not work anymore.
563 - The Properties framework gives a speed penalty because of the lookup
564 costs involved; inner loops should be optimized.
565
566 General framework
567
568 - DAIAlg is now a template class; typedefs for DAIAlg<FactorGraph> and for
569 DAIAlg<RegionGraph> are provided. In this way, we do not have to write "wrapper"
570 functions to forward functionality from either FactorGraph or RegionGraph
571 to DAIAlg. Functionality like clamping can be implemented in FactorGraph
572 and in RegionGraph and no explicit interface is needed in descendants.
573 - New abstract base class InfAlg added, representing an inference algorithm,
574 from which DAIAlg<T> inherits. This solves the incompatibility problems of
575 DAIAlg<T> for different T (e.g. DAIAlg<FactorGraph> was incompatible with
576 DAIAlg<RegionGraph>). More work is required to reduce code duplication
577 (make FactorGraph part of InfAlg).
578 - Added generic interface (nrVars(), Vars(), nrFactors(), factor(size_t),
579 beliefs(), belief(VarSet &), ...) to InfAlg and descendants.
580 - Added a saveProbs/undoProbs interface to InfAlg and descendants that enables
581 one to save a few factors, modify them (e.g. clamp them), and then restore them
582 to their old values. Undo should also init the corresponding messages / beliefs.
583 This can be used if a given factor graph repeatedly needs to be clamped in
584 different ways and an approximation method is run for each clamping; using the
585 saveProbs/undoProbs can give a significant speed increase.
586 - Switched to a general Properties framework that handles the parameters of
587 all inference methods in a uniform manner. The Properties class is a map of
588 several properties in boost::any objects, indexed by their names (strings).
589 It can read from a stream and write to a stream. It is recursive, in the sense
590 that a Properties object can hold a variable of type Properties as well.
591 - Added a generic way of constructing inference algorithms from a factor graph,
592 name and properties object. Added the newInfAlg function which constructs
593 the requested object. This is used by LCBP, the Matlab interface and the
594 command line (test) interface.
595 - Added a generic enum framework for enum parameters. Although implemented as a
596 hack, it is quite useful in that it drastically simplifies and reduces the
597 amount of code for handling enum parameters.
598 - Provided generic functions for calculating marginals in different ways that
599 work for all approximate inference methods.
600
601 Bugfixes
602
603 - Fixed GBP free energy.
604 - Fixed bug in junctiontree (it didn't init the _vars variable).
605 - Corrected two bugs in operator&& and operator|| in VarSet (they returned
606 the logical NOT of what they should return).
607 - Fixed bug in RegionGraph::RecomputeOR(s).
608 - Fixed bug in utils/create_dreg_fg:
609 graph structure was not random for given parameters (forgot to call srand()).
610 - TreeEP bug workaround: use the complete junction tree instead of a subtree.
611 - Fixed bug in JTree::HUGIN() and JTree:ShaferShenoy() in case of junction tree
612 that consists of one outer region only.
613 - Fixed INIT bug in LCBP2::UpdatePancake().
614 - Fixed MaxDiffs flow (except for MR).
615
616 New functionality
617
618 - HAK supports several default cluster choices:
619 minimal (only factors)
620 delta (Markov blankets)
621 loop (all loops consisting of loops consisting of <loopdepth> or less variables)
622 Only the maximal clusters are used as outer clusters.
623 - Implemented TreeEP. It generalizes the heuristic method described in the
624 Minka & Qi paper for obtaining a tree with the most relevant interactions to
625 higher order interactions. Almost all optimizations described in the Minka & Qi
626 paper are used, except that evidence is passed over the whole tree instead of
627 relevant subsets (the latter is almost implemented but buggy). Also added
628 alternative (worst-case) algorithm that uses a maximum spanning tree on the
629 weighted graph where the weight between neighbours i and j is given by
630 N(psi,i,j), where psi is the product of all the factors involving both i and j
631 (which is an upper bound on the effective interaction between i and j).
632 - Implemented MR (MontanariRizzo) based on Bastian's code, but extended it
633 to be able to handle connectivities larger than 3 (in principle, up to 32).
634 It supports different initialization methods (the original RESPPROP,
635 the CLAMPING method and EXACT which uses JTree) and different update methods
636 (FULL and LINEAR).
637 - Implemented LCBP2, an analogon of LCBP which represents pancakes as little
638 networks and uses some approximate inference method on them for calculating
639 marginals.
640 - Now there are several LCBP variants (LCBP, LCBPI, LCBPJ, LCBPK, LCBPL);
641 LCBPJ works only for pairwise, LCBPK is LCBP improved for higher order
642 interactions and LCBPL is LCBPI improved for higher-order interactions.
643 - Wrote one single program utils/createfg for creating various types of
644 random factor graphs.
645 - Wrote utility to visualize factor graphs using graphviz.
646 (it uses the BOOST Program Options library)
647 - Added fginfo utility that displays some info about a .fg file.
648 - Implemented Factor::strength function that calculates the potential strength
649 N(psi,i,j) between variables i and j as described in cs.IT:0504030
650 - Wrote a general MatLab interface matlab/dai (similar to tests/test);
651 this unified the matlab functions dai, dai_bp, dai_mf, dai_jt, dai_tep, dai_cvm.
652 - Added MATLAB routine that returns contraction matrix A for BP convergence analysis.
653 - Implemented a MATLAB interface ai_potstrength for Factor::strength
654 - Added Martijn's x2x
655
656 Improvements of existing code
657
658 - Reimplemented RegionGraph and descendants: a RegionGraph ISA FactorGraph
659 and also a BipartiteGraph<FRegion,Region>. It now also keeps a map that
660 associates outer region indices to factor indices (no powers yet, this
661 is deemed superfluous) and provides functions to recompute (some of) the
662 outer regions from the factors.
663 - InfAlg descendants run() methods now stop immediately and return NAN in case
664 they detect NANs. Only BP does not do NAN checking for performance reasons.
665 - LCBP now works with factors containing zeroes (by defining x/0 = 0).
666 - HAK, GBP and DoubleLoop now conform to the standards for verbose reporting,
667 timing and convergence criteria.
668 - Implemented logZ() for JTree. It does the calculation during message-passing.
669 - Marginal2ndO now optionally divides by the single node beliefs (to the power n-2);
670 hopefully this will give more accurate approximations.
671 - Marginal and Marginal2ndO (optionally) use the new saveProbs/undoProbs functionality
672 for a faster way of calculating marginals, which does not require a call to init()
673 nor cloning the whole object for each clamping. This leads to a significant speedup.
674 - LCBP (and LCBP2) now have complete flexibility in the specification of the
675 inner method, i.e. the method used to generate the initial cavity approximations.
676 One can pass two strings, a name and a properties string, and LCBP simply invokes
677 newInfAlg to construct the corresponding inference algorithm and uses the generic
678 marginal functions to approximate cavity marginals.
679 - Replaced the global "method" variable by local properties and removed ai.h
680 - Added some methods to Factor (operators *, *=, /, /= with doubles as
681 second argument, operators -, +=, -= with other Factors as second
682 arguments, randomize(), RemoveFirstOrderInteractions) and similar
683 operations to Prob
684 - Moving towards boost::program_options for handling command line arguments
685 (tests/test is done).
686 - Renamed some FactorGraph methods:
687 nr_vars -> nrVars
688 nr_factors -> nrFactors
689 varind -> findVar
690 factorind -> findFactor
691 makeFacCavity -> makeFactorCavity
692 - LCBP_SEQMAXRES has been removed because it did strange things.
693 - Implemented RandomDRegularGraph
694 - Implemented JTree::calcMarginal for marginals that are not confined
695 within one cluster (using cut-set conditioning).
696 - Added isConnected() method to FactorGraph (some methods do not work with
697 disconnected factor graphs).
698 - Pair beliefs are now calculated in a symmetrical way by calcPairBeliefs
699 - Removed single node interaction "correction" code from clamping methods
700 - Removed calcCavityDist and calcCavityDist2ndO
701 - No longer depends on GSL.
702 - Increased portability by combining platform dependant utility functions
703 in util.{h,cpp}.
704 - Wrote *.m files providing help
705
706 Testing framework
707
708 - Made a new and significantly improved testing framework that provides most
709 functionality from the command line.
710 - The basis is provided by tests/test, which uses the newInfAlg functionality
711 and enables the user to easily compare from the command line different
712 inference methods on a given factorgraph. All parameters can be specified.
713 Output consists of CPU time, average and maximum single variable marginal
714 errors, relative logZ error and MaxDiff().
715 - tests/aliases.conf contains aliases for standard combinations of methods
716 and their options (which can be used in tests/test).
717 - tests/large contains several bash/python scripts that create random factor
718 graphs, compare several approximate inference algorithms (using tests/test) and
719 allow for easy visualization of the results using PyX.
720 - Added several .fg files for test purposes to /tests (e.g. two ALARM versions
721 alarm.fg and alarm_bnt.fg; testfast.fg, a 4x4 periodic Ising grid for
722 regression testing).
723 - Added a regression test to the Makefile which is included in the standard
724 target. It compares all inference methods on tests/testfast.fg with the
725 results stored in tests/testfast.out
726
727 Miscellaneous
728
729 - Expanded all tabs to spaces (":set tabstop 4\n:set expandtab\n:retab" in vim)
730 - Experimental MATLAB code added for StarEP approximation on cavity
731 - Renamed project to libDAI and changed directory name accordingly.
732 - Renamed JunctionTree to JTree.
733 - Fixed licensing (now it's officially GPL).
734 - Improved README
735
736
737 revision 252
738 ------------
739
740 Functionality
741 - Added RegionGraph, GBP, CVM and HAK (double-loop).
742 - Added JunctionTree (with two update algorithms, HUGIN and Shafer-Shenoy), which is a
743 RegionGraph.
744 - NormType is now chosen automatically (in case of negative factors, Prob::NORMLINF is used,
745 otherwise the default Prob::NORMPROB is used). Also, in case of negative factors, the
746 RegionGraph constructors assign each Factor to a unique outer region instead of dividing
747 it over all subsuming outer regions. See README for when negative factors are known to work
748 and when not.
749 - FactorGraph::FactorGraph(const vector<Factor>) only gives a warning in case of short loops,
750 it does not automatically merge factors anymore.
751 - Removed BP_SEQMAXRESNOCLEAR (all cavity initialization methods now are implicitly NOCLEAR)
752 - Added MATLAB interface functions ai_readfg, ai_removeshortloops and ai_bp
753 - Added LCBP-III type that should be equivalent to LCBP-II, but can handle zeroes
754 in potentials. Note that it is significantly slower than LCBP-II (and has to be reimplemented
755 such that it does not store the complete pancakes, but represents them as little factor graphs).
756
757 Implementation / code
758 - Made a seperate type WeightedGraph, which until now only implements Prim's
759 maximal spanning tree algorithm and is only used by the junction tree code. It might
760 be good to make it a class somewhere in the future and extend it's interface.
761 - Made a seperate class ClusterGraph, which is only used by the junction tree
762 code. It's main purpose is a graph-theoretical variable elimination algorithm.
763 - Implemented the heuristic "minimum-new-edges-in-clique-graph" for variable elimination.
764 - Massive code cleanup, moving towards "generic" programming style, using
765 multiple inheritance and polymorphism.
766 o BP, LCBP, MF, HAK and JunctionTree now inherit from a common DAIAlg class
767 o Made generic functions Marginal, Marginal2ndO, calcCavityDist, calcCavityDist2ndO, clamp
768 that can be used by FactorGraph-based DAIAlgs.
769 o Created TProb<T> class, which stores a probability vector (without the accompanying indexing
770 and VarSet) and provides functionality for it (which is used by TFactor<T>).
771 o Rewrote the VarSet class. It now caches its statespace(). It now privately inherits from set<Var>.
772 I had to overload the insert methods of set<Var> so that they calculate the new statespace.
773 o Rewrote the TFactor class. The TFactor class now HAS a TProb and HAS a VarSet.
774 - Rewrote BP to use the new TProb<T> interface. Performance of BP improved up to a factor 6 by:
775 o using Prob's instead of Factor's;
776 o splitting the multiplication of the messages into two parts (thanks to Vicenc!);
777 o optimizing the calculation of the beliefs (only the message calculations were optimized till now).
778 o replacing FactorGraph::_nb1 and _nb2 (which were set<size_t>) by vector<size_t>
779 - LCBP now seperately stores cavitydists and pancakes. Added InitPancakes() method
780 that takes the cavitydists and multiplies them with the relevant factors. This
781 resulted in an API change in AI which now accepts and returns initial cavitydists
782 instead of initial pancakes.
783
784 Minor changes
785 - Started writing DoxyGen documentation
786 - Renamed lcptab2fg.m matlab/ai_writefg.m
787 - Moved all matlab stuff to matlab/
788 - More detailed reporting (also reports clocks used).
789 - Marginal and Marginal2ndO now use *differences* in logZ to avoid NaNs.
790 - Improved testing suite.
791 - Removed logreal support.
792 - FactorGraph now also supports input streams and ignores comment lines in .fg files.
793 - Added tests/create_full_fg.cpp and tests/create_ising_fg.cpp which create
794 full and periodic 2D Ising networks according to some command line parameters.
795 - Now logZ really returns logZ instead of -logZ.
796 - Added FactorGraph::WriteToDotFile
797
798
799 0.1.4 (2006-04-13)
800 ------------------
801 - Added file IO routines to read and write factorgraphs.
802 - Added L-infinity normalization for use with (partially) negative factors.
803 - Renamed BetheF, MFF to logZ, which now use complex numbers to be able to
804 handle (partially) negative factors.
805 - Added test suite.
806 - All probabilities are now represented using double instead of LogReal<double>.
807 - Combined Alg and Alg3 into LCBP. Several update schemes possible.
808 - Combined several variants of BP into doBP. Several update schemes possible.
809 Now uses precalculated indices for optimization.
810 - Renamed Node -> Var and Potential -> Factor.
811 - Extensive code cleanup. More use of OO techniques. Changed API.
812 - MaxIter now means maximum number of passes (corresponding to number of
813 _parallel_ updates).
814 - MaxDiff now means the maximum L-infinity distance between the updated and
815 original single variable beliefs, for all AI methods.
816 - Implemented RBP which converges faster than BP for difficult problems.
817 - Now uses method parameter which is a bitmask combining outmethod and inmethod
818 (see ai.h).
819
820
821 0.1.3 (2006-03-22)
822 --------------------
823 - All AI methods now return maxdiff
824 - ai.cpp:
825 o Now returns maxdiffinner and maxdiffouter
826 o New BP2ndO innermethod (estimate only 2nd order cavity interactions)
827 o New InitCav outermethod (only create initial cavity distributions)
828 - bp.cpp:
829 o New CavityDist2ndO which estimates 2nd order cavity interactions
830 - Makefile:
831 o Bugfix: removed dependencies on algwim.*
832
833
834 0.1.2 (2006-02-28)
835 --------------------
836 - Cleaned up alg.cpp (removed Alg2 and its corresponding data structures).
837 - Added the possibility to provide initial cavity distributions as an input
838 argument to ai (not much error checking is done, so be careful).
839 - Potentials2mx now correctly sets the dimensions of the P field (i.e. for
840 the output arguments Q, Q0 of ai).
841 - Removed algwim.* since it does not work.
842
843
844 0.1.1 (2006-02-28)
845 --------------------
846 - The constructors of (Log)FactorGraph and LogFactorGraph from a
847 vector<(Log)Potential> now merge potentials to prevent short loops (of length
848 4) in the factor graph. These are used in ai to construct the factor graphs
849 from the psi argument. If compiled with DEBUG defined, the method calc_nb()
850 of BipGraph checks for the existence of short loops.
851 - Changed calling syntax of ai (now the actual syntax *does* correspond to its
852 description in the help).
853 - ai does not hook cout anymore (which caused weird segfaults).
854 - Fixed a bug in an assert statement in the matlab interface code in ai.cpp.
855 - Removed network.* since it is not useful.
856
857
858 0.1.0 (2006-02-28)
859 --------------------
860 First version worthy of a version number.