1 * Improved Makefile (libDAI now also builds out-of-the-box on MacOSX,

2 thanks to Dan Preston; merged Makefile.win and Makefile.shared into Makefile)

3 * Fixed bug in calcMarginal, calcPairBeliefs, calcPairBeliefsNew where

4 states with zero probability mass were clamped, leading to NaNs or assertion

5 errors (thanks to Dan Preston for reporting this)

6 * toc() now returns POSIX system time with maximum accuracy of microseconds

7 * Exception objects now remember their error code

10 git 065eae35cbfcc36f1a945ae3053c80c23f366306

11 --------------------------------------------

12 * [Peter Gober] Made libDAI build out-of-the-box on Cygwin.

13 * [Frederik Eaton] Added Gibbs sampler to algorithms

14 * Improved documentation of include/dai/{bipgraph.h, prob.h, smallset.h,

15 var.h, varset.h, factor.h, enum.h} and of examples/example.cpp

16 Merged TODO and FILEFORMAT into doxygen documentation

17 * examples/

18 - Moved example.cpp to examples/

19 - Added examples/example_bipgraph.cpp

20 - Added examples/example_varset.cpp

21 * Interface changes:

22 - Replaced TProb<T>::log0() by TProb<T>::log(true)

23 - Replaced TProb<T>::takeLog0() by TProb<T>::takeLog(true)

24 - Replaced TFactor<T>::log0() by TFactor<T>::log(true)

25 - Removed TProb<T>::hasNonPositives()

26 - Renamed smallSet<T> to SmallSet<T>

27 - Removed TFactor<T>::divided_by, use operator/ instead

28 - Removed TFactor<T>::divide, use operator/= instead

29 - Removed TFactor<T>::partSum(const VarSet&), use marginal(const VarSet&,true) instead

30 - Improved constructors of TProb and TFactor to use iterators instead of pointers

31 * Miscellaneous small changes and cleanups:

32 - Changed regression test so that it also works under Windows

33 - Changed output stream operator<< for Var and VarSet

34 - Added TProb::draw() function, which draws a random index

35 - Cleanup of matlab interface code

36 - Small improvement of utils/fginfo

37 - Small cleanup of BP code

38 - Switched Makefile.win to GNU Make syntax

41 libDAI-0.2.2 (2008-09-30)

42 -------------------------

44 New features:

45 * Approximate inference methods now report the number of iterations needed.

46 * Added damping to various algorithms to improve convergence properties.

47 * Added more features to utils/createfg for creating factor graphs.

48 * Added ExactInf class for brute force exact inference.

49 * [Giuseppe Pasino] Added "logdomain" property to BP, a boolean that controls

50 whether calculations are done in the log-domain or in the linear domain;

51 doing calculations in the log-domain may help if the numerical range

52 of a double is too small.

53 * [Claudio Lima] Added Max-Product functionality to BP.

54 * Improved documentation.

56 Improved architecture:

57 * Added Exceptions framework.

58 * Pervasive change of BipartiteGraph implementation (based on an idea by

59 Giuseppe Passino). BipartiteGraph no longer stores the node properties

60 (former _V1 and _V2), nor does it store a dense adjacency matrix anymore,

61 nor an edge list. Instead, it stores the graph structure as lists of

62 neighboring nodes. This yields a significant memory/speed improvement for

63 large factor graphs, and is more elegant as well. Iterating over neighbors is

64 made easy by using boost::foreach.

65 * Added conditional compilation of inference methods.

66 * VarSet is now implemented using a std::vector<Var> instead of a

67 std::set<Var>, which yields a significant speed improvement. Furthermore,

68 the implementation has been generalized, resulting in the small_set<T> class

69 which can be used to represent sets of small cardinality; VarSet is the

70 specialization with T = Var.

71 * Improved ClusterGraph implementation, yielding significant speedups

72 for the JunctionTree algorithm on large factorgraphs.

74 Code cleanup:

75 * Moved everything into namespace "dai".

76 * Renamed DEBUG to DAI_DEBUG to avoid conflicts.

77 * Replaced ENUM2,ENUM3,ENUM4,ENUM5,ENUM6 by single DAI_ENUM macro.

78 * Removed utils/remove_short_loops and matlab/remove_short_loops.

