28 #ifndef __CN_LOOPY_PROPAGATION__H__ 29 #define __CN_LOOPY_PROPAGATION__H__ 41 #define _INF std::numeric_limits< GUM_SCALAR >::infinity() 55 template <
typename GUM_SCALAR >
58 using msg = std::vector< Potential< GUM_SCALAR >* >;
171 const NodeId demanding_parent);
194 GUM_SCALAR& msg_l_max,
195 std::vector< GUM_SCALAR >& lx,
199 GUM_SCALAR& den_max);
218 void _compute_ext(std::vector< std::vector< GUM_SCALAR > >& combi_msg_p,
220 GUM_SCALAR& msg_l_min,
221 GUM_SCALAR& msg_l_max,
222 std::vector< GUM_SCALAR >& lx,
242 std::vector< std::vector< std::vector< GUM_SCALAR > > >& msgs_p,
244 GUM_SCALAR& msg_l_min,
245 GUM_SCALAR& msg_l_max,
246 std::vector< GUM_SCALAR >& lx,
271 std::vector< std::vector< std::vector< GUM_SCALAR > > >& msgs_p,
273 GUM_SCALAR& msg_p_min,
274 GUM_SCALAR& msg_p_max);
287 void _compute_ext(std::vector< std::vector< GUM_SCALAR > >& combi_msg_p,
289 GUM_SCALAR& msg_p_min,
290 GUM_SCALAR& msg_p_max);
386 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS NodeProperty< bool > _update_p
Used to keep track of which node needs to update it's information coming from it's parents...
This file contains general scheme for iteratively convergent algorithms.
NodeProperty< GUM_SCALAR > _NodesP_min
"Lower" node information obtained by combinaison of parent's messages.
Header file of gum::Sequence, a class for storing (ordered) sequences of objects. ...
void _makeInferenceByOrderedArcs()
Starts the inference with this inference type.
virtual void insertEvidenceFile(const std::string &path)
Insert evidence from file.
void eraseAllEvidence()
Erase all inference related data to perform another one.
virtual void insertEvidenceFile(const std::string &path)
Insert evidence from file.
InferenceType __inferenceType
The choosen inference type.
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.
void _initialize()
Topological forward propagation to initialize old marginals & messages.
Implementation of pow functions with integers, faster than stl implementation.
const CredalNet< GUM_SCALAR > * __cn
A pointer to the CredalNet to be used.
<agrum/CN/CNLoopyPropagation.h>
ArcProperty< GUM_SCALAR > _ArcsP_max
"Upper" information coming from one's parent.
ArcProperty< GUM_SCALAR > _ArcsL_max
"Upper" information coming from one's children.
Chooses an arc ordering and sends messages accordingly at all steps.
Class representing the minimal interface for Bayesian Network.
gum is the global namespace for all aGrUM entities
void _computeExpectations()
Since the network is binary, expectations can be computed from the final marginals which give us the ...
Abstract class representing CredalNet inference engines.
The class for generic Hash Tables.
void _makeInferenceByRandomOrder()
Starts the inference with this inference type.
const IBayesNet< GUM_SCALAR > * __bnet
A pointer to it's IBayesNet used as a DAG.
void _updateMarginals()
Compute marginals from up-to-date messages.
Class template representing a Credal Network.
InferenceType inferenceType()
Get the inference type.
bool _InferenceUpToDate
TRUE if inference has already been performed, FALSE otherwise.
The base class for all directed edgesThis class is used as a basis for manipulating all directed edge...
CNLoopyPropagation(const CredalNet< GUM_SCALAR > &cnet)
Constructor.
Uses a node-set so we don't iterate on nodes that can't send a new message.
ArcProperty< GUM_SCALAR > _ArcsL_min
"Lower" information coming from one's children.
GUM_SCALAR _calculateEpsilon()
Compute epsilon.
void saveInference(const std::string &path)
void _msgL(const NodeId X, const NodeId demanding_parent)
Sends a message to one's parent, i.e.
void _enum_combi(std::vector< std::vector< std::vector< GUM_SCALAR > > > &msgs_p, const NodeId &id, GUM_SCALAR &msg_l_min, GUM_SCALAR &msg_l_max, std::vector< GUM_SCALAR > &lx, const Idx &pos)
Used by _msgL.
void makeInference()
Starts the inference.
NodeProperty< NodeSet *> _msg_l_sent
Used to keep track of one's messages sent to it's parents.
Abstract class template representing a CredalNet inference engine.
void _refreshLMsPIs(bool refreshIndic=false)
Get the last messages from one's parents and children.
virtual ~CNLoopyPropagation()
Destructor.
Class representing Credal Networks.
NodeProperty< GUM_SCALAR > _NodesL_min
"Lower" node information obtained by combinaison of children messages.
InferenceType
Inference type to be used by the algorithm.
Size Idx
Type for indexes.
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 _updateIndicatrices()
Only update indicatrices variables at the end of computations ( calls _msgP ).
void _msgP(const NodeId X, const NodeId demanding_child)
Sends a message to one's child, i.e.
Chooses a random arc ordering and sends messages accordingly.
NodeSet next_active_nodes_set
The next node-set, i.e.
NodeProperty< GUM_SCALAR > _NodesP_max
"Upper" node information obtained by combinaison of parent's messages.
Size NodeId
Type for node ids.
NodeProperty< bool > _update_l
Used to keep track of which node needs to update it's information coming from it's children...
NodeProperty< GUM_SCALAR > _NodesL_max
"Upper" node information obtained by combinaison of children messages.
void _makeInferenceNodeToNeighbours()
Starts the inference with this inference type.
std::vector< Potential< GUM_SCALAR > *> msg