aGrUM  0.13.2
CNMonteCarloSampling.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN and Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
28 #ifndef __CN_MC_SAMPLING__H__
29 #define __CN_MC_SAMPLING__H__
30 
32 #include <limits>
33 
35 
36 namespace gum {
37  namespace credal {
38 
58  template < typename GUM_SCALAR,
59  class BNInferenceEngine = LazyPropagation< GUM_SCALAR > >
61  : public MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine > {
62  private:
67 
70 
73  void __mcThreadDataCopy();
75 
78 
79  inline void __verticesSampling();
80 
82  inline void __insertEvidence();
83 
86  inline void __threadInference();
87 
89  inline void __threadUpdate();
90 
98  inline void __binaryRep(std::vector< bool >& toFill, const Idx value) const;
99 
101 
102  protected:
103  public:
106 
112  virtual ~CNMonteCarloSampling();
114 
117 
119  void makeInference();
120 
122 
124 
125  virtual void insertEvidenceFile(const std::string& path) {
127  };
128 
129  protected:
130  bool _repetitiveInd;
131  };
132 
133 
135  extern template class CNMonteCarloSampling< double,
137 
138 
139  } // namespace credal
140 } // namespace gum
141 
143 
144 #endif
void __mcThreadDataCopy()
Initialize threads data.
Abstract class representing CredalNet inference engines.
void __insertEvidence()
Insert CredalNet evidence into a thread BNInferenceEngine.
virtual void insertEvidenceFile(const std::string &path)
Insert evidence from file.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
void __threadInference()
Thread performs an inference using BNInferenceEngine.
CNMonteCarloSampling(const CredalNet< GUM_SCALAR > &credalNet)
Constructor.
Class template representing a Credal Network.
Definition: credalNet.h:87
void __threadUpdate()
Update thread data after a IBayesNet inference.
void makeInference()
Starts the inference.
void __mcInitApproximationScheme()
Initialize approximation Scheme.
void __verticesSampling()
Thread samples a IBayesNet from the CredalNet.
<agrum/CN/CNMonteCarloSampling.h>
const CredalNet< GUM_SCALAR > & credalNet()
Get this creadal network.
void __binaryRep(std::vector< bool > &toFill, const Idx value) const
Get the binary representation of a given value.
<agrum/BN/inference/lazyPropagation.h>
virtual void insertEvidenceFile(const std::string &path)
unsigned int notOptDelete;
Class template representing a CredalNet inference engine using one or more IBayesNet inference engine...
Implementation of a Shafer-Shenoy&#39;s-like version of lazy propagation for inference in Bayesian Networ...
unsigned long Idx
Type for indexes.
Definition: types.h:43