![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set. More...
#include <idCondSet.h>
Inherits ALLOC< NodeId >.
Public Member Functions | |
Constructors / Destructors | |
IdCondSet (const allocator_type &alloc=allocator_type()) | |
default constructor More... | |
IdCondSet (const std::vector< NodeId, ALLOC< NodeId > > &ids, const bool rhs_ids, const bool ordered_ids, const allocator_type &alloc=allocator_type()) | |
default constructor with no variable on the left side More... | |
IdCondSet (NodeId var1, const std::vector< NodeId, ALLOC< NodeId > > &rhs_ids, const bool ordered_rhs_ids=false, const allocator_type &alloc=allocator_type()) | |
default constructor with one variable on the left side More... | |
IdCondSet (NodeId var1, NodeId var2, const std::vector< NodeId, ALLOC< NodeId > > &rhs_ids, const bool ordered_lhs_vars, const bool ordered_rhs_ids=false, const allocator_type &alloc=allocator_type()) | |
default constructor with two variables on the left side More... | |
IdCondSet (NodeId var1, NodeId var2, NodeId var3, const std::vector< NodeId, ALLOC< NodeId > > &rhs_ids, const bool ordered_lhs_vars, const bool ordered_rhs_ids=false, const allocator_type &alloc=allocator_type()) | |
default constructor with three variables on the left side More... | |
IdCondSet (const IdCondSet< ALLOC > &from) | |
copy constructor More... | |
IdCondSet (const IdCondSet< ALLOC > &from, const allocator_type &alloc) | |
copy constructor with a given allocator More... | |
IdCondSet (IdCondSet< ALLOC > &&from) | |
move constructor More... | |
IdCondSet (IdCondSet< ALLOC > &&from, const allocator_type &alloc) | |
move constructor with a given allocator More... | |
virtual IdCondSet< ALLOC > * | clone () const |
virtual copy constructor More... | |
virtual IdCondSet< ALLOC > * | clone (const allocator_type &alloc) const |
virtual copy constructor with a given allocator More... | |
virtual | ~IdCondSet () |
destructor More... | |
Operators | |
IdCondSet< ALLOC > & | operator= (const IdCondSet< ALLOC > &from) |
copy operator More... | |
IdCondSet< ALLOC > & | operator= (IdCondSet< ALLOC > &&from) |
move operator More... | |
NodeId | operator[] (const std::size_t index) const |
returns the node id stored at a given index More... | |
bool | operator== (const IdCondSet< ALLOC > &from) const |
returns true if both sets are equal More... | |
bool | operator!= (const IdCondSet< ALLOC > &from) const |
returns true if the sets differ More... | |
Iterators | |
iterator_safe | beginSafe () const |
Returns a safe begin iterator. More... | |
const iterator_safe & | endSafe () const |
Returns the safe end iterator. More... | |
iterator | begin () const |
Returns an unsafe begin iterator. More... | |
const iterator & | end () const |
Returns the unsafe end iterator. More... | |
Accessors / Modifiers | |
const Sequence< NodeId, ALLOC< NodeId > > & | ids () const |
returns the set of ids More... | |
IdCondSet< ALLOC > | conditionalIdCondSet () const |
returns the idSet at the right hand side of the conditioning bar More... | |
std::size_t | nbLHSIds () const |
returns the number of left hand side ids More... | |
std::size_t | nbRHSIds () const |
returns the number of right hand side ids More... | |
bool | contains (const IdCondSet< ALLOC > &set) const |
indicates whether the IdCondSet contains the IdCondSet passed in argument More... | |
void | clear () |
removes all the nodes from the IdCondSet More... | |
std::size_t | size () const |
returns the number of variables (both left and right hand side) More... | |
std::size_t | pos (const NodeId id) const |
returns the position of a given node in the IdCondSet More... | |
bool | exists (const NodeId id) const |
indicates whether a given id is contained in the IdCondSet More... | |
void | erase (const NodeId id) |
erase a node in the idset More... | |
bool | hasConditioningSet () const |
indicates whether the idset contains a non-empty conditioning set More... | |
bool | empty () const |
indicates whether the IdCondSet contains some nodes or not More... | |
std::string | toString () const |
returns the content of the set as a string More... | |
allocator_type | getAllocator () const |
returns the allocator used More... | |
Public Types | |
using | allocator_type = ALLOC< NodeId > |
type for the allocators passed in arguments of methods More... | |
using | iterator = IdCondSetIterator< ALLOC > |
using | const_iterator = IdCondSetIterator< ALLOC > |
using | iterator_safe = IdCondSetIterator< ALLOC > |
using | const_iterator_safe = IdCondSetIterator< ALLOC > |
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set.
IdCondSets are used by learning caches to store pairs of sets of nodes, the second ones represent typically conditional sets. This is useful for storing in hashtables the scores assigned to sets of nodes given other nodes. NodeSets are actually not well suited for this purpose because their implementations makes the computation of their hash values quite difficult. IdCondSets fix this issue.
Definition at line 47 of file idCondSet.h.
using gum::learning::IdCondSet< ALLOC >::allocator_type = ALLOC< NodeId > |
type for the allocators passed in arguments of methods
Definition at line 200 of file idCondSet.h.
using gum::learning::IdCondSet< ALLOC >::const_iterator = IdCondSetIterator< ALLOC > |
Definition at line 203 of file idCondSet.h.
using gum::learning::IdCondSet< ALLOC >::const_iterator_safe = IdCondSetIterator< ALLOC > |
Definition at line 205 of file idCondSet.h.
using gum::learning::IdCondSet< ALLOC >::iterator = IdCondSetIterator< ALLOC > |
Definition at line 202 of file idCondSet.h.
using gum::learning::IdCondSet< ALLOC >::iterator_safe = IdCondSetIterator< ALLOC > |
Definition at line 204 of file idCondSet.h.
gum::learning::IdCondSet< ALLOC >::IdCondSet | ( | const allocator_type & | alloc = allocator_type() | ) |
default constructor
gum::learning::IdCondSet< ALLOC >::IdCondSet | ( | const std::vector< NodeId, ALLOC< NodeId > > & | ids, |
const bool | rhs_ids, | ||
const bool | ordered_ids, | ||
const allocator_type & | alloc = allocator_type() |
||
) |
default constructor with no variable on the left side
ids | the set of variables |
rhs_ids | indicate whether the ids are on the right side of the conditioning bar or not |
ordered_ids | indicates whether the ids in rhs_ids should be considered as an ordered set or an unordered set |
alloc | the allocator used to store the data in the IdCondSet |
gum::learning::IdCondSet< ALLOC >::IdCondSet | ( | NodeId | var1, |
const std::vector< NodeId, ALLOC< NodeId > > & | rhs_ids, | ||
const bool | ordered_rhs_ids = false , |
||
const allocator_type & | alloc = allocator_type() |
||
) |
default constructor with one variable on the left side
var1 | the variable on the left side of the conditioning bar |
rhs_ids | the set of variables on the right side of the conditioning bar |
ordered_rhs_ids | indicates whether the ids in rhs_ids should be considered as an ordered set or an unordered set |
alloc | the allocator used to store the data in the IdCondSet |
gum::learning::IdCondSet< ALLOC >::IdCondSet | ( | NodeId | var1, |
NodeId | var2, | ||
const std::vector< NodeId, ALLOC< NodeId > > & | rhs_ids, | ||
const bool | ordered_lhs_vars, | ||
const bool | ordered_rhs_ids = false , |
||
const allocator_type & | alloc = allocator_type() |
||
) |
default constructor with two variables on the left side
var1 | the 1st variable on the left side of the conditioning bar |
var2 | the 2nd variable on the left side of the conditioning bar |
rhs_ids | the set of variables on the right side of the conditioning bar |
ordered_lhs_vars | a Boolean indicating whether {var1,var2} should be considered as an ordered set or not. Typically, in an independence test, this set is unordered. When set to false, |
ordered_rhs_ids | indicates whether the ids in rhs_ids should be considered as an ordered set or an unordered set |
ordered_rhs_ids | |
alloc | the allocator used to store the data in the IdCondSet |
gum::learning::IdCondSet< ALLOC >::IdCondSet | ( | NodeId | var1, |
NodeId | var2, | ||
NodeId | var3, | ||
const std::vector< NodeId, ALLOC< NodeId > > & | rhs_ids, | ||
const bool | ordered_lhs_vars, | ||
const bool | ordered_rhs_ids = false , |
||
const allocator_type & | alloc = allocator_type() |
||
) |
default constructor with three variables on the left side
var1 | the 1st variable on the left side of the conditioning bar |
var2 | the 2nd variable on the left side of the conditioning bar |
var3 | the 3rd variable on the left side of the conditioning bar |
rhs_ids | the set of variables on the right side of the conditioning bar |
ordered_vars | a Boolean indicating whether {var1,var2,var3} should be considered as an ordered set or not. |
ordered_rhs_ids | indicates whether the ids in rhs_ids should be considered as an ordered set or an unordered set |
alloc | the allocator used to store the data in the IdCondSet |
gum::learning::IdCondSet< ALLOC >::IdCondSet | ( | const IdCondSet< ALLOC > & | from | ) |
copy constructor
gum::learning::IdCondSet< ALLOC >::IdCondSet | ( | const IdCondSet< ALLOC > & | from, |
const allocator_type & | alloc | ||
) |
copy constructor with a given allocator
gum::learning::IdCondSet< ALLOC >::IdCondSet | ( | IdCondSet< ALLOC > && | from | ) |
move constructor
gum::learning::IdCondSet< ALLOC >::IdCondSet | ( | IdCondSet< ALLOC > && | from, |
const allocator_type & | alloc | ||
) |
move constructor with a given allocator
|
virtual |
destructor
iterator gum::learning::IdCondSet< ALLOC >::begin | ( | ) | const |
Returns an unsafe begin iterator.
iterator_safe gum::learning::IdCondSet< ALLOC >::beginSafe | ( | ) | const |
Returns a safe begin iterator.
void gum::learning::IdCondSet< ALLOC >::clear | ( | ) |
removes all the nodes from the IdCondSet
|
virtual |
virtual copy constructor
|
virtual |
virtual copy constructor with a given allocator
IdCondSet< ALLOC > gum::learning::IdCondSet< ALLOC >::conditionalIdCondSet | ( | ) | const |
returns the idSet at the right hand side of the conditioning bar
bool gum::learning::IdCondSet< ALLOC >::contains | ( | const IdCondSet< ALLOC > & | set | ) | const |
bool gum::learning::IdCondSet< ALLOC >::empty | ( | ) | const |
indicates whether the IdCondSet contains some nodes or not
const iterator& gum::learning::IdCondSet< ALLOC >::end | ( | ) | const |
Returns the unsafe end iterator.
const iterator_safe& gum::learning::IdCondSet< ALLOC >::endSafe | ( | ) | const |
Returns the safe end iterator.
void gum::learning::IdCondSet< ALLOC >::erase | ( | const NodeId | id | ) |
erase a node in the idset
If the element cannot be found, the function does nothing. In particular, it throws no exception.
bool gum::learning::IdCondSet< ALLOC >::exists | ( | const NodeId | id | ) | const |
indicates whether a given id is contained in the IdCondSet
allocator_type gum::learning::IdCondSet< ALLOC >::getAllocator | ( | ) | const |
returns the allocator used
bool gum::learning::IdCondSet< ALLOC >::hasConditioningSet | ( | ) | const |
indicates whether the idset contains a non-empty conditioning set
const Sequence< NodeId, ALLOC< NodeId > >& gum::learning::IdCondSet< ALLOC >::ids | ( | ) | const |
returns the set of ids
std::size_t gum::learning::IdCondSet< ALLOC >::nbLHSIds | ( | ) | const |
returns the number of left hand side ids
std::size_t gum::learning::IdCondSet< ALLOC >::nbRHSIds | ( | ) | const |
returns the number of right hand side ids
bool gum::learning::IdCondSet< ALLOC >::operator!= | ( | const IdCondSet< ALLOC > & | from | ) | const |
returns true if the sets differ
IdCondSet< ALLOC >& gum::learning::IdCondSet< ALLOC >::operator= | ( | const IdCondSet< ALLOC > & | from | ) |
copy operator
IdCondSet< ALLOC >& gum::learning::IdCondSet< ALLOC >::operator= | ( | IdCondSet< ALLOC > && | from | ) |
move operator
bool gum::learning::IdCondSet< ALLOC >::operator== | ( | const IdCondSet< ALLOC > & | from | ) | const |
returns true if both sets are equal
NodeId gum::learning::IdCondSet< ALLOC >::operator[] | ( | const std::size_t | index | ) | const |
returns the node id stored at a given index
std::size_t gum::learning::IdCondSet< ALLOC >::pos | ( | const NodeId | id | ) | const |
std::size_t gum::learning::IdCondSet< ALLOC >::size | ( | ) | const |
returns the number of variables (both left and right hand side)
std::string gum::learning::IdCondSet< ALLOC >::toString | ( | ) | const |
returns the content of the set as a string