1 git HEAD

2 --------

3 * Fixed a problem with isnan() on FreeBSD; it is now in the dai namespace.

4 * Workaround for older g++ compilers (e.g. version 4.0.0 on Darwin 9.8.0)

5 which have problems when comparing const_reverse_iterator with

6 reverse_iterator.

9 libDAI-0.2.5 (2010-05-09)

10 -------------------------

12 New features:

13 * Added unit tests for var, smallset, varset, graph, dag, bipgraph,

14 weightedgraph, enum, util, exceptions, properties, index, prob,

15 factor, factorgraph, clustergraph, regiongraph, daialg, alldai

16 * [Ofer Meshi] Added a script for converting from FastInf to libDAI format

17 * Added utils/uai2fg, a utility to convert the UAI inference competition file

18 formats to the libDAI factor graph file format

19 * Added dag.h/cpp, an implementation of Directed Acyclic Graphs

20 * Added examples/example_imagesegmentation

22 Miscellaneous improvements:

23 * TRWBP:

24 - Added initialization of TRWBP weights by sampling spanning trees

25 * MF:

26 - Added an "init" option that allows to initialize randomly

27 - Added an "updates" option that allows to choose between standard

28 mean field and "hard-spin" mean field

29 * MR:

30 - rewrote response propagation implementation with help of BBP

31 - now uses GraphAL to represent the Markov graph

32 - miscellaneous smaller cleanups

33 * TreeEP:

34 - Now also supports disconnected factor graphs

35 * JTree:

36 - Now also supports disconnected factor graphs

37 * ExactInf:

38 - Added findMaximum()

39 * RegionGraph:

40 - Added error checking code

41 - Changed the way a RegionGraph is streamed to an std::ostream.

42 * ClusterGraph:

43 - Added nrVars() method

44 - Added var( size_t ) method

45 - Added cluster( size_t ) method

46 * FactorGraph:

47 - clamped() now contains a delta factor for the clamped variable

48 - Added MarkovGraph()

49 * TFactor:

50 - Added takeAbs()

51 - Added takeExp()

52 - Added takeLog( bool )

53 - Added operator-() const

54 - Added sumAbs() const

55 - Added operator==( const TFactor<T> &y )

56 - Added get(size_t), set(size_t,T)

57 * TProb:

58 - Added operator==( const TProb<T> &q )

59 - accumulate() now also applies op2 to init

60 - operator/= (T x) now yields 0 when dividing by 0

61 - Added resize(size_t)

62 - Added get(size_t) and set(size_t,T)

63 - Changed format of TProb<T> when streamed to an ostream

64 * multifor:

65 - Added reset()

66 * PropertySet:

67 - Added size()

68 - Added clear()

69 - Added erase()

70 * util.h/cpp:

71 - Added std::string toString( const T& x )

72 * weightedgraph.h/cpp:

73 - Added option to MaxSpanningTree and MinSpanningTree for

74 choosing between Prim's algorithm and Kruskal's algorithm

75 - Better error checking in RootedTree constructor

76 - Added GraphEL::GraphEL( const GraphAL& G ) constructor

77 * BipartiteGraph:

78 - Added hasEdge()

79 - Added findNb1()

80 - Added findNb2()

81 - Added nb1Set()

82 - Added nb2Set()

83 - Added operator==( const BipartiteGraph& )

84 - Added BipartiteGraph( size_t nr1, size_t nr2 ) constructor

85 - Added operator<<( std::ostream&, const BipartiteGraph& )

86 * GraphAL:

87 - Added hasEdge(size_t,size_t)

88 - Added nbSet(size_t)

89 - Added operator==( const GraphAL& )

90 - Added operator<<( std::ostream&, const GraphAL& )

91 * SmallSet:

92 - Added insert( const T& t ) method

93 * Improved regression test

94 * Made all "verbose" properties optional

95 * utils/createfg now has a new factor type ('ISINGUNIFORM') and the old

96 'ISING' factor type has been renamed to 'ISINGGAUSS'

97 * tests/testdai option "marginals" now has five possible values: NONE

98 outputs no marginals, VAR only variable marginals, FAC only factor

99 marginals, VARFAC both types of marginals, and ALL outputs all

100 marginals calculated by the algorithm.

101 * Compressed Makefile

