73 template < GUM_Numeric GUM_SCALAR >
94 std::string
name()
const override;
117 void joint_(
const std::vector< Chain >& queries, Tensor< GUM_SCALAR >& j)
override;
210 std::string
_trim_(std::string_view s);
216#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Inline implementation of SVE.
Headers of ClassBayesNet<GUM_SCALAR>.
The class for generic Hash Tables.
Generic doubly linked lists.
A PRMClass is an object of a PRM representing a fragment of a Bayesian network which can be instantia...
std::pair< const PRMInstance< GUM_SCALAR > *, const PRMAttribute< GUM_SCALAR > * > Chain
Code alias.
PRMInference(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default constructor.
An PRMInstance is a Bayesian network fragment defined by a Class and used in a PRMSystem.
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
This class is an implementation of the Structured Variable Elimination algorithm on PRM<GUM_SCALAR>.
Sequence< std::string > * _class_elim_order_
Set< Tensor< GUM_SCALAR > * > BucketSet
Code alias.
void _eliminateNodesWithEvidence_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash, Set< NodeId > *delayedVars=0)
Returns true if second can be eliminated before first.
typename Set< Tensor< GUM_SCALAR > * >::iterator_safe BucketSetIterator
void _initLiftedNodes_(const PRMClass< GUM_SCALAR > &c)
Returns true if second can be eliminated before first.
void _insertLiftedNodes_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash)
Returns true if second can be eliminated before first.
std::string _trim_(std::string_view s)
Returns true if second can be eliminated before first.
void _variableElimination_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash, Set< NodeId > *delayedVars=0)
Returns true if second can be eliminated before first.
~SVE() override
Destructor.
HashTable< const PRMClass< GUM_SCALAR > *, std::vector< NodeId > * > _elim_orders_
void _eliminateNodes_(const PRMInstance< GUM_SCALAR > *query, NodeId id, BucketSet &pool, BucketSet &trash)
Returns true if second can be eliminated before first.
std::string name() const override
Returns the name of the current inference algorithm.
bool _checkElimOrder_(const PRMInstance< GUM_SCALAR > *first, const PRMInstance< GUM_SCALAR > *second)
Returns true if second can be eliminated before first.
void joint_(const std::vector< Chain > &queries, Tensor< GUM_SCALAR > &j) override
See PRMInference<GUM_SCALAR>::joint_().
void _eliminateNodesUpward_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash, List< const PRMInstance< GUM_SCALAR > * > &elim_list, Set< const PRMInstance< GUM_SCALAR > * > &ignore, Set< const PRMInstance< GUM_SCALAR > * > &eliminated)
Returns true if second can be eliminated before first.
void posterior_(const Chain &chain, Tensor< GUM_SCALAR > &m) override
See PRMInference<GUM_SCALAR>::posterior_().
void _initElimOrder_()
Returns true if second can be eliminated before first.
void evidenceRemoved_(const Chain &chain) override
See PRMInference<GUM_SCALAR>::evidenceRemoved_().
HashTable< std::string, Size > _delayedVariablesCounters_
Some variable must be delayed for more than one PRMInstance<GUM_SCALAR>, when the delayed variable co...
void _insertEvidence_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool)
Returns true if second can be eliminated before first.
void evidenceAdded_(const Chain &chain) override
See PRMInference<GUM_SCALAR>::evidenceAdded_().
typename PRMInference< GUM_SCALAR >::Chain Chain
Code alias.
void _eliminateNodesDownward_(const PRMInstance< GUM_SCALAR > *from, const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash, List< const PRMInstance< GUM_SCALAR > * > &elim_list, Set< const PRMInstance< GUM_SCALAR > * > &ignore, Set< const PRMInstance< GUM_SCALAR > * > &eliminated)
Returns true if second can be eliminated before first.
SVE(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default Constructor.
Tensor< GUM_SCALAR > * _getAggTensor_(const PRMInstance< GUM_SCALAR > *i, const PRMAggregate< GUM_SCALAR > *agg)
Returns true if second can be eliminated before first.
void _addDelayedVariable_(const PRMInstance< GUM_SCALAR > *i, const PRMInstance< GUM_SCALAR > *j, NodeId id)
When there is a loop in the references some variable elimination must be delayed, this methods add su...
HashTable< const PRMClass< GUM_SCALAR > *, BucketSet * > _lifted_pools_
std::vector< NodeId > & _getElimOrder_(const PRMClass< GUM_SCALAR > &c)
Returns true if second can be eliminated before first.
HashTable< const PRMInstance< GUM_SCALAR > *, gum::VariableSet * > _delayedVariables_
typename Set< MultiDimArray< GUM_SCALAR > * >::iterator_safe ArraySetIterator
void _eliminateDelayedVariables_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash)
Returns true if second can be eliminated before first.
Size NodeId
Type for node ids.
Headers of InstanceBayesNet.
namespace for all probabilistic relational models entities
gum is the global namespace for all aGrUM entities
Set< const DiscreteVariable * > VariableSet
class for graph triangulations for which we enforce a given partial ordering on the nodes elimination...
Implementation of a variable elimination algorithm for inference in Bayesian networks.