29 #ifndef __CN_LOOPY_PROPAGATION__H__ 30 #define __CN_LOOPY_PROPAGATION__H__ 36 #include <agrum/CN/credalNet.h> 37 #include <agrum/CN/inference/inferenceEngine.h> 38 #include <agrum/tools/core/approximations/approximationScheme.h> 39 #include <agrum/tools/core/math/pow.h> 40 #include <agrum/tools/core/sequence.h> 42 #define INF_ std::numeric_limits< GUM_SCALAR >::infinity() 56 template <
typename GUM_SCALAR >
171 void msgL_(
const NodeId X,
172 const NodeId demanding_parent);
195 GUM_SCALAR& msg_l_max,
196 std::vector< GUM_SCALAR >& lx,
200 GUM_SCALAR& den_max);
256 void msgP_(
const NodeId X,
const NodeId demanding_child);
380 InferenceEngine< GUM_SCALAR >::insertEvidenceFile(path);
385 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 391 #include <agrum/CN/inference/CNLoopyPropagation_tpl.h> void refreshLMsPIs_(bool refreshIndic=false)
Get the last messages from one's parents and children.
NodeProperty< NodeSet *> msg_l_sent_
Used to keep track of one's messages sent to it's parents.
void makeInferenceByOrderedArcs_()
Starts the inference with this inference type.
const CredalNet< GUM_SCALAR > * _cn_
A pointer to the CredalNet to be used.
GUM_SCALAR calculateEpsilon_()
Compute epsilon.
NodeProperty< bool > update_l_
Used to keep track of which node needs to update it's information coming from it's children...
InferenceType _inferenceType_
The choosen inference type.
virtual void insertEvidenceFile(const std::string &path)
Insert evidence from file.
INLINE void emplace(Args &&... args)
void makeInferenceNodeToNeighbours_()
Starts the inference with this inference type.
void eraseAllEvidence()
Erase all inference related data to perform another one.
ArcProperty< GUM_SCALAR > ArcsP_min_
"Lower" information coming from one's parent.
NodeSet active_nodes_set
The current node-set to iterate through at this current step.
ArcProperty< GUM_SCALAR > ArcsL_max_
"Upper" information coming from one's children.
NodeProperty< GUM_SCALAR > NodesL_min_
"Lower" node information obtained by combinaison of children messages.
NodeProperty< GUM_SCALAR > NodesP_max_
"Upper" node information obtained by combinaison of parent's messages.
<agrum/CN/CNLoopyPropagation.h>
Chooses an arc ordering and sends messages accordingly at all steps.
NodeProperty< GUM_SCALAR > NodesP_min_
"Lower" node information obtained by combinaison of parent's messages.
void compute_ext_(std::vector< std::vector< GUM_SCALAR > > &combi_msg_p, const NodeId &id, GUM_SCALAR &msg_p_min, GUM_SCALAR &msg_p_max)
Used by msgP_.
NodeProperty< bool > update_p_
Used to keep track of which node needs to update it's information coming from it's parents...
ArcProperty< GUM_SCALAR > ArcsP_max_
"Upper" information coming from one's parent.
InferenceType inferenceType()
Get the inference type.
NodeProperty< GUM_SCALAR > NodesL_max_
"Upper" node information obtained by combinaison of children messages.
CNLoopyPropagation(const CredalNet< GUM_SCALAR > &cnet)
Constructor.
bool InferenceUpToDate_
TRUE if inference has already been performed, FALSE otherwise.
Uses a node-set so we don't iterate on nodes that can't send a new message.
const IBayesNet< GUM_SCALAR > * _bnet_
A pointer to it's IBayesNet used as a DAG.
void msgP_(const NodeId X, const NodeId demanding_child)
Sends a message to one's child, i.e.
void saveInference(const std::string &path)
void makeInferenceByRandomOrder_()
Starts the inference with this inference type.
void makeInference()
Starts the inference.
void initialize_()
Topological forward propagation to initialize old marginals & messages.
virtual ~CNLoopyPropagation()
Destructor.
void enum_combi_(std::vector< std::vector< std::vector< GUM_SCALAR > > > &msgs_p, const NodeId &id, GUM_SCALAR &msg_p_min, GUM_SCALAR &msg_p_max)
Used by msgP_.
void inferenceType(InferenceType inft)
Set the inference type.
void updateIndicatrices_()
Only update indicatrices variables at the end of computations ( calls msgP_ ).
void compute_ext_(GUM_SCALAR &msg_l_min, GUM_SCALAR &msg_l_max, std::vector< GUM_SCALAR > &lx, GUM_SCALAR &num_min, GUM_SCALAR &num_max, GUM_SCALAR &den_min, GUM_SCALAR &den_max)
Used by msgL_.
void updateMarginals_()
Compute marginals from up-to-date messages.
InferenceType
Inference type to be used by the algorithm.
void msgL_(const NodeId X, const NodeId demanding_parent)
Sends a message to one's parent, i.e.
Chooses a random arc ordering and sends messages accordingly.
NodeSet next_active_nodes_set
The next node-set, i.e.
void computeExpectations_()
Since the network is binary, expectations can be computed from the final marginals which give us the ...
namespace for all credal networks entities
ArcProperty< GUM_SCALAR > ArcsL_min_
"Lower" information coming from one's children.