103 Interface changes (the old interface is marked obsolete and will be removed in the next release):

104 * Removed RandomDRegularGraph(), please use createGraphRegular() instead

105 * TreeEP:

106 - Changed construct( const RootedTree& ) into

107 construct( const FactorGraph&, const RootedTree& )

108 * JTree:

109 - Changed construct( const std::vector<VarSet>&, bool ) into

110 construct( const FactorGraph&, const std::vector<VarSet>&, bool )

111 - Changed GenerateJT( const std::vector<VarSet> & )

112 into GenerateJT( const FactorGraph &, const std::vector<VarSet> & )

113 * RegionGraph:

114 - Made (previously public) members G, ORs, IRs and fac2OR protected and

115 added DAG() accessor which returns a reference to the region graph DAG

116 structure (currently implemented as a BipartiteGraph).

117 - Renamed calcCountingNumbers() into calcCVMCountingNumbers() and made it

118 protected, because exposing it to the world serves no purpose.

119 - Removed partial constructor RegionGraph( const FactorGraph& fg )

120 - Made RecomputeORs(), RecomputeORs( const VarSet& ) and RecomputeOR( size_t )

121 protected and renamed them by changing the "Recompute" into "recompute",

122 because exposing them to the world serves no purpose.

123 * ClusterGraph:

124 - Made (previously public) members G, vars and clusters private and added

125 bipGraph(), vars() and clusters() methods which offer read-only access

126 to these members.

127 - Deprecated toVector()

128 - Renamed size() into nrClusters()

129 * FactorGraph:

130 - Renamed Cliques() into maximalFactorDomains() and made it faster

131 - findVars( const VarSet& ) now returns a SmallSet<size_t>

132 and its argument now has a const-qualifier (which fixes a small bug).

133 - Made (previously public) member G private and added the

134 bipGraph() method, which offers read-only access to it.

135 - Deprecated the iterator interface:

136 o FactorGraph::iterator typedef

137 o FactorGraph::const_iterator typedef

138 o FactorGraph::begin() members

139 o FactorGraph::end() members

140 - Deprecated factor(size_t) which offered write access to a factor

141 because using this functionality in the descendant RegionGraph is dangerous,

142 as the outer regions are not automatically recomputed.

143 * TFactor:

144 - Renamed states() into nrStates()

145 - Added get(size_t) and set(size_t,T) operators;

146 get() is equivalent to "operator[](size_t) const" and set() should

147 be used instead of the non-const operator[], which has been deprecated

148 * TProb:

149 - Deprecated TProb( TIterator begin, TIterator end, size_t sizeHint=0 )

150 constructor: the sizeHint argument no longer defaults to 0

151 - Deprecated accumulate( T init, binOp op1, unOp op2 );

152 instead, accumulateSum( T init, unOp op ) and

153 accumulateMax( T init, unOp op, bool minimize ) should be used.

154 - Deprecated TProb::NormType and TProb::DistType;

155 ProbNormType and ProbDistType should be used instead.

156 - Fixed bug by renaming operator<=() to operator<()

157 - Added get(size_t) and set(size_t,T) operators;

158 get() is equivalent to "operator[](size_t) const" and set() should

159 be used instead of the non-const operator[], which has been deprecated

160 * PropertySet:

161 - Renamed Set() -> set()

162 - Renamed Get() -> get()

163 - Renamed GetAs<T>() -> getAs<T>()

164 - Renamed ConvertTo<T>() -> convertTo<T>()

165 * util.h/cpp:

166 - Removed max( const std::vector<Real> &v )

167 * weightedgraph.h/cpp:

168 - Renamed MaxSpanningTreePrims into MaxSpanningTree

169 - Renamed MinSpanningTreePrims into MinSpanningTree

170 - The vertices in DEdge and UEdge are now named "first" and "second"

171 for compatibility with a std::pair<size_t,size_t>

172 * BipartiteGraph:

173 - delta1() and delta2() now return a SmallSet<size_t> instead of a vector<size_t>

174 * SmallSet:

175 - The sizeHint argument of the iterator constructor

176 SmallSet::SmallSet( TIterator begin, TIterator end, size_t sizeHint=0 )

177 no longer has a default value in order to avoid confusion with the

178 SmallSet::SmallSet( const T &t1, const T &t2 )

179 constructor.

