aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
barrenNodesFinder.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 Detect barren nodes for inference in Bayesian networks
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 #ifndef GUM_BARREN_NODES_FINDER_H
29 #define GUM_BARREN_NODES_FINDER_H
30 
31 
32 #include <agrum/BN/BayesNet.h>
33 #include <agrum/agrum.h>
34 #include <agrum/tools/graphs/DAG.h>
35 #include <agrum/tools/graphs/cliqueGraph.h>
36 
37 
38 namespace gum {
39 
40 
41  /**
42  * @class BarrenNodesFinder
43  * @brief Detect barren nodes for inference in Bayesian networks
44  * @ingroup bn_inference
45  */
47  public:
48  // ############################################################################
49  /// @name Constructors / Destructors
50  // ############################################################################
51  /// @{
52 
53  /// default constructor
54  explicit BarrenNodesFinder(const DAG* dag);
55 
56  /// copy constructor
58 
59  /// move constructor
60  BarrenNodesFinder(BarrenNodesFinder&& from) noexcept;
61 
62  /// destructor
64 
65  /// @}
66 
67 
68  // ############################################################################
69  /// @name Operators
70  // ############################################################################
71  /// @{
72 
73  /// copy operator
75 
76  /// move operator
78 
79  /// @}
80 
81 
82  // ############################################################################
83  /// @name Accessors / Modifiers
84  // ############################################################################
85  /// @{
86 
87  /// sets a new DAG
88  void setDAG(const DAG* new_dag);
89 
90  /// sets the observed nodes in the DAG
91  void setEvidence(const NodeSet* observed_nodes);
92 
93  /// sets the set of target nodes we are interested in
94  void setTargets(const NodeSet* target_nodes);
95 
96  /// returns the set of barren nodes
98 
99  /// returns the set of barren nodes in the messages sent in a junction tree
101 
102  /// returns the set of barren potentials in messages sent in a junction tree
103  template < typename GUM_SCALAR >
104  ArcProperty< Set< const Potential< GUM_SCALAR >* > >
106 
107  /// @}
108 
109  private:
110  /// the DAG on which we compute the barren nodes
111  const DAG* _dag_;
112 
113  /// the set of observed nodes
115 
116  /// the set of targeted nodes
118  };
119 
120 
121 } /* namespace gum */
122 
123 
124 #ifndef GUM_NO_INLINE
125 # include <agrum/BN/algorithms/barrenNodesFinder_inl.h>
126 #endif // GUM_NO_INLINE
127 
128 
129 #include <agrum/BN/algorithms/barrenNodesFinder_tpl.h>
130 
131 
132 #endif /* GUM_BARREN_NODES_FINDER_H */
BarrenNodesFinder & operator=(BarrenNodesFinder &&from)
move operator
const NodeSet * _observed_nodes_
the set of observed nodes
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
const NodeSet * _target_nodes_
the set of targeted nodes
BarrenNodesFinder(const BarrenNodesFinder &from)
copy constructor
BarrenNodesFinder & operator=(const BarrenNodesFinder &from)
copy operator
ArcProperty< NodeSet > barrenNodes(const CliqueGraph &junction_tree)
returns the set of barren nodes in the messages sent in a junction tree
NodeSet barrenNodes()
returns the set of barren nodes
BarrenNodesFinder(BarrenNodesFinder &&from) noexcept
move constructor
const DAG * _dag_
the DAG on which we compute the barren nodes
BarrenNodesFinder(const DAG *dag)
default constructor
void setTargets(const NodeSet *target_nodes)
sets the set of target nodes we are interested in
void setEvidence(const NodeSet *observed_nodes)
sets the observed nodes in the DAG
void setDAG(const DAG *new_dag)
sets a new DAG
ArcProperty< Set< const Potential< GUM_SCALAR > *> > barrenPotentials(const CliqueGraph &junction_tree, const IBayesNet< GUM_SCALAR > &bn)
returns the set of barren potentials in messages sent in a junction tree