30 #ifndef __CN_LOOPY_PROPAGATION__H__ 31 #define __CN_LOOPY_PROPAGATION__H__ 43 #define _INF std::numeric_limits< GUM_SCALAR >::infinity() 57 template <
typename GUM_SCALAR >
60 using msg = std::vector< Potential< GUM_SCALAR >* >;
173 const NodeId demanding_parent);
196 GUM_SCALAR& msg_l_max,
197 std::vector< GUM_SCALAR >& lx,
201 GUM_SCALAR& den_max);
220 void _compute_ext(std::vector< std::vector< GUM_SCALAR > >& combi_msg_p,
222 GUM_SCALAR& msg_l_min,
223 GUM_SCALAR& msg_l_max,
224 std::vector< GUM_SCALAR >& lx,
244 std::vector< std::vector< std::vector< GUM_SCALAR > > >& msgs_p,
246 GUM_SCALAR& msg_l_min,
247 GUM_SCALAR& msg_l_max,
248 std::vector< GUM_SCALAR >& lx,
273 std::vector< std::vector< std::vector< GUM_SCALAR > > >& msgs_p,
275 GUM_SCALAR& msg_p_min,
276 GUM_SCALAR& msg_p_max);
289 void _compute_ext(std::vector< std::vector< GUM_SCALAR > >& combi_msg_p,
291 GUM_SCALAR& msg_p_min,
292 GUM_SCALAR& msg_p_max);
388 #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...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
NodeProperty< GUM_SCALAR > _NodesP_min
"Lower" node information obtained by combinaison of parent's messages.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void _computeExpectations()
Since the network is binary, expectations can be computed from the final marginals which give us the ...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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