aGrUM  0.16.0
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. More...
 
 ~Observation ()
 Default destructor. More...
 
void * operator new (size_t s)
 Allocators and Deallocators redefinition. More...
 
void operator delete (void *p)
 Default constructor. More...
 
Observation Handlers
INLINE Idx modality (const DiscreteVariable *var) const
 Returns the modality assumed by the given variable in this observation. More...
 
INLINE Idx rModality (const DiscreteVariable *var) const
 Returns the modality assumed by the given variable in this observation. More...
 
INLINE void setModality (const DiscreteVariable *var, Idx modality)
 Sets the modality assumed by the given variable in this observation. More...
 
INLINE void setRModality (const DiscreteVariable *var, Idx modality)
 Returns the modality assumed by the given variable in this observation. More...
 
double reward () const
 Returns the modality assumed by the given variable in this observation. More...
 
void setReward (double reward)
 Returns the modality assumed by the given variable in this observation. More...
 
Iterators on Variables
HashTableConstIteratorSafe< const DiscreteVariable *, IdxcbeginVariablesSafe () const
 Returns an const safe iterator on the beginning of the list of variables in this observation. More...
 
HashTableConstIteratorSafe< const DiscreteVariable *, IdxcendVariablesSafe () const
 Returns an const safe iterator on the end of the list of variables in this observation. More...
 

Detailed Description

Definition at line 53 of file observation.h.

Constructor & Destructor Documentation

◆ Observation()

gum::Observation::Observation ( )
inline

Default constructor.

Definition at line 63 of file observation.h.

63 { GUM_CONSTRUCTOR(Observation); }
Observation()
Default constructor.
Definition: observation.h:63

◆ ~Observation()

gum::Observation::~Observation ( )
inline

Default destructor.

Definition at line 68 of file observation.h.

68 { GUM_DESTRUCTOR(Observation); }
Observation()
Default constructor.
Definition: observation.h:63

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 140 of file observation.h.

References __varInst.

140  {
141  return __varInst.cbeginSafe();
142  }
HashTable< const DiscreteVariable *, Idx > __varInst
Table giving for every variables its instantiation.
Definition: observation.h:157

◆ 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 149 of file observation.h.

References __varInst.

149  {
150  return __varInst.cendSafe();
151  }
HashTable< const DiscreteVariable *, Idx > __varInst
Table giving for every variables its instantiation.
Definition: observation.h:157

◆ 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 94 of file observation.h.

References __varInst.

Referenced by gum::NodeDatabase< AttributeSelection, isScalar >::__addObservation(), gum::IncrementalGraphLearner< AttributeSelection, isScalar >::__assumeValue(), and gum::IncrementalGraphLearner< AttributeSelection, isScalar >::__branchObs().

94  {
95  return __varInst[var];
96  }
HashTable< const DiscreteVariable *, Idx > __varInst
Table giving for every variables its instantiation.
Definition: observation.h:157
+ Here is the caller graph for this function:

◆ operator delete()

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

Default constructor.

Definition at line 76 of file observation.h.

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

76  {
78  }
Observation()
Default constructor.
Definition: observation.h:63
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
static 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 73 of file observation.h.

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

73  {
75  }
void * allocate(const size_t &objectSize)
Allocates a block.
static 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 119 of file observation.h.

References __reward.

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

119 { return __reward; }
double __reward
The reward associated to this transition.
Definition: observation.h:161
+ 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 97 of file observation.h.

References __rInst.

Referenced by gum::NodeDatabase< AttributeSelection, isScalar >::__addObservation(), and gum::IncrementalGraphLearner< AttributeSelection, isScalar >::__branchObs().

97  {
98  return __rInst[var];
99  }
HashTable< const DiscreteVariable *, Idx > __rInst
Definition: observation.h:158
+ 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 109 of file observation.h.

References __varInst.

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

109  {
110  __varInst.insert(var, modality);
111  }
HashTable< const DiscreteVariable *, Idx > __varInst
Table giving for every variables its instantiation.
Definition: observation.h:157
+ 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 124 of file observation.h.

References __reward, reward(), and toString().

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

124 { __reward = reward; }
double __reward
The reward associated to this transition.
Definition: observation.h:161
double reward() const
Returns the modality assumed by the given variable in this observation.
Definition: observation.h:119
+ 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 112 of file observation.h.

References __rInst.

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

112  {
113  __rInst.insert(var, modality);
114  }
HashTable< const DiscreteVariable *, Idx > __rInst
Definition: observation.h:158
+ Here is the caller graph for this function:

◆ toString()

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

Definition at line 27 of file observation.cpp.

References __rInst, and __varInst.

Referenced by setReward().

27  {
28  std::stringstream status;
29  for (auto varIter = __varInst.beginSafe(); varIter != __varInst.endSafe();
30  ++varIter)
31  if (__rInst.exists(varIter.key()))
32  status << "| " << varIter.key()->name() << " : " << varIter.val() << " -> "
33  << __rInst[varIter.key()] << " |";
34  status << std::endl;
35  return status.str();
36  }
HashTable< const DiscreteVariable *, Idx > __rInst
Definition: observation.h:158
HashTable< const DiscreteVariable *, Idx > __varInst
Table giving for every variables its instantiation.
Definition: observation.h:157
+ Here is the caller graph for this function:

Member Data Documentation

◆ __reward

double gum::Observation::__reward
private

The reward associated to this transition.

Definition at line 161 of file observation.h.

Referenced by reward(), and setReward().

◆ __rInst

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

Definition at line 158 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 157 of file observation.h.

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


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