aGrUM  0.20.3
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  {
64  GUM_CONSTRUCTOR(Observation);
65  ;
66  }
Observation()
Default constructor.
Definition: observation.h:63

◆ ~Observation()

gum::Observation::~Observation ( )
inline

Default destructor.

Definition at line 71 of file observation.h.

71  {
72  GUM_DESTRUCTOR(Observation);
73  ;
74  }
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 139 of file observation.h.

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

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

147  {
148  return _varInst_.cendSafe();
149  }
HashTable< const DiscreteVariable *, Idx > _varInst_
Table giving for every variables its instantiation.
Definition: observation.h:155

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

References toString().

98 { return _varInst_[var]; }
HashTable< const DiscreteVariable *, Idx > _varInst_
Table giving for every variables its instantiation.
Definition: observation.h:155
+ Here is the call graph for this function:

◆ operator delete()

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

Default constructor.

Definition at line 80 of file observation.h.

80  {
82  }
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 79 of file observation.h.

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:159
+ 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 99 of file observation.h.

References toString().

99 { return _rInst_[var]; }
HashTable< const DiscreteVariable *, Idx > _rInst_
Definition: observation.h:156
+ 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:155
+ 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() const
Returns the modality assumed by the given variable in this observation.
Definition: observation.h:119
double _reward_
The reward associated to this transition.
Definition: observation.h:159
+ 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:156
+ 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(); ++varIter)
29  if (_rInst_.exists(varIter.key()))
30  status << "| " << varIter.key()->name() << " : " << varIter.val() << " -> "
31  << _rInst_[varIter.key()] << " |";
32  status << std::endl;
33  return status.str();
34  }
HashTable< const DiscreteVariable *, Idx > _varInst_
Table giving for every variables its instantiation.
Definition: observation.h:155
HashTable< const DiscreteVariable *, Idx > _rInst_
Definition: observation.h:156
+ 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 159 of file observation.h.

◆ _rInst_

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

Definition at line 156 of file observation.h.

◆ _varInst_

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

Table giving for every variables its instantiation.

Definition at line 155 of file observation.h.


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