79 * Replaced sub_nb class in mr.h by boost::dynamic_bitset.

80 * Improved index.h:

81 - Renamed Index -> IndexFor

82 - Added some .reserve()'s to IndexFor methods which yields a

83 25% speedup of testregression

84 - Replaced multind by Permute

85 - Added MultiFor

86 - Added State

87 * New funcstionality of factor.h.

88 * Moved Properties and MaxDiff frameworks from InfAlg to each individual

89 inference algorithm, because the Properties framework was not as

90 convenient as I hoped, and not every inference algorithm needs a maxdiff

91 variable. Also, replaced some FactorGraph functionality in InfAlg by a

92 function that returns the FactorGraph. The result is cleaner (less

93 entangled) code.

94 * Removed x2x.

95 * Replaced Complex with real numbers (negative potentials are just too rare

96 to warrant the additional "complexity" :)).

98 Miscellaneous improvements:

99 * Now compiles also with MS Visual C++ (thanks to Jiuxiang Hu) and with

100 GCC under cygwin.

101 * Contributions by Peter Gober:

102 - Renamed variable _N in mr.* for compatibility with g++ under cygwin.

103 * Misc contributions by Giuseppe Passino:

104 - removed "using namespace std;" from header files - bad practice;

105 - moved header files in include/dai and sources in src;

106 - changed #ifndefs to GNU style;

107 - added extra warning checks (-W -Wextra) and fixed resulting warnings;

108 - dai::TProb:

109 o removed copy constructor and assignment operators (redundant);

110 o implementation of some methods via STL algorithms;

111 o added methods takeExp, takeLog, takeLog0 for transformation in-place;

112 o explicit constructor (prevents implicit conversion from size_t to TProb);

113 o added operator+,+=,-,-=, with argument T (for calculations in log-scale);

114 * Misc contributions by Christian Wojek:

115 - New FactorGraph constructor that constructs from given ranges of factors

116 and variables;

117 - Optimization of FactorGraph constructors using tr1::unordered_map.

118 * FactorGraph constructors no longer check for short loops (huge speed

119 increase for large factor graphs), nor for negative entries. Also, the

120 normtype is now Prob::NORMPROB by default.

121 * Improved MaxSpanningTreePrims algorithm (uses boost::graph).

123 Interface changes:

124 * VarSet::

125 - VarSet::stateSpace() -> nrStates(const VarSet &)

126 - VarSet( const std::set<Var> ) -> VarSet( begin, end, sizeHint=0 )

127 - VarSet( const std::vector<Var> ) -> VarSet( begin, end, sizeHint=0 )

128 - removed bool operator||

129 - operator&&(const VarSet&) -> intersects(const VarSet&)

130 - operator&&(const Var&) -> contains(const Var&)

131 * FactorGraph::

132 - delta(const Var &) -> delta(size_t)

133 - Delta(const Var &) -> Delta(size_t)

134 - makeCavity(const Var &) -> makeCavity(size_t)

135 - vars() -> vars

136 - factors() -> factors

137 - removed MakeFactorCavity(size_t)

138 - removed ExactMarginal(const VarSet &)

139 - removed ExactlogZ()

140 - removed updatedFactor(size_t)

141 - removed _normtype and NormType()

142 - removed hasShortLoops(...) and removeShortLoops(...)

143 - WriteToDotFile(const char *filename) -> printDot( std::ostream& os )

144 - undoProb(size_t) -> restoreFactor(size_t)

145 - saveProb(size_t) -> backupFactor(size_t)

146 - undoProbs(const VarSet &) -> restoreFactors(const VarSet &)

147 - saveProbs(const VarSet &) -> backupFactors(const VarSet &)

148 - ReadFromFile(const char*) returns void (throws on error)

149 - WriteToFile(const char*) returns void (throws on error)

150 - removed hasNegatives()

151 * RegionGraph::

152 - nr_ORs() -> nrORs()

153 - nr_IRs() -> nrIRs()

154 - ORs() -> ORs

155 - IRs() -> IRs

156 * *::Regenerate() -> *::construct()

157 * Renamed Index -> IndexFor

158 * Diffs:

159 - max() -> maxDiff()

160 - max_size() -> maxSize()

161 * Prob::max() -> Prob::maxVal()

162 * Factor::

163 - max() -> maxVal()

