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