![]() |
aGrUM
0.20.3
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. More... | |
bool | insert (const std::vector< Size > &key, const bool isBetter) |
Thread insert. More... | |
Constructors / Destructors | |
VarMod2BNsMap (const CredalNet< GUM_SCALAR > &cn) | |
Thread constructor. More... | |
VarMod2BNsMap () | |
Default constructor that should be used only by InferenceEngine since it has a member variable. More... | |
~VarMod2BNsMap () | |
Destructor. More... | |
Getters and setters | |
void | setCNet (const CredalNet< GUM_SCALAR > &cn) |
Initialize sampleDef from the CredalNet. More... | |
void | setCurrentSample (const std::vector< std::vector< std::vector< bool > > > &sample) |
Set the current thread sample and it's hash. More... | |
const dBN & | getCurrentSample () |
Get the current sample as a vector of bits without structure. More... | |
const std::vector< std::vector< std::vector< bool > > > & | getSampleDef () |
Get the sample structure. More... | |
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. More... | |
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. More... | |
Size | getEntrySize () const |
Get the number of IBayesNet stored. More... | |
Protected Attributes | |
hashNet | myHashNet_ |
Map id - dBN : get a net from it's id. More... | |
varHashs | myVarHashs_ |
Map varKey - list(id) : get all optimal nets id from the given key : variable, modality and min=0 ( or max=1 ). More... | |
hashVars | myHashVars_ |
Map id - list(varKey) : get all variables, modalities associated to this optimal net id. More... | |
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. More... | |
dBN | currentSample_ |
The current sampled IBayesNet. More... | |
Size | currentHash_ |
The current sampled IBayesNet hash. More... | |
std::hash< std::vector< bool > > | vectHash_ |
The hash fuction. More... | |
const CredalNet< GUM_SCALAR > * | cnet |
A pointer to the CredalNet to be used. More... | |
Class used to store optimum IBayesNet during some inference algorithms.
GUM_SCALAR | A floating type ( float, double, long double ... ). |
Definition at line 55 of file varMod2BNsMap.h.
|
private |
Definition at line 57 of file varMod2BNsMap.h.
|
private |
Definition at line 61 of file varMod2BNsMap.h.
|
private |
Definition at line 65 of file varMod2BNsMap.h.
|
private |
Definition at line 63 of file varMod2BNsMap.h.
|
private |
Definition at line 59 of file varMod2BNsMap.h.
|
explicit |
Thread constructor.
Initialize sampleDef from the CredalNet.
cn | The CredalNet to be used. |
Definition at line 35 of file varMod2BNsMap_tpl.h.
gum::credal::VarMod2BNsMap< GUM_SCALAR >::VarMod2BNsMap | ( | ) |
Default constructor that should be used only by InferenceEngine since it has a member variable.
Definition at line 28 of file varMod2BNsMap_tpl.h.
gum::credal::VarMod2BNsMap< GUM_SCALAR >::~VarMod2BNsMap | ( | ) |
Destructor.
Definition at line 42 of file varMod2BNsMap_tpl.h.
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 187 of file varMod2BNsMap_tpl.h.
const std::vector< bool > & gum::credal::VarMod2BNsMap< GUM_SCALAR >::getCurrentSample | ( | ) |
Get the current sample as a vector of bits without structure.
Definition at line 175 of file varMod2BNsMap_tpl.h.
Size gum::credal::VarMod2BNsMap< GUM_SCALAR >::getEntrySize | ( | ) | const |
Get the number of IBayesNet stored.
Definition at line 240 of file varMod2BNsMap_tpl.h.
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 207 of file varMod2BNsMap_tpl.h.
const std::vector< std::vector< std::vector< bool > > > & gum::credal::VarMod2BNsMap< GUM_SCALAR >::getSampleDef | ( | ) |
Get the sample structure.
Definition at line 181 of file varMod2BNsMap_tpl.h.
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 69 of file varMod2BNsMap_tpl.h.
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 89 of file varMod2BNsMap_tpl.h.
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 47 of file varMod2BNsMap_tpl.h.
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 159 of file varMod2BNsMap_tpl.h.
|
protected |
A pointer to the CredalNet to be used.
Definition at line 91 of file varMod2BNsMap.h.
|
protected |
The current sampled IBayesNet hash.
Definition at line 86 of file varMod2BNsMap.h.
|
protected |
The current sampled IBayesNet.
Definition at line 84 of file varMod2BNsMap.h.
|
protected |
Map id - dBN : get a net from it's id.
Definition at line 69 of file varMod2BNsMap.h.
|
protected |
Map id - list(varKey) : get all variables, modalities associated to this optimal net id.
Definition at line 76 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 72 of file varMod2BNsMap.h.
|
protected |
Since all samples have the same structure, this will be used as default initialization (copy constructor) for any sample.
Definition at line 81 of file varMod2BNsMap.h.
|
protected |