aGrUM  0.13.2
barrenNodesFinder_tpl.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES et Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
21 namespace gum {
22 
24  template < typename GUM_SCALAR >
25  ArcProperty< Set< const Potential< GUM_SCALAR >* > >
27  const IBayesNet< GUM_SCALAR >& bn) {
28  // get the barren nodes
29  ArcProperty< NodeSet > barren_nodes = this->barrenNodes(junction_tree);
30 
31  // transform the node sets into sets of potentials
33  for (const auto& barren : barren_nodes) {
35  for (const auto node : barren.second) {
36  potentials.insert(&(bn.cpt(node)));
37  }
38  result.insert(Arc(barren.first), std::move(potentials));
39  }
40 
41  return result;
42  }
43 
44 
45 } /* namespace gum */
virtual const Potential< GUM_SCALAR > & cpt(NodeId varId) const =0
Returns the CPT of a variable.
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
Class representing the minimal interface for Bayesian Network.
Definition: IBayesNet.h:59
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:676
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
The base class for all directed edgesThis class is used as a basis for manipulating all directed edge...
NodeSet barrenNodes()
returns the set of barren nodes
Basic graph of cliques.
Definition: cliqueGraph.h:55
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:613