49#ifndef GUM_BAYES_NET_FRAGMENT_H
50#define GUM_BAYES_NET_FRAGMENT_H
89 template < GUM_Numeric GUM_SCALAR >
144 const Tensor< GUM_SCALAR >&
cpt(
NodeId varId)
const final;
146 const Tensor< GUM_SCALAR >&
cpt(std::string_view name)
const;
320#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Template implementation of BN/BayesNetFragment.h classes.
Class representing Bayesian networks.
void installNode(NodeId id)
install a node referenced by its nodeId
void installMarginal(NodeId id, const Tensor< GUM_SCALAR > &pot)
install a local marginal BY COPY for a node into the fragment.
const DiscreteVariable & variableFromName(std::string_view name) const final
Getter by name.
void uninstallArc_(NodeId from, NodeId to)
void whenNodeDeleted(const void *src, NodeId id) final
the action to take when a node has just been removed from the graph
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.
void installArc_(NodeId from, NodeId to)
void whenNodeAdded(const void *src, NodeId id) final
the action to take when a new node is inserted into the graph
BayesNetFragment(BayesNetFragment< GUM_SCALAR > &&fragment)=delete
void whenArcDeleted(const void *src, NodeId from, NodeId to) final
the action to take when an arc has just been removed from the graph
NodeId idFromName(std::string_view name) const final
Getter by name.
const DiscreteVariable & variable(NodeId id) const final
Returns a constant reference over a variabe given it's node id.
bool isInstalledNode(NodeId id) const
check if a certain NodeId exists in the fragment
void whenArcAdded(const void *src, NodeId from, NodeId to) final
the action to take when a new arc is inserted into the graph
NodeProperty< const Tensor< GUM_SCALAR > * > _localCPTs_
Mapping between the variable's id and their CPT specific to this Fragment.
bool checkConsistency(NodeId id) const
returns true if the nodeId's (local or not) cpt is consistent with its parents in the fragment
void uninstallNode(NodeId id)
uninstall a node referenced by its nodeId
std::string toDot() const final
creates a dot representing the whole referred BN hilighting the fragment.
~BayesNetFragment() override
BayesNetFragment(const BayesNetFragment< GUM_SCALAR > &fragment)=delete
void installAscendants(NodeId id)
install a node and all its ascendants
NodeId nodeId(const DiscreteVariable &var) const final
Return id node from discrete var pointer.
void uninstallCPT(NodeId id)
uninstall a local CPT.
const VariableNodeMap & variableNodeMap() const final
Returns a constant reference to the VariableNodeMap of this BN.
BayesNetFragment()=delete
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.
DAG dag() const
Returns a named copy of the internal DAG: each node id is assigned the name of the corresponding vari...
const NodeGraphPart & nodes() const final
Returns a named copy of the internal DAG: each node id is assigned the name of the corresponding vari...
Abstract Base class for all diGraph Listener.
Base class for discrete random variable.
IBayesNet()
Default constructor.
aGrUM's Tensor is a multi-dimensional array with tensor operators.
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