aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::learning::IdCondSet Class Reference

A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set. More...

#include <idCondSet.h>

Public Types

using iterator = IdCondSetIterator
using const_iterator = IdCondSetIterator
using iterator_safe = IdCondSetIterator
using const_iterator_safe = IdCondSetIterator

Public Member Functions

Constructors / Destructors
 IdCondSet ()
 default constructor
 IdCondSet (const std::vector< NodeId > &ids, const bool rhs_ids, const bool ordered_ids)
 default constructor with no variable on the left side
 IdCondSet (NodeId var1, const std::vector< NodeId > &rhs_ids, const bool ordered_rhs_ids=false)
 default constructor with one variable on the left side
 IdCondSet (NodeId var1, NodeId var2, const std::vector< NodeId > &rhs_ids, const bool ordered_lhs_vars, const bool ordered_rhs_ids=false)
 default constructor with two variables on the left side
 IdCondSet (NodeId var1, NodeId var2, NodeId var3, const std::vector< NodeId > &rhs_ids, const bool ordered_lhs_vars, const bool ordered_rhs_ids=false)
 default constructor with three variables on the left side
 IdCondSet (const IdCondSet &from)
 copy constructor
 IdCondSet (IdCondSet &&from)
 move constructor
virtual IdCondSetclone () const
 virtual copy constructor
virtual ~IdCondSet ()
 destructor
Operators
IdCondSetoperator= (const IdCondSet &from)
 copy operator
IdCondSetoperator= (IdCondSet &&from)
 move operator
NodeId operator[] (const std::size_t index) const
 returns the node id stored at a given index
bool operator== (const IdCondSet &from) const
 returns true if both sets are equal
bool operator!= (const IdCondSet &from) const
 returns true if the sets differ
Iterators
iterator_safe beginSafe () const
 Returns a safe begin iterator.
const iterator_safeendSafe () const
 Returns the safe end iterator.
iterator begin () const
 Returns an unsafe begin iterator.
const iteratorend () const
 Returns the unsafe end iterator.
Accessors / Modifiers
const Sequence< NodeId > & ids () const
 returns the set of ids
IdCondSet conditionalIdCondSet () const
 returns the idSet at the right hand side of the conditioning bar
std::size_t nbLHSIds () const
 returns the number of left hand side ids
std::size_t nbRHSIds () const
 returns the number of right hand side ids
bool contains (const IdCondSet &set) const
 indicates whether the IdCondSet contains the IdCondSet passed in argument
void clear ()
 removes all the nodes from the IdCondSet
std::size_t size () const
 returns the number of variables (both left and right hand side)
std::size_t pos (const NodeId id) const
 returns the position of a given node in the IdCondSet
bool exists (const NodeId id) const
 indicates whether a given id is contained in the IdCondSet
void erase (const NodeId id)
 erase a node in the idset
bool hasConditioningSet () const
 indicates whether the idset contains a non-empty conditioning set
bool empty () const
 indicates whether the IdCondSet contains some nodes or not
std::string toString () const
 returns the content of the set as a string
std::pair< NodeSet, NodeSettoNodeSets () const
 returns the pair of conditioned gum::NodeSet and conditioning gum::NodeSet

Detailed Description

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 214 of file idCondSet.h.

Member Typedef Documentation

◆ const_iterator

◆ const_iterator_safe

◆ iterator

◆ iterator_safe

Constructor & Destructor Documentation

◆ IdCondSet() [1/7]

gum::learning::IdCondSet::IdCondSet ( )

default constructor

Referenced by IdCondSet(), IdCondSet(), clone(), conditionalIdCondSet(), contains(), operator!=(), operator=(), operator=(), and operator==().

Here is the caller graph for this function:

◆ IdCondSet() [2/7]

gum::learning::IdCondSet::IdCondSet ( const std::vector< NodeId > & ids,
const bool rhs_ids,
const bool ordered_ids )

default constructor with no variable on the left side

Parameters
idsthe set of variables
rhs_idsindicate whether the ids are on the right side of the conditioning bar or not
ordered_idsindicates whether the ids in rhs_ids should be considered as an ordered set or an unordered set

References ids().

Here is the call graph for this function:

◆ IdCondSet() [3/7]

gum::learning::IdCondSet::IdCondSet ( NodeId var1,
const std::vector< NodeId > & rhs_ids,
const bool ordered_rhs_ids = false )

default constructor with one variable on the left side

Parameters
var1the variable on the left side of the conditioning bar
rhs_idsthe set of variables on the right side of the conditioning bar
ordered_rhs_idsindicates whether the ids in rhs_ids should be considered as an ordered set or an unordered set

◆ IdCondSet() [4/7]

gum::learning::IdCondSet::IdCondSet ( NodeId var1,
NodeId var2,
const std::vector< NodeId > & rhs_ids,
const bool ordered_lhs_vars,
const bool ordered_rhs_ids = false )

default constructor with two variables on the left side

Parameters
var1the 1st variable on the left side of the conditioning bar
var2the 2nd variable on the left side of the conditioning bar
rhs_idsthe set of variables on the right side of the conditioning bar
ordered_lhs_varsa 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_idsindicates whether the ids in rhs_ids should be considered as an ordered set or an unordered set
ordered_rhs_ids