181 Bug fixes:

182 * [Stefano Pellegrini] Fixed bug in JTree::findMaximum()

183 * [Stefano Pellegrini] Fixed bug in BP[logdomain=1,inference=MAXPROD]

184 * Fixed some bugs in the MatLab interface build system

185 * Fixed a bug in utils/fginfo.cpp

186 * Fixed a bug in JTree::findMaximum() and simplified the code

187 * Fixed bug in BBPCostFunction::operator=() which prevented the desired

188 assignment from happening

189 * RegionGraph::WriteToFile( const char* ), RegionGraph::ReadFromFile( const char * )

190 and RegionGraph::printDot( std::ostream& ) incorrectly called their respective

191 FactorGraph ancestor methods; this has been corrected by letting them throw a

192 NOT_IMPLEMENTED exception.

193 * Fixed bug in FactorGraph::clone()

194 * Fixed bug in min( const TFactor<T> &, const TFactor<T> & )

195 * Fixed bug in max( const TFactor<T> &, const TFactor<T> & )

196 * Fixed bug by renaming TProb<T>::operator<=() to TProb<T>::operator<()

197 * Fixed bug in PropertySet::setAsString<T>()

198 * Fixed a bug in rnd_seed()

199 * BipartiteGraph:

200 - Fixed bug in eraseNode1()

201 - Fixed bug in eraseNode2()

202 - Fixed bug in isTree()

203 * GraphAL:

204 - Fixed bug in nrEdges()

205 - Fixed bug in addEdge()

206 - Fixed bug in isTree()

207 - Fixed bug in eraseNode()

208 - Fixed bug in printDot()

209 * Fixed bug in createGraphGrid3D()

210 * Fixed bug in createGraphRegular()

213 libDAI-0.2.4 (2010-02-11)

214 -------------------------

216 New features:

217 * Implemented Tree-Reweighted BP

218 * [Frederik Eaton] Implemented Fractional Belief Propagation

220 Miscellaneous improvements:

221 * Improved documentation

222 * [Frederik Eaton] Added constructors for BBPCostFunction

223 * [Frederik Eaton] Added accessor/mutator for the elements of a SmallSet<>

224 * [Frederik Eaton] Added unary minus to TProb<>

225 * [Frederik Eaton] Added Hellinger distance to TProb<>::DistType

226 * [Frederik Eaton] Two small patches for src/jtree.cpp and utils/createfg.cpp

227 * tests/testdai option "marginals" now has three possible values: NONE

228 outputs no marginals, VAR only variable marginals, and ALL outputs all

229 marginals calculated by the algorithm.

230 * Strengthened convergence criteria of various algorithms

231 * Added GraphAL, an adjacency list implementation for graphs,

232 similar to (but simpler than) BipartiteGraph

233 * Added some functionality to create various standard factors

234 (the functions whose names start with "createFactor")

235 * Added examples example_sprinkler_gibbs and example_sprinkler_em

236 * Implemented various heuristics for choosing a variable elimination sequence

237 in JTree

238 * Added BETHE method for GBP/HAK cluster choice

239 * Made alias support official part of the library

241 Build system:

242 * Moved platform independent build options into Makefile.ALL

243 * Windows platform now needs Boost 1.37 or higher

245 Code cleanup:

246 * Cleaned up utils/createfg and tests/testdai

247 * Cleanup of some duplicate code in BP, FBP, TRWBP

249 Interface changes (the old interface is marked obsolete and will be removed in the next release):

250 * Removed obsolete/deprecated stuff

251 * Renamed Graph into GraphEL (for Graph, implemented as Edge List)

252 * Renamed some functions of BipartiteGraph:

253 add1() -> addNode1()

254 erase1() -> eraseNode1()

255 nr1() -> nrNodes1()

256 add2() -> addNode2()

257 erase2() -> eraseNode2()

258 nr2() -> nrNodes2()

259 * Renamed some functions in ClusterGraph:

260 ClusterGraph::eliminationCost() -> ::eliminationCost_MinFill()

261 ClusterGraph::VarElim() -> ClusterGraph::VarElim( sequentialVariableElimination( ElimSeq ) )

262 ClusterGraph::VarElim_MinFill() -> ClusterGraph::VarElim( greedyVariableElimination( eliminationCost_MinFill ) )

