aGrUM  0.20.2
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 { 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 initialized__.

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 &)

◆ 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();
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

◆ setOptimalStrategy()

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

Definition at line 90 of file IDecisionStrategy.h.

91  {
92  optPol_ = const_cast<
93  MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy >* >(optPol);
94  }
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 96 of file IDecisionStrategy.h.

96  {
97  return (optPol_ && optPol_->realSize() != 0) ? optPol_->get(curState)
98  : allActions_;
99  }
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optPol_

Member Data Documentation

◆ allActions_

ActionSet gum::IDecisionStrategy::allActions_
protectedinherited

Definition at line 106 of file IDecisionStrategy.h.

◆ counter__

StatesCounter gum::StatisticalLazyDecider::counter__
private

Definition at line 88 of file statisticalLazyDecider.h.

◆ initialized__

bool gum::StatisticalLazyDecider::initialized__
private

Definition at line 89 of file statisticalLazyDecider.h.

Referenced by checkState(), and StatisticalLazyDecider().

◆ optPol_

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

Definition at line 103 of file IDecisionStrategy.h.


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