◆ IdCondSet() [5/7]

gum::learning::IdCondSet::IdCondSet ( NodeId var1,
NodeId var2,
NodeId var3,
const std::vector< NodeId > & rhs_ids,
const bool ordered_lhs_vars,
const bool ordered_rhs_ids = false )

default constructor with three variables on the left side

Parameters
var1the 1st variable on the left side of the conditioning bar
var2the 2nd variable on the left side of the conditioning bar
var3the 3rd variable on the left side of the conditioning bar
rhs_idsthe set of variables on the right side of the conditioning bar
ordered_varsa Boolean indicating whether {var1,var2,var3} should be considered as an ordered set or not.
ordered_rhs_idsindicates whether the ids in rhs_ids should be considered as an ordered set or an unordered set

◆ IdCondSet() [6/7]

gum::learning::IdCondSet::IdCondSet ( const IdCondSet & from)

copy constructor

References IdCondSet().

Here is the call graph for this function:

◆ IdCondSet() [7/7]

gum::learning::IdCondSet::IdCondSet ( IdCondSet && from)

move constructor

References IdCondSet().

Here is the call graph for this function:

◆ ~IdCondSet()

virtual gum::learning::IdCondSet::~IdCondSet ( )
virtual

destructor

Member Function Documentation

◆ begin()

iterator gum::learning::IdCondSet::begin ( ) const

Returns an unsafe begin iterator.

Returns
Returns an unsafe begin iterator.

◆ beginSafe()

iterator_safe gum::learning::IdCondSet::beginSafe ( ) const

Returns a safe begin iterator.

Returns
Returns a safe begin iterator.

◆ clear()

void gum::learning::IdCondSet::clear ( )

removes all the nodes from the IdCondSet

◆ clone()

virtual IdCondSet * gum::learning::IdCondSet::clone ( ) const
virtual

virtual copy constructor

References IdCondSet().

Here is the call graph for this function:

◆ conditionalIdCondSet()

IdCondSet gum::learning::IdCondSet::conditionalIdCondSet ( ) const

returns the idSet at the right hand side of the conditioning bar

References IdCondSet().

Here is the call graph for this function:

◆ contains()

bool gum::learning::IdCondSet::contains ( const IdCondSet & set) const

indicates whether the IdCondSet contains the IdCondSet passed in argument

References IdCondSet().

Here is the call graph for this function:

◆ empty()

bool gum::learning::IdCondSet::empty ( ) const

indicates whether the IdCondSet contains some nodes or not

◆ end()

const iterator & gum::learning::IdCondSet::end ( ) const

Returns the unsafe end iterator.

Returns
Returns the unsafe end iterator.

◆ endSafe()

const iterator_safe & gum::learning::IdCondSet::endSafe ( ) const

Returns the safe end iterator.

Returns
Returns the safe end iterator.

◆ erase()

void gum::learning::IdCondSet::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.

◆ exists()

bool gum::learning::IdCondSet::exists ( const NodeId id) const

indicates whether a given id is contained in the IdCondSet

◆ hasConditioningSet()

bool gum::learning::IdCondSet::hasConditioningSet ( ) const

indicates whether the idset contains a non-empty conditioning set

◆ ids()

const Sequence< NodeId > & gum::learning::IdCondSet::ids ( ) const

returns the set of ids

Referenced by IdCondSet().

Here is the caller graph for this function:

◆ nbLHSIds()

std::size_t gum::learning::IdCondSet::nbLHSIds ( ) const

returns the number of left hand side ids

◆ nbRHSIds()

std::size_t gum::learning::IdCondSet::nbRHSIds ( ) const

returns the number of right hand side ids

◆ operator!=()

bool gum::learning::IdCondSet::operator!= ( const IdCondSet & from) const

returns true if the sets differ

References IdCondSet().

Here is the call graph for this function:

◆ operator=() [1/2]

IdCondSet & gum::learning::IdCondSet::operator= ( const IdCondSet & from)

copy operator

References IdCondSet().

Here is the call graph for this function:

◆ operator=() [2/2]

IdCondSet & gum::learning::IdCondSet::operator= ( IdCondSet && from)

move operator

References IdCondSet().

Here is the call graph for this function:

◆ operator==()

bool gum::learning::IdCondSet::operator== ( const IdCondSet & from) const

returns true if both sets are equal

References IdCondSet().

Here is the call graph for this function:

◆ operator[]()

NodeId gum::learning::IdCondSet::operator[] ( const std::size_t index) const

returns the node id stored at a given index

◆ pos()

std::size_t gum::learning::IdCondSet::pos ( const NodeId id) const

returns the position of a given node in the IdCondSet

Exceptions
NotFoundRaised if the element does not exist.

◆ size()

std::size_t gum::learning::IdCondSet::size ( ) const

returns the number of variables (both left and right hand side)

◆ toNodeSets()

std::pair< NodeSet, NodeSet > gum::learning::IdCondSet::toNodeSets ( ) const

returns the pair of conditioned gum::NodeSet and conditioning gum::NodeSet

◆ toString()

std::string gum::learning::IdCondSet::toString ( ) const

returns the content of the set as a string


The documentation for this class was generated from the following file: