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

#include <agrum/FMDP/learning/observation.h>

Collaboration diagram for gum::Observation:

Public Member Functions

std::string toString () const
Constructor & destructor.
 Observation ()
 Default constructor.
 ~Observation ()
 Default destructor.
void * operator new (size_t s)
 Allocators and Deallocators redefinition.
void operator delete (void *p)
 Default constructor.
Observation Handlers
INLINE Idx modality (const DiscreteVariable *var) const
 Returns the modality assumed by the given variable in this observation.
INLINE Idx rModality (const DiscreteVariable *var) const
 Returns the modality assumed by the given variable in this observation.
INLINE void setModality (const DiscreteVariable *var, Idx modality)
 Sets the modality assumed by the given variable in this observation.
INLINE void setRModality (const DiscreteVariable *var, Idx modality)
 Returns the modality assumed by the given variable in this observation.
double reward () const
 Returns the modality assumed by the given variable in this observation.
void setReward (double reward)
 Returns the modality assumed by the given variable in this observation.
Iterators on Variables
HashTableConstIteratorSafe< const DiscreteVariable *, IdxcbeginVariablesSafe () const
 Returns an const safe iterator on the beginning of the list of variables in this observation.
HashTableConstIteratorSafe< const DiscreteVariable *, IdxcendVariablesSafe () const
 Returns an const safe iterator on the end of the list of variables in this observation.

Private Attributes

HashTable< const DiscreteVariable *, Idx_varInst_
 Table giving for every variables its instantiation.
HashTable< const DiscreteVariable *, Idx_rInst_
double _reward_
 The reward associated to this transition.

Detailed Description

Definition at line 73 of file observation.h.

Constructor & Destructor Documentation

◆ Observation()

gum::Observation::Observation ( )
inline

Default constructor.

Definition at line 83 of file observation.h.

83 {
84 GUM_CONSTRUCTOR(Observation);
85 ;
86 }
Observation()
Default constructor.
Definition observation.h:83

References Observation().

Referenced by Observation(), ~Observation(), and operator delete().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~Observation()

gum::Observation::~Observation ( )
inline

Default destructor.

Definition at line 91 of file observation.h.

91 {
92 GUM_DESTRUCTOR(Observation);
93 ;
94 }

References Observation().

Here is the call graph for this function:

Member Function Documentation

◆ cbeginVariablesSafe()

HashTableConstIteratorSafe< const DiscreteVariable *, Idx > gum::Observation::cbeginVariablesSafe ( ) const
inline

Returns an const safe iterator on the beginning of the list of variables in this observation.

Definition at line 162 of file observation.h.

162 {
163 return _varInst_.cbeginSafe();
164 }
HashTable< const DiscreteVariable *, Idx > _varInst_
Table giving for every variables its instantiation.

References _varInst_.

◆ cendVariablesSafe()

HashTableConstIteratorSafe< const DiscreteVariable *, Idx > gum::Observation::cendVariablesSafe ( ) const
inline

Returns an const safe iterator on the end of the list of variables in this observation.

Definition at line 170 of file observation.h.

170 {
171 return _varInst_.cendSafe();
172 }

References _varInst_.

◆ modality()

INLINE Idx gum::Observation::modality ( const DiscreteVariable * var) const
inline

Returns the modality assumed by the given variable in this observation.

Exceptions
NotFoundif variable is not in this observation

Definition at line 119 of file observation.h.

119{ return _varInst_[var]; }

References _varInst_.

Referenced by gum::NodeDatabase< AttributeSelection, isScalar >::_addObservation_(), gum::IncrementalGraphLearner< AttributeSelection, isScalar >::_assumeValue_(), gum::IncrementalGraphLearner< AttributeSelection, isScalar >::_branchObs_(), setModality(), and setRModality().

Here is the caller graph for this function:

◆ operator delete()

void gum::Observation::operator delete ( void * p)
inline

Default constructor.

Definition at line 101 of file observation.h.

101 {
103 }
static SmallObjectAllocator & instance()
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.

References Observation(), gum::SmallObjectAllocator::deallocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ operator new()

