aGrUM  0.20.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. 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.

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.

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 toString().

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 call graph for this function:

◆ operator delete()

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

Default constructor.

Definition at line 76 of file observation.h.

76  {
78  }
Observation()
Default constructor.
Definition: observation.h:63
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
static SmallObjectAllocator & instance()

◆ operator new()

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

Allocators and Deallocators redefinition.

Definition at line 73 of file observation.h.

73  {
75  }
void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()

◆ 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 toString().

119 { return reward__; }
double reward__
The reward associated to this transition.
Definition: observation.h:161
+ Here is the call 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 toString().

97  {
98  return rInst__[var];
99  }
HashTable< const DiscreteVariable *, Idx > rInst__
Definition: observation.h:158
+ Here is the call 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 toString().

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 call 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 toString().

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:

◆ 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 toString().

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

◆ toString()

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

Definition at line 26 of file observation.cpp.

References gum::Set< Key, Alloc >::emplace().

Referenced by modality(), reward(), rModality(), setModality(), setReward(), and setRModality().

26  {
27  std::stringstream status;
28  for (auto varIter = varInst__.beginSafe(); varIter != varInst__.endSafe();
29  ++varIter)
30  if (rInst__.exists(varIter.key()))
31  status << "| " << varIter.key()->name() << " : " << varIter.val() << " -> "
32  << rInst__[varIter.key()] << " |";
33  status << std::endl;
34  return status.str();
35  }
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 call graph for this function:
+ 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.

◆ rInst__

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

Definition at line 158 of file observation.h.

◆ varInst__

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

Table giving for every variables its instantiation.

Definition at line 157 of file observation.h.


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