263 * Changed interface of one RegionGraph constructor

264 * Renamed "Clamped BP" into "Conditioned BP"

266 Bug fixes:

267 * Fixed regression in scripts/regenerate-properties (now all errors are

268 gathered before throwing the exception, as used to be the case)

269 * Fixed FTBFS errors on MACOSX (thanks to Sebastian Riedel for reporting this bug)

270 * [Alexander Schwing] Fixed error in BP that occured with damping

271 and using log-domain updates

272 * Fixed bug in HAK for trivial region graphs (with only one outer region

273 and no inner regions), reported by Alejandro Lage.

274 * Fixed long-standing bug in TreeEP (now, within-loop propagation optimization works)

277 libDAI-0.2.3 (2009-11-16)

278 -------------------------

280 New features:

281 * Complete doxygen documentation (although more detailed documentation still

282 has to be written)

283 * [Charles Vaske] Added parameter learning for conditional probabilities by

284 Expectation Maximization

285 * [Patrick Pletscher] Added SWIG wrapper code for experimental python and

286 octave interfaces

287 * Added Max-Product functionality to JTree

288 * [Frederik Eaton] Added Back-Belief-Propagation

289 * [Frederik Eaton] Added approximate inference method "Clamped Belief Propagation"

290 * [Frederik Eaton] Added approximate inference method "Gibbs sampling"

292 Code cleanup:

293 * Updated copyright headers

294 * Cleaned up error handling by introducing the DAI_THROWE macro

295 * Introduced DAI_DEBASSERT macro to abbreviate a common pattern

296 * Replaced the standard assert() macro by DAI_ASSERT, which throws a

297 dai::Exception and is even active if NDEBUG is defined

298 * Removed all the virtual default constructors *::create(), as they are not used

299 * [Frederik Eaton] Removed unnecessary copy constructors and assignment operators

300 * [Frederik Eaton] Change cout to cerr in warnings and error messages

302 Miscellaneous improvements:

303 * BipartiteGraph:

304 - Added eraseEdge( size_t n1, size_t n2 )

305 - [Frederik Eaton] Improved documentation of Neighbor

306 * TProb<T>:

307 - Added divided_by(const TProb<T>&) const

308 - Added constructor TProb<T>( const std::vector<S> &v )

309 - Added size_t draw(), which draws a random index

310 - [Frederik Eaton] Added setUniform()

311 - [Frederik Eaton] Added sumAbs()

312 - [Frederik Eaton] Added argmax()

313 - [Giuseppe Passino] Added begin(), end()

314 * TFactor<T>:

315 - [Giuseppe Passino] Added begin(), end()

316 - [Charles Vaske] Added TFactor( const std::vector<Var> &vars, const std::vector<T> &p ),

317 which reorders variables to canonical ordering before storing the table

318 - Added constructor TFactor<T>( const VarSet &vars, const std::vector<S> &v )

319 - Extended functionality of TFactor<T>::operators +,-,+=,-= to handle different VarSets

320 - Added TFactor<T>::maxMarginal (similar to marginal but with max instead of sum)

321 * State:

322 - [Giuseppe Passino] Added prefix ++ operator

323 * Permute:

324 - [Charles Vaske] Added constructor in Permute for canonical variable ordering

325 * FactorGraph:

326 - [Frederik Eaton] Added clampVar()

327 - [Frederik Eaton] Added clampFactor()

328 - [Giuseppe Passino] Added begin(), end()

329 * PropertySet:

330 - Added keys(), for getting all keys

331 - [Frederik Eaton] Added default constructor

332 - [Frederik Eaton] Added constructor from string

333 * InfAlg:

334 - Added setProperties(), getProperties() and printProperties()

335 - [Frederik Eaton] Added beliefV(), beliefF()

336 * ExactInf:

337 - Added calcMarginal(const VarSet &)

338 * HAK:

339 - Added "init" parameter to allow for random initialization

340 * BP:

341 - [Giuseppe Passino] Added findMaximum(), which can be used after running

342 max-product BP to construct a global state with maximum probability

343 * JTree:

344 - Added findMaximum(), which can be used after running

345 max-product JTree to construct a global state with maximum probability

346 * MatLab interface:

347 - MEX file dai now also returns variable and factor beliefs

348 - [Sebastian Nowozin] MEX file dai now also optionally returns the MAP state

