![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Class used to store optimum IBayesNet during some inference algorithms. More...
#include <agrum/CN/varMod2BNsMap.h>
Public Member Functions | |
| bool | insert (const std::vector< bool > &bn, const std::vector< Size > &key) |
| Insert for thread fusion. | |
| bool | insert (const std::vector< Size > &key, const bool isBetter) |
| Thread insert. | |
Constructors / Destructors | |
| VarMod2BNsMap (const CredalNet< GUM_SCALAR > &cn) | |
| Thread constructor. | |
| VarMod2BNsMap () | |
| Default constructor that should be used only by InferenceEngine since it has a member variable. | |
| ~VarMod2BNsMap () | |
| Destructor. | |
Getters and setters | |
| void | setCNet (const CredalNet< GUM_SCALAR > &cn) |
| Initialize sampleDef from the CredalNet. | |
| void | setCurrentSample (const std::vector< std::vector< std::vector< bool > > > &sample) |
| Set the current thread sample and it's hash. | |
| const dBN & | getCurrentSample () |
| Get the current sample as a vector of bits without structure. | |
| const std::vector< std::vector< std::vector< bool > > > & | getSampleDef () |
| Get the sample structure. | |
| const std::vector< dBN * > | getBNOptsFromKey (const std::vector< Size > &key) |
| Get optimum IBayesNet (s) without structure of the given variable, modality for min or max. | |
| std::vector< std::vector< std::vector< std::vector< bool > > > > | getFullBNOptsFromKey (const std::vector< Size > &key) |
| Get optimum IBayesNet (s) with structure of the given variable, modality for min or max. | |
| Size | getEntrySize () const |
| Get the number of IBayesNet stored. | |
Protected Attributes | |
| hashNet | myHashNet_ |
| Map id - dBN : get a net from it's id. | |
| varHashs | myVarHashs_ |
| Map varKey - list(id) : get all optimal nets id from the given key : variable, modality and min=0 ( or max=1 ). | |
| hashVars | myHashVars_ |
| Map id - list(varKey) : get all variables, modalities associated to this optimal net id. | |
| std::vector< std::vector< std::vector< bool > > > | sampleDef_ |
| Since all samples have the same structure, this will be used as default initialization (copy constructor) for any sample. | |
| dBN | currentSample_ |
| The current sampled IBayesNet. | |
| Size | currentHash_ |
| The current sampled IBayesNet hash. | |
| std::hash< std::vector< bool > > | vectHash_ |
| The hash fuction. | |
| const CredalNet< GUM_SCALAR > * | cnet |
| A pointer to the CredalNet to be used. | |
Private Types | |
| using | dBN = std::vector< bool > |
| using | varKey = std::vector< Size > |
| using | hashNet = gum::HashTable< Size, dBN > |
| using | varHashs = gum::HashTable< varKey, std::list< Size > > |
| using | hashVars = gum::HashTable< Size, std::list< varKey > > |
Class used to store optimum IBayesNet during some inference algorithms.
| GUM_SCALAR | A floating type ( float, double, long double ... ). |
Definition at line 73 of file varMod2BNsMap.h.
|
private |
Definition at line 74 of file varMod2BNsMap.h.
|
private |
Definition at line 76 of file varMod2BNsMap.h.
|
private |
Definition at line 78 of file varMod2BNsMap.h.
|
private |
Definition at line 77 of file varMod2BNsMap.h.
|
private |
Definition at line 75 of file varMod2BNsMap.h.
|
explicit |
Thread constructor.
Initialize sampleDef from the CredalNet.
| cn | The CredalNet to be used. |
Definition at line 56 of file varMod2BNsMap_tpl.h.
References VarMod2BNsMap(), and setCNet().
Referenced by VarMod2BNsMap(), VarMod2BNsMap(), and ~VarMod2BNsMap().
| gum::credal::VarMod2BNsMap< GUM_SCALAR >::VarMod2BNsMap | ( | ) |
Default constructor that should be used only by InferenceEngine since it has a member variable.
Definition at line 49 of file varMod2BNsMap_tpl.h.
References VarMod2BNsMap(), and cnet.
| gum::credal::VarMod2BNsMap< GUM_SCALAR >::~VarMod2BNsMap | ( | ) |
Destructor.
Definition at line 63 of file varMod2BNsMap_tpl.h.
References VarMod2BNsMap().
| const std::vector< std::vector< bool > * > gum::credal::VarMod2BNsMap< GUM_SCALAR >::getBNOptsFromKey | ( | const std::vector< Size > & | key | ) |
Get optimum IBayesNet (s) without structure of the given variable, modality for min or max.
| key | The constant reference to the variable, modality, min or max. |
Definition at line 208 of file varMod2BNsMap_tpl.h.
References myHashNet_, and myVarHashs_.
| const std::vector< bool > & gum::credal::VarMod2BNsMap< GUM_SCALAR >::getCurrentSample | ( | ) |
Get the current sample as a vector of bits without structure.
Definition at line 196 of file varMod2BNsMap_tpl.h.
References currentSample_.
| Size gum::credal::VarMod2BNsMap< GUM_SCALAR >::getEntrySize | ( | ) | const |
Get the number of IBayesNet stored.
Definition at line 261 of file varMod2BNsMap_tpl.h.
References myHashNet_.
| std::vector< std::vector< std::vector< std::vector< bool > > > > gum::credal::VarMod2BNsMap< GUM_SCALAR >::getFullBNOptsFromKey | ( | const std::vector< Size > & | key | ) |
Get optimum IBayesNet (s) with structure of the given variable, modality for min or max.
| key | The constant reference to the variable, modality, min or max. |
Definition at line 228 of file varMod2BNsMap_tpl.h.
References cnet, GUM_ERROR, myHashNet_, myVarHashs_, and sampleDef_.
| const std::vector< std::vector< std::vector< bool > > > & gum::credal::VarMod2BNsMap< GUM_SCALAR >::getSampleDef | ( | ) |
Get the sample structure.
Definition at line 202 of file varMod2BNsMap_tpl.h.
References sampleDef_.
| bool gum::credal::VarMod2BNsMap< GUM_SCALAR >::insert | ( | const std::vector< bool > & | bn, |
| const std::vector< Size > & | key ) |
Insert for thread fusion.
All inserted nets are optimums and none will be deleted because a better one is being inserted.
| bn | The constant reference to the net to be inserted. |
| key | The constant reference to the key at which we will insert the net. |
Definition at line 90 of file varMod2BNsMap_tpl.h.
References currentHash_, myHashNet_, myHashVars_, myVarHashs_, and vectHash_.
| bool gum::credal::VarMod2BNsMap< GUM_SCALAR >::insert | ( | const std::vector< Size > & | key, |
| const bool | isBetter ) |
Thread insert.
| key | The key at which the net will be inserted. |
| isBetter | True if the net is a better one, i.e. it gave better marginals. |
True if the net was inserted, false otherwise. Definition at line 110 of file varMod2BNsMap_tpl.h.
References currentHash_, currentSample_, myHashNet_, myHashVars_, and myVarHashs_.
| void gum::credal::VarMod2BNsMap< GUM_SCALAR >::setCNet | ( | const CredalNet< GUM_SCALAR > & | cn | ) |
Initialize sampleDef from the CredalNet.
Shoud only be used by InferenceEngine to initialize it's member variable.
| cn | The CredalNet to be used. |
Definition at line 68 of file varMod2BNsMap_tpl.h.
References cnet, gum::credal::CredalNet< GUM_SCALAR >::credalNet_currentCpt(), sampleDef_, and gum::superiorPow().
Referenced by VarMod2BNsMap().
| void gum::credal::VarMod2BNsMap< GUM_SCALAR >::setCurrentSample | ( | const std::vector< std::vector< std::vector< bool > > > & | sample | ) |
Set the current thread sample and it's hash.
| sample | The constant reference to the sample with structure. |
Definition at line 180 of file varMod2BNsMap_tpl.h.
References currentHash_, currentSample_, and vectHash_.
|
protected |
A pointer to the CredalNet to be used.
Definition at line 104 of file varMod2BNsMap.h.
Referenced by VarMod2BNsMap(), getFullBNOptsFromKey(), and setCNet().
|
protected |
The current sampled IBayesNet hash.
Definition at line 99 of file varMod2BNsMap.h.
Referenced by insert(), insert(), and setCurrentSample().
|
protected |
The current sampled IBayesNet.
Definition at line 97 of file varMod2BNsMap.h.
Referenced by getCurrentSample(), insert(), and setCurrentSample().
|
protected |
Map id - dBN : get a net from it's id.
Definition at line 82 of file varMod2BNsMap.h.
Referenced by getBNOptsFromKey(), getEntrySize(), getFullBNOptsFromKey(), insert(), and insert().
|
protected |
Map id - list(varKey) : get all variables, modalities associated to this optimal net id.
Definition at line 89 of file varMod2BNsMap.h.
|
protected |
Map varKey - list(id) : get all optimal nets id from the given key : variable, modality and min=0 ( or max=1 ).
Definition at line 85 of file varMod2BNsMap.h.
Referenced by getBNOptsFromKey(), getFullBNOptsFromKey(), insert(), and insert().
|
protected |
Since all samples have the same structure, this will be used as default initialization (copy constructor) for any sample.
Definition at line 94 of file varMod2BNsMap.h.
Referenced by getFullBNOptsFromKey(), getSampleDef(), and setCNet().
|
protected |
The hash fuction.
Requires c++11/0x.
Definition at line 101 of file varMod2BNsMap.h.
Referenced by insert(), and setCurrentSample().