aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
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.

References _initialized_.

◆ ~StatisticalLazyDecider()

gum::StatisticalLazyDecider::~StatisticalLazyDecider ( )
inline

Destructor.

Definition at line 69 of file statisticalLazyDecider.h.

69  {
70  GUM_DESTRUCTOR(StatisticalLazyDecider);
71  ;
72  }

Member Function Documentation

◆ checkState()

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

Implements gum::IDecisionStrategy.

Definition at line 82 of file statisticalLazyDecider.h.

References _initialized_.

82  {
83  if (!_initialized_) {
84  _counter_.reset(newState);
85  _initialized_ = true;
86  } else
87  _counter_.incState(newState);
88  }
void reset(const Instantiation &)
void incState(const Instantiation &)

◆ 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.

72  {
73  optPol_ = nullptr;
74  if (allActions_.size() == 0)
75  for (auto actionIter = fmdp->beginActions(); actionIter != fmdp->endActions(); ++actionIter)
76  allActions_ += *actionIter;
77  }
Size size() const
Gives the size.
Definition: actionSet.h:205
SequenceIteratorSafe< Idx > beginActions() const
Returns an iterator reference to he beginning of the list of actions.
Definition: fmdp.h:136
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optPol_
SequenceIteratorSafe< Idx > endActions() const
Returns an iterator reference to the end of the list of actions.
Definition: fmdp.h:141

◆ setOptimalStrategy()

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

Definition at line 89 of file IDecisionStrategy.h.

89  {
90  optPol_ = const_cast< MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy >* >(optPol);
91  }
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optPol_

◆ stateOptimalPolicy()

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

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

Definition at line 93 of file IDecisionStrategy.h.

93  {
94  return (optPol_ && optPol_->realSize() != 0) ? optPol_->get(curState) : allActions_;
95  }
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optPol_

Member Data Documentation

◆ _counter_

StatesCounter gum::StatisticalLazyDecider::_counter_
private

Definition at line 91 of file statisticalLazyDecider.h.

◆ _initialized_

bool gum::StatisticalLazyDecider::_initialized_
private

Definition at line 92 of file statisticalLazyDecider.h.

Referenced by checkState(), and StatisticalLazyDecider().

◆ allActions_

ActionSet gum::IDecisionStrategy::allActions_
protectedinherited

Definition at line 102 of file IDecisionStrategy.h.

◆ optPol_

const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy >* gum::IDecisionStrategy::optPol_
protectedinherited

Definition at line 99 of file IDecisionStrategy.h.


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