349 (only for BP and JTree)

350 * README is now created automatically from doxygen documentation

351 * [Frederik Eaton] Added script for automatically generating properties code (used by CBP and BBP)

352 * [Frederik Eaton] Added newInfAlgFromString to alldai.h/cpp

353 * [Frederik Eaton] Added some utility macros (DAI_PV, DAI_DMSG, DAI_IFVERB)

354 and functions (concat(),rnd()) to util.h

355 * Changed output stream operator<< for Var and VarSet

356 * [Frederik Eaton] Improved parsing code in tests/testdai to allow recursive

357 alias substitutions

358 * [Frederik Eaton] Added useful aliases to aliases.conf

359 * [Giuseppe Passino] Optimised maximum-residual BP by using a reversed ordered

360 set instead of the linear search (which can yield enormous speedups - a

361 factor 500 has been measured on a binary Ising grid with 128x128 variables!)

362 * Added debug assertions to Var which check for inconsistent dimensions of

363 variables with the same labels

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

365 * Exception objects now remember their error code

366 * Examples:

367 - Moved example.cpp to examples/

368 - Added examples/example_bipgraph.cpp

369 - Added examples/example_varset.cpp

370 - Added examples/example_sprinkler.cpp

371 - Added examples/example_permute.cpp

372 - Added python and octave ports for examples/example_sprinkler.cpp

374 Build system:

375 * Improved Makefile:

376 - Merged Makefile.win and Makefile.shared into Makefile

377 - Macros DAI_VERSION and DAI_DATE have been introduced,

378 in order to store this information in a central place

379 - Introduced CCNODEBUGFLAGS in Makefile

380 - Switched Makefile.win to GNU Make syntax

381 - [Frederik Eaton] Added TAGS, lib targets to Makefile

382 * Compatibility:

383 - [Peter Gober] libDAI can now be built on Cygwin

384 - [Dan Preston] libDAI can now be built on Mac OS X

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

387 Interface changes (the old interface is marked obsolete and will be removed in the next release):

388 * Var:

389 - Variable labels are now nonnegative (of type size_t)

390 * VarSet:

391 - Replaced calcState() by non-member calcLinearState()

392 - Replaced calcStates() by non-member calcState()

393 * Permute:

394 - Renamed convert_linear_index into convertLinearIndex

395 * TProb<>:

396 - Replaced log0() by log(true)

397 - Replaced takeLog0() by takeLog(true)

398 - Removed hasNonPositives()

399 - Renamed minVal() to min()

400 - Renamed maxVal() to max()

401 - Renamed totalSum() to sum()

402 * TFactor<>:

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

404 - Removed divided_by, use operator/ instead

405 - Removed divide, use operator/= instead

406 - Removed partSum(const VarSet&), use marginal(const VarSet&,false) instead

407 - Renamed minVal() to min()

408 - Renamed maxVal() to max()

409 - Renamed totalSum() to sum()

410 * FactorGraph:

411 - Changed clamp and clamp interfaces (the variable to be

412 clamped is now indicated by its index, not as a Var)

413 * RegionGraph:

414 - Renamed Check_Counting_Numbers into checkCountingNumbers

415 - Renamed Calc_Counting_Numbers into calcCountingNumbers

416 * Miscellaneous:

417 - Renamed Treewidth(const FactorGraph &) into boundTreewidth(const FactorGraph &)

418 - Replaced UEdgeVec by Graph

419 - Replaced DEdgeVec by new RootedTree class

420 - Moved functionality of GrowRootedTree() into constructor of RootedTree

421 - Merged calcPairBeliefsNew() into calcPairBeliefs()

422 - Removed calcMarginal2ndO()

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

424 - Removed class Diffs

425 - [Frederik Eaton] Added backwards compatibility layer for edge interface to

426 BipartiteGraph and FactorGraph (which will be obsoleted soon)

428 Bug fixes:

429 * Fixed reversal of min and max in

430 TFactor<T> min( const TFactor<T> &, const TFactor<T> & )

431 TFactor<T> max( const TFactor<T> &, const TFactor<T> & )

432 * [Sebastian Nowozin] Fixed memory leak in MEX file dai

433 * [Frederik Eaton] In PropertySet::getStringAs(), check for typeid(ValueType)

