34 #include <agrum/tools/core/set.h> 36 #include <agrum/tools/graphs/algorithms/triangulations/defaultTriangulation.h> 37 #include <agrum/tools/graphs/algorithms/triangulations/partialOrderedTriangulation.h> 39 #include <agrum/BN/inference/variableElimination.h> 41 #include <agrum/tools/multidim/implementations/multiDimArray.h> 42 #include <agrum/tools/multidim/implementations/multiDimBucket.h> 43 #include <agrum/tools/multidim/implementations/multiDimSparse.h> 44 #include <agrum/tools/multidim/potential.h> 46 #include <agrum/PRM/utils_prm.h> 48 #include <agrum/PRM/inference/PRMInference.h> 50 #include <agrum/PRM/classBayesNet.h> 51 #include <agrum/PRM/instanceBayesNet.h> 64 template <
typename GUM_SCALAR >
73 SVE(
const PRM< GUM_SCALAR >& prm,
const PRMSystem< GUM_SCALAR >& system);
104 virtual void posterior_(
const Chain& chain, Potential< GUM_SCALAR >& m);
107 virtual void joint_(
const std::vector< Chain >& queries, Potential< GUM_SCALAR >& j);
147 const PRMInstance< GUM_SCALAR >* i,
150 List<
const PRMInstance< GUM_SCALAR >* >& elim_list,
157 List<
const PRMInstance< GUM_SCALAR >* >& elim_list,
171 _insertLiftedNodes_(
const PRMInstance< GUM_SCALAR >* i, BucketSet& pool, BucketSet& trash);
180 const PRMInstance< GUM_SCALAR >* second);
193 const PRMInstance< GUM_SCALAR >* j,
208 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 209 extern template class SVE<
double >;
216 #include <agrum/PRM/inference/SVE_tpl.h>
HashTable< const PRMInstance< GUM_SCALAR > *, Set< const DiscreteVariable *> *> _delayedVariables_
void _insertLiftedNodes_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash)
Returns true if second can be eliminated before first.
bool _checkElimOrder_(const PRMInstance< GUM_SCALAR > *first, const PRMInstance< GUM_SCALAR > *second)
Returns true if second can be eliminated before first.
INLINE void emplace(Args &&... args)
void _eliminateNodesWithEvidence_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash, Set< NodeId > *delayedVars=0)
Returns true if second can be eliminated before first.
HashTable< std::string, Size > _delayedVariablesCounters_
Some variable must be delayed for more than one PRMInstance<GUM_SCALAR>, when the delayed variable co...
void _variableElimination_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash, Set< NodeId > *delayedVars=0)
Returns true if second can be eliminated before first.
void _insertEvidence_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool)
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_
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.
virtual void evidenceRemoved_(const Chain &chain)
See PRMInference<GUM_SCALAR>::evidenceRemoved_().
virtual void posterior_(const Chain &chain, Potential< GUM_SCALAR > &m)
See PRMInference<GUM_SCALAR>::posterior_().
virtual void evidenceAdded_(const Chain &chain)
See PRMInference<GUM_SCALAR>::evidenceAdded_().
SVE(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default Constructor.
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.
virtual void joint_(const std::vector< Chain > &queries, Potential< GUM_SCALAR > &j)
See PRMInference<GUM_SCALAR>::joint_().
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
std::string _trim_(const std::string &s)
Returns true if second can be eliminated before first.
std::vector< NodeId > & _getElimOrder_(const PRMClass< GUM_SCALAR > &c)
Returns true if second can be eliminated before first.
void _eliminateDelayedVariables_(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash)
Returns true if second can be eliminated before first.
virtual std::string name() const
Returns the name of the current inference algorithm.
Sequence< std::string > * _class_elim_order_
void _initElimOrder_()
Returns true if second can be eliminated before first.
void _initLiftedNodes_(const PRMClass< GUM_SCALAR > &c)
Returns true if second can be eliminated before first.
void _eliminateNodes_(const PRMInstance< GUM_SCALAR > *query, NodeId id, BucketSet &pool, BucketSet &trash)
Returns true if second can be eliminated before first.
Potential< GUM_SCALAR > * _getAggPotential_(const PRMInstance< GUM_SCALAR > *i, const PRMAggregate< GUM_SCALAR > *agg)
Returns true if second can be eliminated before first.