Added Quickstart for MacOSX to README and improved some exception handling code
[libdai.git] / README
1 libDAI - A free/open source C++ library for Discrete Approximate Inference methods
2 ==================================================================================
3
4 v 0.2.2 - September 30, 2008
5
6
7 Copyright (C) 2006-2008 Joris Mooij [joris dot mooij at tuebingen dot mpg dot de]
8 Radboud University Nijmegen, The Netherlands /
9 Max Planck Institute for Biological Cybernetics, Germany
10
11 with contributions from:
12
13 Martijn Leisink
14 Giuseppe Passino
15 Frederik Eaton
16 Bastian Wemmenhove
17 Christian Wojek
18 Claudio Lima
19 Jiuxiang Hu
20 Peter Gober
21
22
23 ----------------------------------------------------------------------------------
24 This file is part of libDAI.
25
26 libDAI is free software; you can redistribute it and/or modify
27 it under the terms of the GNU General Public License as published by
28 the Free Software Foundation; either version 2 of the License, or
29 (at your option) any later version.
30
31 libDAI is distributed in the hope that it will be useful,
32 but WITHOUT ANY WARRANTY; without even the implied warranty of
33 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 GNU General Public License for more details.
35
36 You should have received a copy of the GNU General Public License
37 along with libDAI; if not, write to the Free Software
38 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
39 ----------------------------------------------------------------------------------
40
41
42 SCIENTISTS: please be aware that the fact that this program is released as Free
43 Software does not excuse you from scientific propriety, which obligates you to
44 give appropriate credit. If you write a scientific paper describing research
45 that made substantive use of this program, it is your moral obligation as a
46 scientist to (a) mention the fashion in which this software was used, including
47 the version number, with a citation to the literature, to allow replication;
48 (b) mention this software in the Acknowledgements section. The appropriate
49 citation is:
50
51 J. M. Mooij (2008) "libDAI 0.2.2: A free/open source C++ library for Discrete
52 Approximate Inference methods", http://mloss.org/software/view/77/.
53
54 Moreover, as a personal note, I would appreciate it if you would email me with
55 citations of papers referencing this work so I can mention them to my funding
56 agent and tenure committee.
57
58
59 About libDAI
60 ------------
61 libDAI is a free/open source C++ library (licensed under GPL) that provides
62 implementations of various (approximate) inference methods for discrete
63 graphical models. libDAI supports arbitrary factor graphs with discrete
64 variables; this includes discrete Markov Random Fields and Bayesian Networks.
65
66 The library is targeted at researchers; to be able to use the library, a good
67 understanding of graphical models is needed.
68
69
70 Limitations
71 -----------
72 libDAI is not intended to be a complete package for approximate inference.
73 Instead, it should be considered as an "inference engine", providing various
74 inference methods. In particular, it contains no GUI, currently only supports
75 its own file format for input and output (although support for standard file
76 formats may be added later), and provides very limited visualization
77 functionalities.
78
79
80 Features
81 --------
82 Currently, libDAI supports the following (approximate) inference methods:
83
84 * Exact inference by brute force enumeration;
85 * Exact inference by junction-tree methods;
86 * Mean Field;
87 * Loopy Belief Propagation [KFL01];
88 * Tree Expectation Propagation [MiQ04];
89 * Generalized Belief Propagation [YFW05];
90 * Double-loop GBP [HAK03];
91 * Various variants of Loop Corrected Belief Propagation [MoK07, MoR05];
92 * Gibbs sampler.
93
94
95 Why C++?
96 --------
97 Because libDAI is implemented in C++, it is very fast compared with
98 implementations in MatLab (a factor 1000 faster is not uncommon). libDAI does
99 provide a MatLab interface for easy integration with MatLab.
100
101
102 Releases
103 --------
104 Releases can be obtained from http://mloss.org/software/view/77/
105 License: GNU Public License v2 (or higher).
106
107 libDAI-0.2 December 1, 2006
108 libDAI-0.2.1 May 26, 2008
109 libDAI-0.2.2 September 30, 2008
110
111
112 Acknowledgments
113 ---------------
114 This work is part of the Interactive Collaborative Information Systems (ICIS)
115 project, supported by the Dutch Ministry of Economic Affairs, grant BSIK03024.
116 I would like to thank Martijn Leisink for providing the basis on which libDAI has been built.
117
118
119 Documentation
120 -------------
121 Some doxygen documentation is available. Install doxygen and use "make doc" to build the
122 documentation. If the documentation is not clear enough, feel free to send me an email
123 (or even better, to improve the documentation!).
124
125 A description of the factor graph (.fg) file format can be found in the file FILEFORMAT.
126
127
128 Compatibility
129 -------------
130 The code has been developed under Debian GNU/Linux with the GCC compiler suite.
131 libDAI compiles successfully with g++ versions 3.4, 4.1, 4.2 and 4.3.
132
133 libDAI has also been successfully compiled with MS Visual Studio 2008 under Windows
134 (but not all build targets are supported yet) and with Cygwin under Windows.
135
136 Finally, libDAI has been compiled successfully on MacOS X.
137
138
139 Quick start (linux/cygwin/Mac OS X)
140 -----------------------------------
141 You need:
142 - a recent version of gcc (at least version 3.4)
143 - GNU make
144 - doxygen
145 - graphviz
146 - recent boost C++ libraries (at least version 1.34 or 1.37 for cygwin)
147
148 On Debian/Ubuntu, you can easily install all these packages with a single command:
149 "apt-get install g++ make doxygen graphviz libboost-dev libboost-graph-dev libboost-program-options-dev"
150 (root permissions needed).
151
152 On Mac OS X, these packages can be installed easily via MacPorts.
153 First, install MacPorts according to the instructions at http://www.macports.org/
154 Then, a simple "port install boost doxygen graphviz"
155 should be enough to install everything that is needed.
156
157 On Cygwin, the prebuilt Cygwin package boost-1.33.1-x is known not to work.
158 You can however obtain the latest boost version (you need at least 1.37.0)
159 from http://www.boost.org/ and compile/install it with:
160
161 ./configure
162 make
163 make install
164
165
166 To build the libDAI source, edit the Makefile and adapt it to your local setup.
167 At least one should specify the OS and possibly adapt some directories to match
168 the local setup. Then, run
169
170 make
171
172 If the build was successful, you can test the example program:
173
174 ./example tests/alarm.fg
175
176 or the more elaborate test program:
177
178 tests/testdai --aliases tests/aliases.conf --filename tests/alarm.fg --methods JTREE_HUGIN BP_SEQMAX
179
180
181 Quick start (Windows)
182 ---------------------
183 You need:
184 - A recent version of MicroSoft Visual Studio (2008 works)
185 - recent boost C++ libraries (version 1.34 or higher)
186 - GNU make (can be obtained from http://gnuwin32.sourceforge.net)
187 For the regression test, you need:
188 - GNU diff, GNU sed (can be obtained from http://gnuwin32.sourceforge.net)
189
190 To build the source, edit the Makefile and adapt it to your local setup. Then, run (from the command line)
191
192 make -f Makefile.win
193
194 If the build was successful, you can test the example program:
195
196 example tests\alarm.fg
197
198 or the more elaborate test program:
199
200 tests\testdai --aliases tests\aliases.conf --filename tests\alarm.fg --methods JTREE_HUGIN BP_SEQMAX