434 before typeid(std::string) (this fixes a strange bug for empty string property)

435 * Added work-around for bug in Boost Graph Library

436 * Fixed bug in MaxSpanningTree (it wrongly assumed that the tree was not empty).

437 * Fixed bug in calcMarginal and calcPairBeliefs where states with zero probability

438 mass were clamped, leading to NaNs or assertion errors (thanks to Dan Preston

439 for reporting this)

442 libDAI-0.2.2 (2008-09-30)

443 -------------------------

445 New features:

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

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

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

449 * Added ExactInf class for brute force exact inference.

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

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

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

453 of a double is too small.

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

455 * Improved documentation.

457 Improved architecture:

458 * Added Exceptions framework.

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

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

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

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

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

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

465 made easy by using boost::foreach.

466 * Added conditional compilation of inference methods.

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

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

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

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

471 specialization with T = Var.

472 * Improved ClusterGraph implementation, yielding significant speedups

473 for the JunctionTree algorithm on large factorgraphs.

475 Code cleanup:

476 * Moved everything into namespace "dai".

477 * Renamed DEBUG to DAI_DEBUG to avoid conflicts.

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

479 * Removed utils/remove_short_loops and matlab/remove_short_loops.

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

481 * Improved index.h:

482 - Renamed Index -> IndexFor

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

484 25% speedup of testregression

485 - Replaced multind by Permute

486 - Added MultiFor

487 - Added State

488 * New funcstionality of factor.h.

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

490 inference algorithm, because the Properties framework was not as

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

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

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

494 entangled) code.

495 * Removed x2x.

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

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

499 Miscellaneous improvements:

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

501 GCC under Cygwin.

502 * Contributions by Peter Gober:

503 - Renamed variable _N in mr.* for compatibility with g++ under Cygwin.

504 * Misc contributions by Giuseppe Passino:

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

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

507 - changed #ifndefs to GNU style;

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

509 - dai::TProb:

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

511 o implementation of some methods via STL algorithms;

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

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

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

515 * Misc contributions by Christian Wojek:

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

517 and variables;

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

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

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

521 normtype is now Prob::NORMPROB by default.

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

524 Interface changes:

525 * VarSet::

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

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

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

529 - removed bool operator||

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

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

532 * FactorGraph::

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

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

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

536 - vars() -> vars

537 - factors() -> factors

538 - removed MakeFactorCavity(size_t)

539 - removed ExactMarginal(const VarSet &)

540 - removed ExactlogZ()

541 - removed updatedFactor(size_t)

542 - removed _normtype and NormType()

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

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

545 - undoProb(size_t) -> restoreFactor(size_t)

546 - saveProb(size_t) -> backupFactor(size_t)

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

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

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

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

551 - removed hasNegatives()

552 * RegionGraph::

553 - nr_ORs() -> nrORs()

554 - nr_IRs() -> nrIRs()

555 - ORs() -> ORs

556 - IRs() -> IRs

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

558 * Renamed Index -> IndexFor

559 * Diffs:

560 - max() -> maxDiff()

561 - max_size() -> maxSize()

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

563 * Factor::

564 - max() -> maxVal()

565 - part_sum() -> partSum()

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

567 * VarSet::operator&&

568 * Properties -> PropertySet

571 libDAI-0.2.1 (2008-05-26)

572 -------------------------

574 Bugfix release.

575 * added missing cstdio header in util.h

576 * fixed Properties in MR_CLAMPING_* and MR_EXACT_*

577 * added description of the factor graph fileformat

578 * improved Makefile

581 libDAI-0.2.0 (2006-11-30)

582 -------------------------

584 First public release.

587 0.1.5 (2006-11-30)

588 ------------------

590 Regressions

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

593 - EXACT method does not work anymore.

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

595 costs involved; inner loops should be optimized.

597 General framework

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

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

601 functions to forward functionality from either FactorGraph or RegionGraph

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

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

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

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

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

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

608 (make FactorGraph part of InfAlg).

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

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

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

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

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

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

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

616 saveProbs/undoProbs can give a significant speed increase.

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

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

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

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

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

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

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

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

625 command line (test) interface.

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

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

628 amount of code for handling enum parameters.

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

630 work for all approximate inference methods.

632 Bugfixes

634 - Fixed GBP free energy.

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

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

