![]() |
aGrUM
0.16.0
|
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set. More...
#include <agrum/learning/scores_and_tests/idSet.h>
Inherits ALLOC< NodeId >.
Public Member Functions | |
Constructors / Destructors | |
IdSet (const allocator_type &alloc=allocator_type()) | |
default constructor More... | |
IdSet (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... | |
IdSet (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... | |
IdSet (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... | |
IdSet (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... | |
IdSet (const IdSet< ALLOC > &from) | |
copy constructor More... | |
IdSet (const IdSet< ALLOC > &from, const allocator_type &alloc) | |
copy constructor with a given allocator More... | |
IdSet (IdSet< ALLOC > &&from) | |
move constructor More... | |
IdSet (IdSet< ALLOC > &&from, const allocator_type &alloc) | |
move constructor with a given allocator More... | |
virtual IdSet< ALLOC > * | clone () const |
virtual copy constructor More... | |
virtual IdSet< ALLOC > * | clone (const allocator_type &alloc) const |
virtual copy constructor with a given allocator More... | |
virtual | ~IdSet () |
destructor More... | |
Operators | |
IdSet< ALLOC > & | operator= (const IdSet< ALLOC > &from) |
copy operator More... | |
IdSet< ALLOC > & | operator= (IdSet< 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 IdSet< ALLOC > &from) const |
returns true if both sets are equal More... | |
bool | operator!= (const IdSet< 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... | |
IdSet< ALLOC > | conditionalIdSet () 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 IdSet< ALLOC > &set) const |
indicates whether the IdSet contains the IdSet passed in argument More... | |
void | clear () |
removes all the nodes from the IdSet 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 IdSet More... | |
bool | exists (const NodeId id) const |
indicates whether a given id is contained in the IdSet 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 IdSet 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 = IdSetIterator< ALLOC > |
using | const_iterator = IdSetIterator< ALLOC > |
using | iterator_safe = IdSetIterator< ALLOC > |
using | const_iterator_safe = IdSetIterator< ALLOC > |
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set.
IdSets 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. IdSets fix this issue.
using gum::learning::IdSet< ALLOC >::allocator_type = ALLOC< NodeId > |
using gum::learning::IdSet< ALLOC >::const_iterator = IdSetIterator< ALLOC > |
using gum::learning::IdSet< ALLOC >::const_iterator_safe = IdSetIterator< ALLOC > |
using gum::learning::IdSet< ALLOC >::iterator = IdSetIterator< ALLOC > |
using gum::learning::IdSet< ALLOC >::iterator_safe = IdSetIterator< ALLOC > |
gum::learning::IdSet< ALLOC >::IdSet | ( | const allocator_type & | alloc = allocator_type() | ) |
default constructor
gum::learning::IdSet< ALLOC >::IdSet | ( | 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 IdSet |
gum::learning::IdSet< ALLOC >::IdSet | ( | 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 IdSet |
gum::learning::IdSet< ALLOC >::IdSet | ( | 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 IdSet |
gum::learning::IdSet< ALLOC >::IdSet | ( | 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 IdSet |
gum::learning::IdSet< ALLOC >::IdSet | ( | const IdSet< ALLOC > & | from | ) |
copy constructor
gum::learning::IdSet< ALLOC >::IdSet | ( | const IdSet< ALLOC > & | from, |
const allocator_type & | alloc | ||
) |
copy constructor with a given allocator
gum::learning::IdSet< ALLOC >::IdSet | ( | IdSet< ALLOC > && | from | ) |
move constructor
gum::learning::IdSet< ALLOC >::IdSet | ( | IdSet< ALLOC > && | from, |
const allocator_type & | alloc | ||
) |
move constructor with a given allocator
|
virtual |
destructor
iterator gum::learning::IdSet< ALLOC >::begin | ( | ) | const |
Returns an unsafe begin iterator.
iterator_safe gum::learning::IdSet< ALLOC >::beginSafe | ( | ) | const |
Returns a safe begin iterator.
void gum::learning::IdSet< ALLOC >::clear | ( | ) |
removes all the nodes from the IdSet
|
virtual |
virtual copy constructor
|
virtual |
virtual copy constructor with a given allocator
IdSet< ALLOC > gum::learning::IdSet< ALLOC >::conditionalIdSet | ( | ) | const |
returns the idSet at the right hand side of the conditioning bar
bool gum::learning::IdSet< ALLOC >::contains | ( | const IdSet< ALLOC > & | set | ) | const |
bool gum::learning::IdSet< ALLOC >::empty | ( | ) | const |
indicates whether the IdSet contains some nodes or not
const iterator& gum::learning::IdSet< ALLOC >::end | ( | ) | const |
Returns the unsafe end iterator.
const iterator_safe& gum::learning::IdSet< ALLOC >::endSafe | ( | ) | const |
Returns the safe end iterator.
void gum::learning::IdSet< 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::IdSet< ALLOC >::exists | ( | const NodeId | id | ) | const |
indicates whether a given id is contained in the IdSet
allocator_type gum::learning::IdSet< ALLOC >::getAllocator | ( | ) | const |
returns the allocator used
bool gum::learning::IdSet< ALLOC >::hasConditioningSet | ( | ) | const |
indicates whether the idset contains a non-empty conditioning set
const Sequence< NodeId, ALLOC< NodeId > >& gum::learning::IdSet< ALLOC >::ids | ( | ) | const |
returns the set of ids
std::size_t gum::learning::IdSet< ALLOC >::nbLHSIds | ( | ) | const |
returns the number of left hand side ids
std::size_t gum::learning::IdSet< ALLOC >::nbRHSIds | ( | ) | const |
returns the number of right hand side ids
bool gum::learning::IdSet< ALLOC >::operator!= | ( | const IdSet< ALLOC > & | from | ) | const |
returns true if the sets differ
IdSet< ALLOC >& gum::learning::IdSet< ALLOC >::operator= | ( | const IdSet< ALLOC > & | from | ) |
copy operator
IdSet< ALLOC >& gum::learning::IdSet< ALLOC >::operator= | ( | IdSet< ALLOC > && | from | ) |
move operator
bool gum::learning::IdSet< ALLOC >::operator== | ( | const IdSet< ALLOC > & | from | ) | const |
returns true if both sets are equal
NodeId gum::learning::IdSet< ALLOC >::operator[] | ( | const std::size_t | index | ) | const |
returns the node id stored at a given index
std::size_t gum::learning::IdSet< ALLOC >::pos | ( | const NodeId | id | ) | const |
std::size_t gum::learning::IdSet< ALLOC >::size | ( | ) | const |
returns the number of variables (both left and right hand side)
std::string gum::learning::IdSet< ALLOC >::toString | ( | ) | const |
returns the content of the set as a string