aGrUM  0.16.0
gum::StatisticalLazyDecider Class Reference

<agrum/FMDP/decision/statisticalLazyDecider.h> More...

#include <statisticalLazyDecider.h>

+ Inheritance diagram for gum::StatisticalLazyDecider:
+ Collaboration diagram for gum::StatisticalLazyDecider:

Public Member Functions

Constructor & destructor.
 StatisticalLazyDecider ()
 Constructor. More...
 
 ~StatisticalLazyDecider ()
 Destructor. More...
 
Initialization
virtual void initialize (const FMDP< double > *fmdp)
 Initializes the learner. More...
 

Incremental methods

StatesCounter __counter
 
bool __initialized
 
void checkState (const Instantiation &newState, Idx actionId=0)
 

Incremental methods

void setOptimalStrategy (const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > *optPol)
 
virtual ActionSet stateOptimalPolicy (const Instantiation &curState)
 
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * _optPol
 
ActionSet _allActions
 

Detailed Description

<agrum/FMDP/decision/statisticalLazyDecider.h>

Class to make no decision at all yet performing statistic on visited states. Actions are randomly chosen among all actions available

Does nothing more for decison making But count how many times every visited states have been visited

Definition at line 53 of file statisticalLazyDecider.h.

Constructor & Destructor Documentation

◆ StatisticalLazyDecider()

gum::StatisticalLazyDecider::StatisticalLazyDecider ( )
inline

Constructor.

Definition at line 62 of file statisticalLazyDecider.h.

◆ ~StatisticalLazyDecider()

gum::StatisticalLazyDecider::~StatisticalLazyDecider ( )
inline

Destructor.

Definition at line 69 of file statisticalLazyDecider.h.

69 { GUM_DESTRUCTOR(StatisticalLazyDecider); }

Member Function Documentation

◆ checkState()

void gum::StatisticalLazyDecider::checkState ( const Instantiation newState,
Idx  actionId = 0 
)
inlinevirtual

Implements gum::IDecisionStrategy.

Definition at line 79 of file statisticalLazyDecider.h.

References __counter, __initialized, gum::StatesCounter::incState(), and gum::StatesCounter::reset().

79  {
80  if (!__initialized) {
81  __counter.reset(newState);
82  __initialized = true;
83  } else
84  __counter.incState(newState);
85  }
void reset(const Instantiation &)
void incState(const Instantiation &)
+ Here is the call graph for this function:

◆ initialize()

virtual void gum::IDecisionStrategy::initialize ( const FMDP< double > *  fmdp)
inlinevirtualinherited

Initializes the learner.

Reimplemented in gum::AdaptiveRMaxPlaner, and gum::E_GreedyDecider.

Definition at line 72 of file IDecisionStrategy.h.

References gum::IDecisionStrategy::_allActions, gum::IDecisionStrategy::_optPol, gum::FMDP< GUM_SCALAR >::beginActions(), gum::IDecisionStrategy::checkState(), gum::FMDP< GUM_SCALAR >::endActions(), and gum::ActionSet::size().

Referenced by gum::E_GreedyDecider::initialize(), gum::AdaptiveRMaxPlaner::initialize(), and gum::SDYNA::initialize().

72  {
73  _optPol = nullptr;
74  if (_allActions.size() == 0)
75  for (auto actionIter = fmdp->beginActions();
76  actionIter != fmdp->endActions();
77  ++actionIter)
78  _allActions += *actionIter;
79  }
Size size() const
Gives the size.
Definition: actionSet.h:211
SequenceIteratorSafe< Idx > beginActions() const
Returns an iterator reference to he beginning of the list of actions.
Definition: fmdp.h:137
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * _optPol
SequenceIteratorSafe< Idx > endActions() const
Returns an iterator reference to the end of the list of actions.
Definition: fmdp.h:144
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOptimalStrategy()

void gum::IDecisionStrategy::setOptimalStrategy ( const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > *  optPol)
inlineinherited

Definition at line 90 of file IDecisionStrategy.h.

References gum::IDecisionStrategy::_optPol.

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

91  {
92  _optPol =
93  const_cast< MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy >* >(
94  optPol);
95  }
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * _optPol
+ Here is the caller graph for this function:

◆ stateOptimalPolicy()

virtual ActionSet gum::IDecisionStrategy::stateOptimalPolicy ( const Instantiation curState)
inlinevirtualinherited

Reimplemented in gum::E_GreedyDecider, and gum::RandomDecider.

Definition at line 97 of file IDecisionStrategy.h.

References gum::IDecisionStrategy::_allActions, and gum::IDecisionStrategy::_optPol.

Referenced by gum::E_GreedyDecider::stateOptimalPolicy(), and gum::SDYNA::takeAction().

97  {
98  return (_optPol && _optPol->realSize() != 0) ? _optPol->get(curState)
99  : _allActions;
100  }
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * _optPol
+ Here is the caller graph for this function:

Member Data Documentation

◆ __counter

StatesCounter gum::StatisticalLazyDecider::__counter
private

Definition at line 88 of file statisticalLazyDecider.h.

Referenced by checkState().

◆ __initialized

bool gum::StatisticalLazyDecider::__initialized
private

Definition at line 89 of file statisticalLazyDecider.h.

Referenced by checkState().

◆ _allActions

◆ _optPol


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