637 the logical NOT of what they should return).

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

639 - Fixed bug in utils/create_dreg_fg:

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

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

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

643 that consists of one outer region only.

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

645 - Fixed MaxDiffs flow (except for MR).

647 New functionality

649 - HAK supports several default cluster choices:

650 minimal (only factors)

651 delta (Markov blankets)

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

653 Only the maximal clusters are used as outer clusters.

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

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

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

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

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

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

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

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

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

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

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

665 It supports different initialization methods (the original RESPPROP,

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

667 (FULL and LINEAR).

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

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

670 marginals.

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

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

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

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

675 random factor graphs.

676 - Wrote utility to visualize factor graphs using graphviz.

677 (it uses the BOOST Program Options library)

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

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

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

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

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

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

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

685 - Added Martijn's x2x

687 Improvements of existing code

689 - Reimplemented RegionGraph and descendants: a RegionGraph ISA FactorGraph

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

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

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

693 outer regions from the factors.

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

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

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

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

698 timing and convergence criteria.

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

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

701 hopefully this will give more accurate approximations.

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

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

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

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

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

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

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

709 marginal functions to approximate cavity marginals.

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

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

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

713 arguments, randomize(), RemoveFirstOrderInteractions) and similar

714 operations to Prob

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

716 (tests/test is done).

717 - Renamed some FactorGraph methods:

718 nr_vars -> nrVars

719 nr_factors -> nrFactors

720 varind -> findVar

721 factorind -> findFactor

722 makeFacCavity -> makeFactorCavity

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

724 - Implemented RandomDRegularGraph

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

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

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

728 disconnected factor graphs).

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

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

731 - Removed calcCavityDist and calcCavityDist2ndO

732 - No longer depends on GSL.

733 - Increased portability by combining platform dependant utility functions

734 in util.{h,cpp}.

735 - Wrote *.m files providing help

737 Testing framework

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

740 functionality from the command line.

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

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

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

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

745 errors, relative logZ error and MaxDiff().

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

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

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

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

750 allow for easy visualization of the results using PyX.

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

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

753 regression testing).

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

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

756 results stored in tests/testfast.out

758 Miscellaneous

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

761 - Experimental MATLAB code added for StarEP approximation on cavity

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

763 - Renamed JunctionTree to JTree.

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

765 - Improved README

768 revision 252

769 ------------

771 Functionality

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

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

774 RegionGraph.

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

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

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

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

779 and when not.

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

781 it does not automatically merge factors anymore.

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

783 - Added MATLAB interface functions ai_readfg, ai_removeshortloops and ai_bp

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

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

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

788 Implementation / code

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

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

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

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

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

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

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

796 multiple inheritance and polymorphism.

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

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

799 that can be used by FactorGraph-based DAIAlgs.

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

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

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

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

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

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

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

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

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

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

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

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

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

813 instead of initial pancakes.

815 Minor changes

816 - Started writing DoxyGen documentation

817 - Renamed lcptab2fg.m matlab/ai_writefg.m

818 - Moved all matlab stuff to matlab/

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

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

821 - Improved testing suite.

822 - Removed logreal support.

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

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

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

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

827 - Added FactorGraph::WriteToDotFile

830 0.1.4 (2006-04-13)

831 ------------------

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

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

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

835 handle (partially) negative factors.

836 - Added test suite.

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

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

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

840 Now uses precalculated indices for optimization.

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

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

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

844 _parallel_ updates).

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

846 original single variable beliefs, for all AI methods.

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

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

849 (see ai.h).

852 0.1.3 (2006-03-22)

853 --------------------

854 - All AI methods now return maxdiff

855 - ai.cpp:

856 o Now returns maxdiffinner and maxdiffouter

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

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

859 - bp.cpp:

860 o New CavityDist2ndO which estimates 2nd order cavity interactions

861 - Makefile:

862 o Bugfix: removed dependencies on algwim.*

865 0.1.2 (2006-02-28)

866 --------------------

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

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

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

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

871 the output arguments Q, Q0 of ai).

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

875 0.1.1 (2006-02-28)

876 --------------------

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

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

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

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

881 of BipGraph checks for the existence of short loops.

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

883 description in the help).

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

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

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

889 0.1.0 (2006-02-28)

890 --------------------

891 First version worthy of a version number.