void * gum::Observation::operator new ( size_t s)
inline

Allocators and Deallocators redefinition.

Definition at line 99 of file observation.h.

void * allocate(const size_t &objectSize)
Allocates a block.

References gum::SmallObjectAllocator::allocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ reward()

double gum::Observation::reward ( ) const
inline

Returns the modality assumed by the given variable in this observation.

Exceptions
NotFoundif variable is not in this observation

Definition at line 142 of file observation.h.

142{ return _reward_; }
double _reward_
The reward associated to this transition.

References _reward_.

Referenced by gum::NodeDatabase< AttributeSelection, isScalar >::_addObservation_(), gum::IncrementalGraphLearner< AttributeSelection, isScalar >::_assumeValue_(), gum::FMDPLearner< VariableAttributeSelection, RewardAttributeSelection, LearnerSelection >::addObservation(), and setReward().

Here is the caller graph for this function:

◆ rModality()

INLINE Idx gum::Observation::rModality ( const DiscreteVariable * var) const
inline

Returns the modality assumed by the given variable in this observation.

Exceptions
NotFoundif variable is not in this observation

Definition at line 121 of file observation.h.

121{ return _rInst_[var]; }
HashTable< const DiscreteVariable *, Idx > _rInst_

References _rInst_.

Referenced by gum::NodeDatabase< AttributeSelection, isScalar >::_addObservation_(), and gum::IncrementalGraphLearner< AttributeSelection, isScalar >::_branchObs_().

Here is the caller graph for this function:

◆ setModality()

INLINE void gum::Observation::setModality ( const DiscreteVariable * var,
Idx modality )
inline

Sets the modality assumed by the given variable in this observation.

Exceptions
DuplicateElementif a value has already be assigned to this variable

Definition at line 131 of file observation.h.

131 {
132 _varInst_.insert(var, modality);
133 }
INLINE Idx modality(const DiscreteVariable *var) const
Returns the modality assumed by the given variable in this observation.

References _varInst_, and modality().

Referenced by gum::SDYNA::feedback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setReward()

void gum::Observation::setReward ( double reward)
inline

Returns the modality assumed by the given variable in this observation.

Exceptions
NotFoundif variable is not in this observation

Definition at line 147 of file observation.h.

147{ _reward_ = reward; }
double reward() const
Returns the modality assumed by the given variable in this observation.

References _reward_, and reward().

Referenced by gum::SDYNA::feedback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRModality()

INLINE void gum::Observation::setRModality ( const DiscreteVariable * var,
Idx modality )
inline

Returns the modality assumed by the given variable in this observation.

Exceptions
NotFoundif variable is not in this observation

Definition at line 135 of file observation.h.

135 {
136 _rInst_.insert(var, modality);
137 }

References _rInst_, and modality().

Referenced by gum::SDYNA::feedback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

std::string gum::Observation::toString ( ) const

Definition at line 46 of file observation.cpp.

46 {
47 std::stringstream status;
48 for (auto varIter = _varInst_.beginSafe(); varIter != _varInst_.endSafe(); ++varIter)
49 if (_rInst_.exists(varIter.key()))
50 status << "| " << varIter.key()->name() << " : " << varIter.val() << " -> "
51 << _rInst_[varIter.key()] << " |";
52 status << std::endl;
53 return status.str();
54 }

References _rInst_, and _varInst_.

Member Data Documentation

◆ _reward_

double gum::Observation::_reward_
private

The reward associated to this transition.

Definition at line 182 of file observation.h.

Referenced by reward(), and setReward().

◆ _rInst_

HashTable< const DiscreteVariable*, Idx > gum::Observation::_rInst_
private

Definition at line 179 of file observation.h.

Referenced by rModality(), setRModality(), and toString().

◆ _varInst_

HashTable< const DiscreteVariable*, Idx > gum::Observation::_varInst_
private

Table giving for every variables its instantiation.

Definition at line 178 of file observation.h.

Referenced by cbeginVariablesSafe(), cendVariablesSafe(), modality(), setModality(), and toString().


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