Added functionality for reading files in the UAI approximate inference challenge...
[libdai.git] / include / dai / io.h
1 /* This file is part of libDAI - http://www.libdai.org/
2 *
3 * libDAI is licensed under the terms of the GNU General Public License version
4 * 2, or (at your option) any later version. libDAI is distributed without any
5 * warranty. See the file COPYING for more details.
6 *
7 * Copyright (C) 2010 Joris Mooij [joris dot mooij at libdai dot org]
8 */
9
10
11 /// \file
12 /// \brief Provides functionality for input/output of data structures in various file formats
13
14
15 #ifndef __defined_libdai_io_h
16 #define __defined_libdai_io_h
17
18
19 #include <dai/factor.h>
20 #include <vector>
21 #include <map>
22
23
24 namespace dai {
25
26
27 /// Reads factor graph (as a pair of a variable vector and factor vector) from a file in the UAI approximate inference challenge format
28 /** \param[in] filename The filename (usually ends with ".uai")
29 * \param[in] verbose The amount of output sent to cout
30 * \param[out] vars Array of variables read from the file
31 * \param[out] factors Array of factors read from the file
32 * \param[out] permutations Array of permutations, which permute between libDAI canonical ordering and ordering specified by the file
33 * \see http://www.cs.huji.ac.il/project/UAI10 and http://graphmod.ics.uci.edu/uai08
34 */
35 void ReadUaiAieFactorGraphFile( const char *filename, size_t verbose, std::vector<Var>& vars, std::vector<Factor>& factors, std::vector<Permute>& permutations );
36
37
38 /// Reads evidence (a mapping from observed variable labels to the observed values) from a file in the UAI approximate inference challenge format
39 /** \param[in] filename The filename (usually ends with ".uai.evid")
40 * \param[in] verbose The amount of output sent to cout
41 * \see http://www.cs.huji.ac.il/project/UAI10 and http://graphmod.ics.uci.edu/uai08
42 */
43 std::vector<std::map<size_t, size_t> > ReadUaiAieEvidenceFile( const char* filename, size_t verbose );
44
45
46 } // end of namespace dai
47
48
49 #endif