164 - part_sum() -> partSum()

165 * toc() in util.h now returns seconds as a double

166 * VarSet::operator&&

167 * Properties -> PropertySet

170 libDAI-0.2.1 (2008-05-26)

171 -------------------------

173 Bugfix release.

174 * added missing cstdio header in util.h

175 * fixed Properties in MR_CLAMPING_* and MR_EXACT_*

176 * added description of the factor graph fileformat

177 * improved Makefile

180 libDAI-0.2.0 (2006-11-30)

181 -------------------------

183 First public release.

186 0.1.5 (2006-11-30)

187 ------------------

189 Regressions

191 - tests/testlcbp and tests/testlcbp are broken.

192 - EXACT method does not work anymore.

193 - The Properties framework gives a speed penalty because of the lookup

194 costs involved; inner loops should be optimized.

196 General framework

198 - DAIAlg is now a template class; typedefs for DAIAlg<FactorGraph> and for

199 DAIAlg<RegionGraph> are provided. In this way, we do not have to write "wrapper"

200 functions to forward functionality from either FactorGraph or RegionGraph

201 to DAIAlg. Functionality like clamping can be implemented in FactorGraph

202 and in RegionGraph and no explicit interface is needed in descendants.

203 - New abstract base class InfAlg added, representing an inference algorithm,

204 from which DAIAlg<T> inherits. This solves the incompatibility problems of

205 DAIAlg<T> for different T (e.g. DAIAlg<FactorGraph> was incompatible with

206 DAIAlg<RegionGraph>). More work is required to reduce code duplication

207 (make FactorGraph part of InfAlg).

208 - Added generic interface (nrVars(), Vars(), nrFactors(), factor(size_t),

209 beliefs(), belief(VarSet &), ...) to InfAlg and descendants.

210 - Added a saveProbs/undoProbs interface to InfAlg and descendants that enables

211 one to save a few factors, modify them (e.g. clamp them), and then restore them

212 to their old values. Undo should also init the corresponding messages / beliefs.

213 This can be used if a given factor graph repeatedly needs to be clamped in

214 different ways and an approximation method is run for each clamping; using the

215 saveProbs/undoProbs can give a significant speed increase.

216 - Switched to a general Properties framework that handles the parameters of

217 all inference methods in a uniform manner. The Properties class is a map of

218 several properties in boost::any objects, indexed by their names (strings).

219 It can read from a stream and write to a stream. It is recursive, in the sense

220 that a Properties object can hold a variable of type Properties as well.

221 - Added a generic way of constructing inference algorithms from a factor graph,

222 name and properties object. Added the newInfAlg function which constructs

223 the requested object. This is used by LCBP, the Matlab interface and the

224 command line (test) interface.

225 - Added a generic enum framework for enum parameters. Although implemented as a

226 hack, it is quite useful in that it drastically simplifies and reduces the

227 amount of code for handling enum parameters.

228 - Provided generic functions for calculating marginals in different ways that

229 work for all approximate inference methods.

231 Bugfixes

233 - Fixed GBP free energy.

