libDAI version 0.3.2
[libdai.git] / include / dai / io.h
1 /* This file is part of libDAI - http://www.libdai.org/
2 *
3 * Copyright (c) 2006-2011, The libDAI authors. All rights reserved.
4 *
5 * Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
6 */
7
8
9 /// \file
10 /// \brief Provides functionality for input/output of data structures in various file formats
11
12
13 #ifndef __defined_libdai_io_h
14 #define __defined_libdai_io_h
15
16
17 #include <dai/factor.h>
18 #include <vector>
19 #include <map>
20
21
22 namespace dai {
23
24
25 /// Reads factor graph (as a pair of a variable vector and factor vector) from a file in the UAI approximate inference challenge format
26 /** \param[in] filename The filename (usually ends with ".uai")
27 * \param[in] verbose The amount of output sent to cout
28 * \param[out] vars Array of variables read from the file
29 * \param[out] factors Array of factors read from the file
30 * \param[out] permutations Array of permutations, which permute between libDAI canonical ordering and ordering specified by the file
31 * \see http://www.cs.huji.ac.il/project/UAI10 and http://graphmod.ics.uci.edu/uai08
32 */
33 void ReadUaiAieFactorGraphFile( const char *filename, size_t verbose, std::vector<Var>& vars, std::vector<Factor>& factors, std::vector<Permute>& permutations );
34
35
36 /// Reads evidence (a mapping from observed variable labels to the observed values) from a file in the UAI approximate inference challenge format
37 /** \param[in] filename The filename (usually ends with ".uai.evid")
38 * \param[in] verbose The amount of output sent to cout
39 * \see http://www.cs.huji.ac.il/project/UAI10 and http://graphmod.ics.uci.edu/uai08
40 */
41 std::vector<std::map<size_t, size_t> > ReadUaiAieEvidenceFile( const char* filename, size_t verbose );
42
43
44 } // end of namespace dai
45
46
47 #endif