aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
dSeparation.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief d-separation analysis (as described in Koller & Friedman 2009)
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #ifndef GUM_D_SEPARATION_H
30 #define GUM_D_SEPARATION_H
31 
32 
33 #include <agrum/BN/IBayesNet.h>
34 #include <agrum/agrum.h>
35 
36 
37 namespace gum {
38 
39  /** @class dSeparation
40  * @brief the d-separation algorithm as described in Koller & Friedman (2009)
41  * @ingroup bn_inference
42  */
43  class dSeparation {
44  public:
45  // ############################################################################
46  /// @name Constructors / Destructors
47  // ############################################################################
48  /// @{
49 
50  /// default constructor
51  dSeparation();
52 
53  /// copy constructor
54  dSeparation(const dSeparation& from);
55 
56  /// move constructor
57  dSeparation(dSeparation&& from);
58 
59  /// destructor
60  ~dSeparation();
61 
62  /// @}
63 
64 
65  // ############################################################################
66  /// @name Operators
67  // ############################################################################
68  /// @{
69 
70  /// copy operator
71  dSeparation& operator=(const dSeparation& from);
72 
73  /// move operator
75 
76  /// @}
77 
78 
79  // ############################################################################
80  /// @name Accessors / Modifiers
81  // ############################################################################
82  /// @{
83 
84  /** @brief Fill the 'requisite' nodeset with the requisite nodes in dag
85  * given a query and evidence.
86  *
87  * Requisite nodes are those that are d-connected to at least one of the
88  * query nodes given a set of hard and soft evidence
89  */
90  void requisiteNodes(const DAG& dag,
91  const NodeSet& query,
92  const NodeSet& hardEvidence,
93  const NodeSet& softEvidence,
94  NodeSet& requisite);
95 
96  /** @brief update a set of potentials, keeping only those d-connected with
97  * query variables given evidence */
98  template < typename GUM_SCALAR, template < typename > class TABLE >
99  void relevantPotentials(const IBayesNet< GUM_SCALAR >& bn,
100  const NodeSet& query,
101  const NodeSet& hardEvidence,
102  const NodeSet& softEvidence,
103  Set< const TABLE< GUM_SCALAR >* >& potentials);
104 
105  /// @}
106  };
107 
108 
109 } /* namespace gum */
110 
111 
112 #ifndef GUM_NO_INLINE
113 # include <agrum/BN/algorithms/dSeparation_inl.h>
114 #endif // GUM_NO_INLINE
115 
116 #include <agrum/BN/algorithms/dSeparation_tpl.h>
117 
118 
119 #endif /* GUM_D_SEPARATION_H */
dSeparation & operator=(dSeparation &&from)
move operator
~dSeparation()
destructor
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
the d-separation algorithm as described in Koller & Friedman (2009)
Definition: dSeparation.h:43
void relevantPotentials(const IBayesNet< GUM_SCALAR > &bn, const NodeSet &query, const NodeSet &hardEvidence, const NodeSet &softEvidence, Set< const TABLE< GUM_SCALAR > * > &potentials)
update a set of potentials, keeping only those d-connected with query variables given evidence ...
dSeparation(dSeparation &&from)
move constructor
dSeparation & operator=(const dSeparation &from)
copy operator
void requisiteNodes(const DAG &dag, const NodeSet &query, const NodeSet &hardEvidence, const NodeSet &softEvidence, NodeSet &requisite)
Fill the &#39;requisite&#39; nodeset with the requisite nodes in dag given a query and evidence.
Definition: dSeparation.cpp:40
dSeparation()
default constructor
dSeparation(const dSeparation &from)
copy constructor