49#ifndef GUM_BAYES_NET_FRAGMENT_H
50#define GUM_BAYES_NET_FRAGMENT_H
89 template <
typename GUM_SCALAR >
144 const Tensor< GUM_SCALAR >&
cpt(
NodeId varId)
const final;
146 const Tensor< GUM_SCALAR >&
cpt(
const std::string& name)
const {
191 virtual std::string
toDot() const final;
266 void installCPT(
const std::string& name,
const Tensor< GUM_SCALAR >& pot) {
332#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
333 extern template class BayesNetFragment< double >;
Template implementation of BN/BayesNetFragment.h classes.
Class representing Bayesian networks.
void uninstallNode(NodeId id)
uninstall a node referenced by its nodeId
virtual void whenNodeDeleted(const void *src, NodeId id) final
the action to take when a node has just been removed from the graph
void installNode(NodeId id)
install a node referenced by its nodeId
virtual ~BayesNetFragment()
void installMarginal(NodeId id, const Tensor< GUM_SCALAR > &pot)
install a local marginal BY COPY for a node into the fragment.
virtual void whenNodeAdded(const void *src, NodeId id) final
the action to take when a new node is inserted into the graph
const Tensor< GUM_SCALAR > & cpt(const std::string &name) const
Returns the CPT of a variable.
void installCPT_(NodeId id, const Tensor< GUM_SCALAR > &pot)
const IBayesNet< GUM_SCALAR > & _bn_
The referred BayesNet.
gum::BayesNet< GUM_SCALAR > toBN() const
create a brand new BayesNet from a fragment.
virtual void whenArcDeleted(const void *src, NodeId from, NodeId to) final
the action to take when an arc has just been removed from the graph
bool checkConsistency(const std::string &name) const
check if a certain NodeId exists in the fragment
virtual void whenArcAdded(const void *src, NodeId from, NodeId to) final
the action to take when a new arc is inserted into the graph
virtual const DiscreteVariable & variable(NodeId id) const final
Returns a constant reference over a variabe given it's node id.
BayesNetFragment(BayesNetFragment< GUM_SCALAR > &&fragment)=delete
bool checkConsistency() const
returns true if all nodes in the fragment are consistent
NodeProperty< const Tensor< GUM_SCALAR > * > _localCPTs_
Mapping between the variable's id and their CPT specific to this Fragment.
virtual NodeId nodeId(const DiscreteVariable &var) const final
Return id node from discrete var pointer.
const VariableNodeMap & variableNodeMap() const final
Returns a constant reference to the VariableNodeMap of this BN.
void installNode(const std::string &name)
check if a certain NodeId exists in the fragment
void uninstallCPT_(NodeId id)
uninstall a local CPT.
virtual NodeId idFromName(const std::string &name) const final
Getter by name.
virtual std::string toDot() const final
creates a dot representing the whole referred BN hilighting the fragment.
void installMarginal(const std::string &name, const Tensor< GUM_SCALAR > &pot)
check if a certain NodeId exists in the fragment
virtual const DiscreteVariable & variableFromName(const std::string &name) const final
Getter by name.
bool isInstalledNode(NodeId id) const
check if a certain NodeId exists in the fragment
void installAscendants(const std::string &name)
check if a certain NodeId exists in the fragment
void installCPT(const std::string &name, const Tensor< GUM_SCALAR > &pot)
check if a certain NodeId exists in the fragment
BayesNetFragment(const BayesNetFragment< GUM_SCALAR > &fragment)=delete
void installArc_(NodeId from, NodeId to)
void installAscendants(NodeId id)
install a node and all its ascendants
void uninstallCPT(const std::string &name)
check if a certain NodeId exists in the fragment
void uninstallArc_(NodeId from, NodeId to)
BayesNetFragment()=delete
void uninstallNode(const std::string &name)
check if a certain NodeId exists in the fragment
const Tensor< GUM_SCALAR > & cpt(NodeId varId) const final
Returns the CPT of a variable.
void uninstallCPT(NodeId id)
uninstall a local CPT.
void installCPT(NodeId id, const Tensor< GUM_SCALAR > &pot)
install a local cpt BY COPYfor a node into the fragment.
Class representing a Bayesian network.
const DAG & dag() const
Returns a constant reference to the dag of this Bayes Net.
const NodeGraphPart & nodes() const final
Returns a constant reference to the dag of this Bayes Net.
Abstract Base class for all diGraph Listener.
Base class for discrete random variable.
Class representing the minimal interface for Bayesian network with no numerical data.
IBayesNet()
Default constructor.
Container used to map discrete variables with nodes.
Base classes for oriented graph listeners.
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
gum is the global namespace for all aGrUM entities