49#ifndef GUM_CN_LOOPY_PROPAGATION_H
50#define GUM_CN_LOOPY_PROPAGATION_H
60#define INF_ std::numeric_limits< GUM_SCALAR >::infinity()
74 template < GUM_Numeric GUM_SCALAR >
77 using msg = std::vector< Tensor< GUM_SCALAR >* >;
105 void makeInference()
override;
107 void insertEvidenceFile(std::string_view path)
override;
118 void inferenceType(InferenceType inft);
124 InferenceType inferenceType();
138 void eraseAllEvidence()
override;
146 void saveInference(std::string_view path);
174 void makeInferenceNodeToNeighbours_();
176 void makeInferenceByOrderedArcs_();
178 void makeInferenceByRandomOrder_();
181 void updateMarginals_();
190 void msgL_(
const NodeId X,
191 const NodeId demanding_parent);
213 void compute_ext_(GUM_SCALAR& msg_l_min,
214 GUM_SCALAR& msg_l_max,
215 std::vector< GUM_SCALAR >& lx,
219 GUM_SCALAR& den_max);
238 void compute_ext_(std::vector< std::vector< GUM_SCALAR > >& combi_msg_p,
240 GUM_SCALAR& msg_l_min,
241 GUM_SCALAR& msg_l_max,
242 std::vector< GUM_SCALAR >& lx,
261 void enum_combi_(std::vector< std::vector< std::vector< GUM_SCALAR > > >& msgs_p,
263 GUM_SCALAR& msg_l_min,
264 GUM_SCALAR& msg_l_max,
265 std::vector< GUM_SCALAR >& lx,
275 void msgP_(
const NodeId X,
const NodeId demanding_child);
289 void enum_combi_(std::vector< std::vector< std::vector< GUM_SCALAR > > >& msgs_p,
291 GUM_SCALAR& msg_p_min,
292 GUM_SCALAR& msg_p_max);
305 void compute_ext_(std::vector< std::vector< GUM_SCALAR > >& combi_msg_p,
307 GUM_SCALAR& msg_p_min,
308 GUM_SCALAR& msg_p_max);
311 void refreshLMsPIs_(
bool refreshIndic =
false);
317 GUM_SCALAR calculateEpsilon_();
327 void computeExpectations_();
331 void updateIndicatrices_();
399#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
The base class for all directed edges.
Class representing the minimal interface for Bayesian network with no numerical data.
<agrum/CN/CNLoopyPropagation.h>
NodeProperty< GUM_SCALAR > NodesL_min_
"Lower" node information obtained by combinaison of children messages.
NodeProperty< GUM_SCALAR > NodesP_min_
"Lower" node information obtained by combinaison of parent's messages.
NodeProperty< GUM_SCALAR > NodesL_max_
"Upper" node information obtained by combinaison of children messages.
NodeProperty< NodeSet * > msg_l_sent_
Used to keep track of one's messages sent to it's parents.
InferenceType _inferenceType_
The chosen inference type.
NodeProperty< bool > update_p_
Used to keep track of which node needs to update it's information coming from it's parents.
NodeProperty< bool > update_l_
Used to keep track of which node needs to update it's information coming from it's children.
InferenceEngine< GUM_SCALAR > _infE_
To easily access InferenceEngine< GUM_SCALAR > methods.
std::vector< Tensor< GUM_SCALAR > * > msg
const IBayesNet< GUM_SCALAR > * _bnet_
A pointer to it's IBayesNet used as a DAG.
ArcProperty< GUM_SCALAR > ArcsP_min_
"Lower" information coming from one's parent.
InferenceType
Inference type to be used by the algorithm.
ArcProperty< GUM_SCALAR > ArcsL_max_
"Upper" information coming from one's children.
const CredalNet< GUM_SCALAR > * _cn_
A pointer to the CredalNet to be used.
NodeProperty< GUM_SCALAR > NodesP_max_
"Upper" node information obtained by combinaison of parent's messages.
const class gum::Arc * cArcP
NodeSet active_nodes_set_
The current node-set to iterate through at this current step.
NodeSet next_active_nodes_set_
The next node-set, i.e.
CNLoopyPropagation(const CredalNet< GUM_SCALAR > &credalNet)
Constructor.
bool inference_up_to_date_
TRUE if inference has already been performed, FALSE otherwise.
ArcProperty< GUM_SCALAR > ArcsL_min_
"Lower" information coming from one's children.
ArcProperty< GUM_SCALAR > ArcsP_max_
"Upper" information coming from one's parent.
Class template representing a Credal Network.
InferenceEngine(const CredalNet< GUM_SCALAR > &credalNet)
Construtor.
Size Idx
Type for indexes.
Size NodeId
Type for node ids.
HashTable< Arc, VAL > ArcProperty
Property on graph elements.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
Abstract class representing CredalNet inference engines.
gum is the global namespace for all aGrUM entities