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,
108 Potential< GUM_SCALAR >& j);
152 const PRMInstance< GUM_SCALAR >* from,
153 const PRMInstance< GUM_SCALAR >* i,
156 List<
const PRMInstance< GUM_SCALAR >* >& elim_list,
161 const PRMInstance< GUM_SCALAR >* i,
164 List<
const PRMInstance< GUM_SCALAR >* >& elim_list,
188 const PRMInstance< GUM_SCALAR >* second);
201 const PRMInstance< GUM_SCALAR >* j,
217 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 218 extern template class SVE<
double >;
225 #include <agrum/PRM/inference/SVE_tpl.h> 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.
void eliminateNodesWithEvidence__(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash, Set< NodeId > *delayedVars=0)
Returns true if second can be eliminated before first.
Sequence< std::string > * class_elim_order__
void eliminateDelayedVariables__(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool, BucketSet &trash)
Returns true if second can be eliminated before first.
INLINE void emplace(Args &&... args)
HashTable< std::string, Size > delayedVariablesCounters__
Some variable must be delayed for more than one PRMInstance<GUM_SCALAR>, when the delayed variable co...
HashTable< const PRMClass< GUM_SCALAR > *, BucketSet *> lifted_pools__
bool checkElimOrder__(const PRMInstance< GUM_SCALAR > *first, const PRMInstance< GUM_SCALAR > *second)
Returns true if second can be eliminated before first.
void initElimOrder__()
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.
virtual void evidenceRemoved_(const Chain &chain)
See PRMInference<GUM_SCALAR>::evidenceRemoved_().
void insertEvidence__(const PRMInstance< GUM_SCALAR > *i, BucketSet &pool)
Returns true if second can be eliminated before first.
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_().
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(const PRM< GUM_SCALAR > &prm, const PRMSystem< GUM_SCALAR > &system)
Default Constructor.
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)
void eliminateNodes__(const PRMInstance< GUM_SCALAR > *query, NodeId id, BucketSet &pool, BucketSet &trash)
Returns true if second can be eliminated before first.
std::string trim__(const std::string &s)
Returns true if second can be eliminated before first.
virtual std::string name() const
Returns the name of the current inference algorithm.
std::vector< NodeId > & getElimOrder__(const PRMClass< GUM_SCALAR > &c)
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.
HashTable< const PRMInstance< GUM_SCALAR > *, Set< const DiscreteVariable *> *> delayedVariables__
Potential< GUM_SCALAR > * getAggPotential__(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...
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.