234 - Fixed bug in junctiontree (it didn't init the _vars variable).

235 - Corrected two bugs in operator&& and operator|| in VarSet (they returned

236 the logical NOT of what they should return).

237 - Fixed bug in RegionGraph::RecomputeOR(s).

238 - Fixed bug in utils/create_dreg_fg:

239 graph structure was not random for given parameters (forgot to call srand()).

240 - TreeEP bug workaround: use the complete junction tree instead of a subtree.

241 - Fixed bug in JTree::HUGIN() and JTree:ShaferShenoy() in case of junction tree

242 that consists of one outer region only.

243 - Fixed INIT bug in LCBP2::UpdatePancake().

244 - Fixed MaxDiffs flow (except for MR).

246 New functionality

248 - HAK supports several default cluster choices:

249 minimal (only factors)

250 delta (Markov blankets)

251 loop (all loops consisting of loops consisting of <loopdepth> or less variables)

252 Only the maximal clusters are used as outer clusters.

253 - Implemented TreeEP. It generalizes the heuristic method described in the

254 Minka & Qi paper for obtaining a tree with the most relevant interactions to

255 higher order interactions. Almost all optimizations described in the Minka & Qi

256 paper are used, except that evidence is passed over the whole tree instead of

257 relevant subsets (the latter is almost implemented but buggy). Also added

258 alternative (worst-case) algorithm that uses a maximum spanning tree on the

259 weighted graph where the weight between neighbours i and j is given by

260 N(psi,i,j), where psi is the product of all the factors involving both i and j

261 (which is an upper bound on the effective interaction between i and j).

262 - Implemented MR (MontanariRizzo) based on Bastian's code, but extended it

263 to be able to handle connectivities larger than 3 (in principle, up to 32).

264 It supports different initialization methods (the original RESPPROP,

265 the CLAMPING method and EXACT which uses JTree) and different update methods

266 (FULL and LINEAR).

267 - Implemented LCBP2, an analogon of LCBP which represents pancakes as little

268 networks and uses some approximate inference method on them for calculating

269 marginals.

270 - Now there are several LCBP variants (LCBP, LCBPI, LCBPJ, LCBPK, LCBPL);

271 LCBPJ works only for pairwise, LCBPK is LCBP improved for higher order

272 interactions and LCBPL is LCBPI improved for higher-order interactions.

273 - Wrote one single program utils/createfg for creating various types of

274 random factor graphs.

275 - Wrote utility to visualize factor graphs using graphviz.

276 (it uses the BOOST Program Options library)

277 - Added fginfo utility that displays some info about a .fg file.

278 - Implemented Factor::strength function that calculates the potential strength

279 N(psi,i,j) between variables i and j as described in cs.IT:0504030

280 - Wrote a general MatLab interface matlab/dai (similar to tests/test);

281 this unified the matlab functions dai, dai_bp, dai_mf, dai_jt, dai_tep, dai_cvm.

282 - Added MATLAB routine that returns contraction matrix A for BP convergence analysis.

283 - Implemented a MATLAB interface ai_potstrength for Factor::strength

284 - Added Martijn's x2x

286 Improvements of existing code

288 - Reimplemented RegionGraph and descendants: a RegionGraph ISA FactorGraph

289 and also a BipartiteGraph<FRegion,Region>. It now also keeps a map that

290 associates outer region indices to factor indices (no powers yet, this

291 is deemed superfluous) and provides functions to recompute (some of) the

292 outer regions from the factors.

293 - InfAlg descendants run() methods now stop immediately and return NAN in case

294 they detect NANs. Only BP does not do NAN checking for performance reasons.

295 - LCBP now works with factors containing zeroes (by defining x/0 = 0).

296 - HAK, GBP and DoubleLoop now conform to the standards for verbose reporting,

297 timing and convergence criteria.

298 - Implemented logZ() for JTree. It does the calculation during message-passing.

299 - Marginal2ndO now optionally divides by the single node beliefs (to the power n-2);

300 hopefully this will give more accurate approximations.

301 - Marginal and Marginal2ndO (optionally) use the new saveProbs/undoProbs functionality

302 for a faster way of calculating marginals, which does not require a call to init()

303 nor cloning the whole object for each clamping. This leads to a significant speedup.

304 - LCBP (and LCBP2) now have complete flexibility in the specification of the

305 inner method, i.e. the method used to generate the initial cavity approximations.

306 One can pass two strings, a name and a properties string, and LCBP simply invokes

307 newInfAlg to construct the corresponding inference algorithm and uses the generic

308 marginal functions to approximate cavity marginals.

309 - Replaced the global "method" variable by local properties and removed ai.h

310 - Added some methods to Factor (operators *, *=, /, /= with doubles as

311 second argument, operators -, +=, -= with other Factors as second

312 arguments, randomize(), RemoveFirstOrderInteractions) and similar

313 operations to Prob

314 - Moving towards boost::program_options for handling command line arguments

315 (tests/test is done).

316 - Renamed some FactorGraph methods:

317 nr_vars -> nrVars

318 nr_factors -> nrFactors

319 varind -> findVar

320 factorind -> findFactor

321 makeFacCavity -> makeFactorCavity

322 - LCBP_SEQMAXRES has been removed because it did strange things.

323 - Implemented RandomDRegularGraph

324 - Implemented JTree::calcMarginal for marginals that are not confined

325 within one cluster (using cut-set conditioning).

326 - Added isConnected() method to FactorGraph (some methods do not work with

327 disconnected factor graphs).

328 - Pair beliefs are now calculated in a symmetrical way by calcPairBeliefs

329 - Removed single node interaction "correction" code from clamping methods

330 - Removed calcCavityDist and calcCavityDist2ndO

331 - No longer depends on GSL.

332 - Increased portability by combining platform dependant utility functions

333 in util.{h,cpp}.

334 - Wrote *.m files providing help

336 Testing framework

338 - Made a new and significantly improved testing framework that provides most

339 functionality from the command line.

340 - The basis is provided by tests/test, which uses the newInfAlg functionality

341 and enables the user to easily compare from the command line different

342 inference methods on a given factorgraph. All parameters can be specified.

343 Output consists of CPU time, average and maximum single variable marginal

344 errors, relative logZ error and MaxDiff().

345 - tests/aliases.conf contains aliases for standard combinations of methods

346 and their options (which can be used in tests/test).

347 - tests/large contains several bash/python scripts that create random factor

348 graphs, compare several approximate inference algorithms (using tests/test) and

349 allow for easy visualization of the results using PyX.

350 - Added several .fg files for test purposes to /tests (e.g. two ALARM versions

351 alarm.fg and alarm_bnt.fg; testfast.fg, a 4x4 periodic Ising grid for

352 regression testing).

353 - Added a regression test to the Makefile which is included in the standard

354 target. It compares all inference methods on tests/testfast.fg with the

355 results stored in tests/testfast.out

357 Miscellaneous

359 - Expanded all tabs to spaces (":set tabstop 4\n:set expandtab\n:retab" in vim)

360 - Experimental MATLAB code added for StarEP approximation on cavity

361 - Renamed project to libDAI and changed directory name accordingly.

362 - Renamed JunctionTree to JTree.

363 - Fixed licensing (now it's officially GPL).

364 - Improved README

367 revision 252

368 ------------

370 Functionality

371 - Added RegionGraph, GBP, CVM and HAK (double-loop).

372 - Added JunctionTree (with two update algorithms, HUGIN and Shafer-Shenoy), which is a

373 RegionGraph.

374 - NormType is now chosen automatically (in case of negative factors, Prob::NORMLINF is used,

375 otherwise the default Prob::NORMPROB is used). Also, in case of negative factors, the

376 RegionGraph constructors assign each Factor to a unique outer region instead of dividing

377 it over all subsuming outer regions. See README for when negative factors are known to work

378 and when not.

379 - FactorGraph::FactorGraph(const vector<Factor>) only gives a warning in case of short loops,

380 it does not automatically merge factors anymore.

381 - Removed BP_SEQMAXRESNOCLEAR (all cavity initialization methods now are implicitly NOCLEAR)

382 - Added MATLAB interface functions ai_readfg, ai_removeshortloops and ai_bp

383 - Added LCBP-III type that should be equivalent to LCBP-II, but can handle zeroes

384 in potentials. Note that it is significantly slower than LCBP-II (and has to be reimplemented

385 such that it does not store the complete pancakes, but represents them as little factor graphs).

387 Implementation / code

388 - Made a seperate type WeightedGraph, which until now only implements Prim's

389 maximal spanning tree algorithm and is only used by the junction tree code. It might

390 be good to make it a class somewhere in the future and extend it's interface.

391 - Made a seperate class ClusterGraph, which is only used by the junction tree

392 code. It's main purpose is a graph-theoretical variable elimination algorithm.

393 - Implemented the heuristic "minimum-new-edges-in-clique-graph" for variable elimination.

394 - Massive code cleanup, moving towards "generic" programming style, using

395 multiple inheritance and polymorphism.

396 o BP, LCBP, MF, HAK and JunctionTree now inherit from a common DAIAlg class

397 o Made generic functions Marginal, Marginal2ndO, calcCavityDist, calcCavityDist2ndO, clamp

398 that can be used by FactorGraph-based DAIAlgs.

399 o Created TProb<T> class, which stores a probability vector (without the accompanying indexing

400 and VarSet) and provides functionality for it (which is used by TFactor<T>).

401 o Rewrote the VarSet class. It now caches its statespace(). It now privately inherits from set<Var>.

402 I had to overload the insert methods of set<Var> so that they calculate the new statespace.

403 o Rewrote the TFactor class. The TFactor class now HAS a TProb and HAS a VarSet.

404 - Rewrote BP to use the new TProb<T> interface. Performance of BP improved up to a factor 6 by:

405 o using Prob's instead of Factor's;

406 o splitting the multiplication of the messages into two parts (thanks to Vicenc!);

407 o optimizing the calculation of the beliefs (only the message calculations were optimized till now).

408 o replacing FactorGraph::_nb1 and _nb2 (which were set<size_t>) by vector<size_t>

409 - LCBP now seperately stores cavitydists and pancakes. Added InitPancakes() method

410 that takes the cavitydists and multiplies them with the relevant factors. This

411 resulted in an API change in AI which now accepts and returns initial cavitydists

412 instead of initial pancakes.

414 Minor changes

415 - Started writing DoxyGen documentation

416 - Renamed lcptab2fg.m matlab/ai_writefg.m

417 - Moved all matlab stuff to matlab/

418 - More detailed reporting (also reports clocks used).

419 - Marginal and Marginal2ndO now use *differences* in logZ to avoid NaNs.

420 - Improved testing suite.

421 - Removed logreal support.

422 - FactorGraph now also supports input streams and ignores comment lines in .fg files.

423 - Added tests/create_full_fg.cpp and tests/create_ising_fg.cpp which create

424 full and periodic 2D Ising networks according to some command line parameters.

425 - Now logZ really returns logZ instead of -logZ.

426 - Added FactorGraph::WriteToDotFile

429 0.1.4 (2006-04-13)

430 ------------------

431 - Added file IO routines to read and write factorgraphs.

432 - Added L-infinity normalization for use with (partially) negative factors.

433 - Renamed BetheF, MFF to logZ, which now use complex numbers to be able to

434 handle (partially) negative factors.

435 - Added test suite.

436 - All probabilities are now represented using double instead of LogReal<double>.

437 - Combined Alg and Alg3 into LCBP. Several update schemes possible.

438 - Combined several variants of BP into doBP. Several update schemes possible.

439 Now uses precalculated indices for optimization.

440 - Renamed Node -> Var and Potential -> Factor.

441 - Extensive code cleanup. More use of OO techniques. Changed API.

442 - MaxIter now means maximum number of passes (corresponding to number of

443 _parallel_ updates).

444 - MaxDiff now means the maximum L-infinity distance between the updated and

445 original single variable beliefs, for all AI methods.

446 - Implemented RBP which converges faster than BP for difficult problems.

447 - Now uses method parameter which is a bitmask combining outmethod and inmethod

448 (see ai.h).

451 0.1.3 (2006-03-22)

452 --------------------

453 - All AI methods now return maxdiff

454 - ai.cpp:

455 o Now returns maxdiffinner and maxdiffouter

456 o New BP2ndO innermethod (estimate only 2nd order cavity interactions)

457 o New InitCav outermethod (only create initial cavity distributions)

458 - bp.cpp:

459 o New CavityDist2ndO which estimates 2nd order cavity interactions

460 - Makefile:

461 o Bugfix: removed dependencies on algwim.*

464 0.1.2 (2006-02-28)

465 --------------------

466 - Cleaned up alg.cpp (removed Alg2 and its corresponding data structures).

467 - Added the possibility to provide initial cavity distributions as an input

468 argument to ai (not much error checking is done, so be careful).

469 - Potentials2mx now correctly sets the dimensions of the P field (i.e. for

470 the output arguments Q, Q0 of ai).

471 - Removed algwim.* since it does not work.

474 0.1.1 (2006-02-28)

475 --------------------

476 - The constructors of (Log)FactorGraph and LogFactorGraph from a

477 vector<(Log)Potential> now merge potentials to prevent short loops (of length

478 4) in the factor graph. These are used in ai to construct the factor graphs

479 from the psi argument. If compiled with DEBUG defined, the method calc_nb()

480 of BipGraph checks for the existence of short loops.

481 - Changed calling syntax of ai (now the actual syntax *does* correspond to its

482 description in the help).

483 - ai does not hook cout anymore (which caused weird segfaults).

484 - Fixed a bug in an assert statement in the matlab interface code in ai.cpp.

485 - Removed network.* since it is not useful.

488 0.1.0 (2006-02-28)

489 --------------------

490 First version worthy a version number.