libDAI
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
include
dai
exactinf.h
Go to the documentation of this file.
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
11
12
13
#ifndef __defined_libdai_exactinf_h
14
#define __defined_libdai_exactinf_h
15
16
17
#include <
dai/daialg.h
>
18
#include <
dai/properties.h
>
19
#include <
dai/factorgraph.h
>
20
#include <
dai/enum.h
>
21
22
23
namespace
dai {
24
25
27
32
class
ExactInf
:
public
DAIAlgFG
{
33
public
:
35
struct
Properties
{
37
size_t
verbose
;
38
} props;
39
40
private
:
42
std::vector<Factor>
_beliefsV
;
44
std::vector<Factor>
_beliefsF
;
46
Real
_logZ
;
47
48
public
:
50
51
52
ExactInf
() :
DAIAlgFG
(), props(),
_beliefsV
(),
_beliefsF
(),
_logZ
(0) {}
53
55
58
ExactInf
(
const
FactorGraph
&
fg
,
const
PropertySet
&opts ) :
DAIAlgFG
(fg), props(),
_beliefsV
(),
_beliefsF
(),
_logZ
() {
59
setProperties
( opts );
60
construct
();
61
}
63
65
66
virtual
ExactInf
*
clone
()
const
{
return
new
ExactInf
(*
this
); }
67
virtual
ExactInf
*
construct
(
const
FactorGraph
&
fg
,
const
PropertySet
&opts )
const
{
return
new
ExactInf
( fg, opts ); }
68
virtual
std::string
name
()
const
{
return
"EXACT"
; }
69
virtual
Factor
belief
(
const
Var
&v )
const
{
return
beliefV
( findVar( v ) ); }
70
virtual
Factor
belief
(
const
VarSet
&vs )
const
;
71
virtual
Factor
beliefV
(
size_t
i )
const
{
return
_beliefsV
[i]; }
72
virtual
Factor
beliefF
(
size_t
I )
const
{
return
_beliefsF
[I]; }
73
virtual
std::vector<Factor>
beliefs
()
const
;
74
virtual
Real
logZ
()
const
{
return
_logZ
; }
77
std::vector<std::size_t>
findMaximum
()
const
;
78
virtual
void
init
();
79
virtual
void
init
(
const
VarSet
&
/*ns*/
) {}
80
virtual
Real
run
();
81
virtual
Real
maxDiff
()
const
{ DAI_THROW(NOT_IMPLEMENTED);
return
0.0; }
82
virtual
size_t
Iterations
()
const
{ DAI_THROW(NOT_IMPLEMENTED);
return
0; }
83
virtual
void
setProperties
(
const
PropertySet
&opts );
84
virtual
PropertySet
getProperties
()
const
;
85
virtual
std::string
printProperties
()
const
;
87
89
90
91
93
Factor
calcMarginal
(
const
VarSet
&vs )
const
;
95
96
private
:
98
void
construct
();
99
};
100
101
102
}
// end of namespace dai
103
104
105
#endif
Generated on Mon Sep 17 2012 12:30:34 for libDAI by
1.8.1.2