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