aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
gum::AdaptiveRMaxPlaner Class Referenceabstract

<agrum/FMDP/planning/adaptiveRMaxPlaner.h> More...

#include <adaptiveRMaxPlaner.h>

Inheritance diagram for gum::AdaptiveRMaxPlaner:
Collaboration diagram for gum::AdaptiveRMaxPlaner:

Public Member Functions

Planning Methods
void initialize (const FMDP< double > *fmdp) override
 Initializes data structure needed for making the planning.
void makePlanning (Idx nbStep=1000000) override
 Performs a value iteration.
Datastructure access methods
const FMDP< double > * fmdp ()
 Returns a const ptr on the Factored Markov Decision Process on which we're planning.
const MultiDimFunctionGraph< double > * vFunction ()
 Returns a const ptr on the value function computed so far.
Size vFunctionSize () override
 Returns vFunction computed so far current size.
MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optimalPolicy () override
 Returns the best policy obtained so far.
Size optimalPolicySize () override
 Returns optimalPolicy computed so far current size.
std::string optimalPolicy2String () override
 Provide a better toDot for the optimal policy where the leaves have the action name instead of its id.
Planning Methods
void initialize (const FMDP< double > *fmdp) override
 Initializes data structure needed for making the planning.
Initialization
virtual void initialize (const FMDP< GUM_SCALAR > *fmdp)=0
 Initializes the learner.

Static Public Member Functions

static AdaptiveRMaxPlanerReducedAndOrderedInstance (const ILearningStrategy *learner, double discountFactor=0.9, double epsilon=0.00001, bool verbose=true)
static AdaptiveRMaxPlanerTreeInstance (const ILearningStrategy *learner, double discountFactor=0.9, double epsilon=0.00001, bool verbose=true)
static StructuredPlaner< double > * spumddInstance (double discountFactor=0.9, double epsilon=0.00001, bool verbose=true)
static StructuredPlaner< double > * sviInstance (double discountFactor=0.9, double epsilon=0.00001, bool verbose=true)

Protected Member Functions

Value Iteration Methods
void initVFunction_ () override
 Performs a single step of value iteration.
MultiDimFunctionGraph< double > * valueIteration_ () override
 Performs a single step of value iteration.
Optimal policy extraction methods
void evalPolicy_ () override
 Perform the required tasks to extract an optimal policy.
Value Iteration Methods
virtual MultiDimFunctionGraph< double > * evalQaction_ (const MultiDimFunctionGraph< double > *, Idx)
 Performs the P(s'|s,a).V^{t-1}(s') part of the value itération.
virtual MultiDimFunctionGraph< double > * maximiseQactions_ (std::vector< MultiDimFunctionGraph< double > * > &)
 Performs max_a Q(s,a).
virtual MultiDimFunctionGraph< double > * minimiseFunctions_ (std::vector< MultiDimFunctionGraph< double > * > &)
 Performs min_i F_i.
virtual MultiDimFunctionGraph< double > * addReward_ (MultiDimFunctionGraph< double > *function, Idx actionId=0)
 Perform the R(s) + gamma . function.

Protected Attributes

const FMDP< double > * fmdp_
 The Factored Markov Decision Process describing our planning situation (NB : this one must have function graph as transitions and reward functions ).
MultiDimFunctionGraph< double > * vFunction_
 The Value Function computed iteratively.
MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optimalPolicy_
 The associated optimal policy.
gum::VariableSet elVarSeq_
 A Set to eleminate primed variables.
double discountFactor_
 Discount Factor used for infinite horizon planning.
IOperatorStrategy< double > * operator_
bool verbose_
 Boolean used to indcates whether or not iteration informations should be displayed on terminal.

Private Member Functions

void _makeRMaxFunctionGraphs_ ()
std::pair< NodeId, NodeId_visitLearner_ (const IVisitableGraphLearner *, NodeId currentNodeId, MultiDimFunctionGraph< double > *, MultiDimFunctionGraph< double > *)
void _clearTables_ ()

Private Attributes

HashTable< Idx, MultiDimFunctionGraph< double > * > _actionsRMaxTable_
HashTable< Idx, MultiDimFunctionGraph< double > * > _actionsBoolTable_
const ILearningStrategy_fmdpLearner_
double _rThreshold_
double _rmax_
double _threshold_
 The threshold value Whenever | V^{n} - V^{n+1} | < threshold, we consider that V ~ V*.
bool _firstTime_

Incremental methods

HashTable< Idx, StatesCounter * > _counterTable_
HashTable< Idx, bool_initializedTable_
bool _initialized_
void checkState (const Instantiation &newState, Idx actionId) override

Constructor & destructor.

 AdaptiveRMaxPlaner (IOperatorStrategy< double > *opi, double discountFactor, double epsilon, const ILearningStrategy *learner, bool verbose)
 Default constructor.
 ~AdaptiveRMaxPlaner () override
 Default destructor.

Optimal policy extraction methods

NodeId _recurArgMaxCopy_ (NodeId, Idx, const MultiDimFunctionGraph< double > *, MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > *, HashTable< NodeId, NodeId > &)
 Recursion part for the createArgMaxCopy.
NodeId _recurExtractOptPol_ (NodeId, const MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > *, HashTable< NodeId, NodeId > &)
 Recursion part for the createArgMaxCopy.
void _transferActionIds_ (const ArgMaxSet< double, Idx > &, ActionSet &)
 Extract from an ArgMaxSet the associated ActionSet.
MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * makeArgMax_ (const MultiDimFunctionGraph< double > *Qaction, Idx actionId)
 Creates a copy of given Qaction that can be exploit by a Argmax.
virtual MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * argmaximiseQactions_ (std::vector< MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * > &)
 Performs argmax_a Q(s,a).
void extractOptimalPolicy_ (const MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > *optimalValueFunction)
 From V(s)* = argmax_a Q*(s,a), this function extract pi*(s) This function mainly consists in extracting from each ArgMaxSet presents at the leaves the associated ActionSet.

Incremental methods

void setOptimalStrategy (MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > *optPol)
virtual ActionSet stateOptimalPolicy (const Instantiation &curState)
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optPol_ {nullptr}
ActionSet allActions_

Detailed Description

<agrum/FMDP/planning/adaptiveRMaxPlaner.h>

A class to find optimal policy for a given FMDP.

Perform a RMax planning on given in parameter factored markov decision process

Definition at line 73 of file adaptiveRMaxPlaner.h.

Constructor & Destructor Documentation

◆ AdaptiveRMaxPlaner()

gum::AdaptiveRMaxPlaner::AdaptiveRMaxPlaner ( IOperatorStrategy< double > * opi,
double discountFactor,
double epsilon,
const ILearningStrategy * learner,
bool verbose )
private

Default constructor.

Definition at line 88 of file adaptiveRMaxPlaner.cpp.

92 :
93 StructuredPlaner(opi, discountFactor, epsilon, verbose), IDecisionStrategy(),
94 _fmdpLearner_(learner), _initialized_(false) {
95 GUM_CONSTRUCTOR(AdaptiveRMaxPlaner);
96 }
const ILearningStrategy * _fmdpLearner_
AdaptiveRMaxPlaner(IOperatorStrategy< double > *opi, double discountFactor, double epsilon, const ILearningStrategy *learner, bool verbose)
Default constructor.
StructuredPlaner(IOperatorStrategy< double > *opi, double discountFactor, double epsilon, bool verbose)

References AdaptiveRMaxPlaner(), gum::StructuredPlaner< double >::StructuredPlaner(), _fmdpLearner_, and _initialized_.

Referenced by AdaptiveRMaxPlaner(), ~AdaptiveRMaxPlaner(), ReducedAndOrderedInstance(), and TreeInstance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~AdaptiveRMaxPlaner()

gum::AdaptiveRMaxPlaner::~AdaptiveRMaxPlaner ( )
override

Default destructor.

Definition at line 101 of file adaptiveRMaxPlaner.cpp.

101 {
102 GUM_DESTRUCTOR(AdaptiveRMaxPlaner);
103
104 for (HashTableIteratorSafe< Idx, StatesCounter* > scIter = _counterTable_.beginSafe();
105 scIter != _counterTable_.endSafe();
106 ++scIter)
107 delete scIter.val();
108 }
HashTable< Idx, StatesCounter * > _counterTable_

References AdaptiveRMaxPlaner(), and _counterTable_.

Here is the call graph for this function:

Member Function Documentation

◆ _clearTables_()

void gum::AdaptiveRMaxPlaner::_clearTables_ ( )
private

Definition at line 346 of file adaptiveRMaxPlaner.cpp.

346 {
347 for (auto actionIter = this->fmdp()->beginActions(); actionIter != this->fmdp()->endActions();
348 ++actionIter) {
349 delete _actionsBoolTable_[*actionIter];
350 delete _actionsRMaxTable_[*actionIter];
351 }
352 _actionsRMaxTable_.clear();
353 _actionsBoolTable_.clear();
354 }
HashTable< Idx, MultiDimFunctionGraph< double > * > _actionsBoolTable_
HashTable< Idx, MultiDimFunctionGraph< double > * > _actionsRMaxTable_
SequenceIteratorSafe< Idx > endActions() const
Returns an iterator reference to the end of the list of actions.
Definition fmdp_tpl.h:419

References _actionsBoolTable_, _actionsRMaxTable_, gum::FMDP< GUM_ELEMENT >::endActions(), and gum::StructuredPlaner< double >::fmdp().

Referenced by makePlanning().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _makeRMaxFunctionGraphs_()

void gum::AdaptiveRMaxPlaner::_makeRMaxFunctionGraphs_ ( )
private

Definition at line 247 of file adaptiveRMaxPlaner.cpp.

247 {
248 _rThreshold_ = _fmdpLearner_->modaMax() * 5 > 30 ? _fmdpLearner_->modaMax() * 5 : 30;
249 _rmax_ = _fmdpLearner_->rMax() / (1.0 - this->discountFactor_);
250
251 for (auto actionIter = this->fmdp()->beginActions(); actionIter != this->fmdp()->endActions();
252 ++actionIter) {
253 std::vector< MultiDimFunctionGraph< double >* > rmaxs;
254 std::vector< MultiDimFunctionGraph< double >* > boolQs;
255
256 for (auto varIter = this->fmdp()->beginVariables(); varIter != this->fmdp()->endVariables();
257 ++varIter) {
258 const IVisitableGraphLearner* visited = _counterTable_[*actionIter];
259
260 MultiDimFunctionGraph< double >* varRMax = this->operator_->getFunctionInstance();
261 MultiDimFunctionGraph< double >* varBoolQ = this->operator_->getFunctionInstance();
262
263 visited->insertSetOfVars(varRMax);
264 visited->insertSetOfVars(varBoolQ);
265
266 std::pair< NodeId, NodeId > rooty
267 = _visitLearner_(visited, visited->root(), varRMax, varBoolQ);
268 varRMax->manager()->setRootNode(rooty.first);
269 varRMax->manager()->reduce();
270 varRMax->manager()->clean();
271 varBoolQ->manager()->setRootNode(rooty.second);
272 varBoolQ->manager()->reduce();
273 varBoolQ->manager()->clean();
274
275 rmaxs.push_back(varRMax);
276 boolQs.push_back(varBoolQ);
277
278 // std::cout << RECASTED(this->fmdp_->transition(*actionIter,
279 // *varIter))->toDot() << std::endl;
280 // for( auto varIter2 =
281 // RECASTED(this->fmdp_->transition(*actionIter,
282 // *varIter))->variablesSequence().beginSafe(); varIter2 !=
283 // RECASTED(this->fmdp_->transition(*actionIter,
284 // *varIter))->variablesSequence().endSafe(); ++varIter2 )
285 // std::cout << (*varIter2)->name() << " | ";
286 // std::cout << std::endl;
287
288 // std::cout << varRMax->toDot() << std::endl;
289 // for( auto varIter =
290 // varRMax->variablesSequence().beginSafe(); varIter !=
291 // varRMax->variablesSequence().endSafe(); ++varIter )
292 // std::cout << (*varIter)->name() << " | ";
293 // std::cout << std::endl;
294
295 // std::cout << varBoolQ->toDot() << std::endl;
296 // for( auto varIter =
297 // varBoolQ->variablesSequence().beginSafe(); varIter !=
298 // varBoolQ->variablesSequence().endSafe(); ++varIter )
299 // std::cout << (*varIter)->name() << " | ";
300 // std::cout << std::endl;
301 }
302
303 // std::cout << "Maximising" << std::endl;
304 _actionsRMaxTable_.insert(*actionIter, this->maximiseQactions_(rmaxs));
305 _actionsBoolTable_.insert(*actionIter, this->minimiseFunctions_(boolQs));
306 }
307 }
std::pair< NodeId, NodeId > _visitLearner_(const IVisitableGraphLearner *, NodeId currentNodeId, MultiDimFunctionGraph< double > *, MultiDimFunctionGraph< double > *)
SequenceIteratorSafe< const DiscreteVariable * > endVariables() const
Returns an iterator reference to the end of the list of variables.
Definition fmdp_tpl.h:398
IOperatorStrategy< double > * operator_
virtual MultiDimFunctionGraph< double > * minimiseFunctions_(std::vector< MultiDimFunctionGraph< double > * > &)
virtual MultiDimFunctionGraph< double > * maximiseQactions_(std::vector< MultiDimFunctionGraph< double > * > &)

References _actionsBoolTable_, _actionsRMaxTable_, _counterTable_, _fmdpLearner_, _rmax_, _rThreshold_, _visitLearner_(), gum::MultiDimFunctionGraphManager< GUM_ELEMENT, TerminalNodePolicy >::clean(), gum::StructuredPlaner< double >::discountFactor_, gum::FMDP< GUM_ELEMENT >::endActions(), gum::FMDP< GUM_ELEMENT >::endVariables(), gum::StructuredPlaner< double >::fmdp(), gum::IVisitableGraphLearner::insertSetOfVars(), gum::MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy >::manager(), gum::StructuredPlaner< double >::maximiseQactions_(), gum::StructuredPlaner< double >::minimiseFunctions_(), gum::StructuredPlaner< double >::operator_, gum::MultiDimFunctionGraphManager< GUM_ELEMENT, TerminalNodePolicy >::reduce(), gum::IVisitableGraphLearner::root(), and gum::MultiDimFunctionGraphManager< GUM_ELEMENT, TerminalNodePolicy >::setRootNode().

Referenced by makePlanning().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _recurArgMaxCopy_()

NodeId gum::StructuredPlaner< double >::_recurArgMaxCopy_ ( NodeId currentNodeId,
Idx actionId,
const MultiDimFunctionGraph< double > * src,
MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * argMaxCpy,
HashTable< NodeId, NodeId > & visitedNodes )
privateinherited

Recursion part for the createArgMaxCopy.

Definition at line 277 of file structuredPlaner_tpl.h.

504 {
506
507 NodeId nody;
508 if (src->isTerminalNode(currentNodeId)) {
510 nody = argMaxCpy->manager()->addTerminalNode(leaf);
511 } else {
513 NodeId* sonsMap = static_cast< NodeId* >(
514 SOA_ALLOCATE(sizeof(NodeId) * currentNode->nodeVar()->domainSize()));
515 for (Idx moda = 0; moda < currentNode->nodeVar()->domainSize(); ++moda)
518 nody = argMaxCpy->manager()->addInternalNode(currentNode->nodeVar(), sonsMap);
519 }
521 return nody;
522 }
<agrum/FMDP/planning/structuredPlaner.h>
NodeId _recurArgMaxCopy_(NodeId, Idx, const MultiDimFunctionGraph< double > *, MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > *, HashTable< NodeId, NodeId > &)
#define SOA_ALLOCATE(x)

References operator_, valueIteration_(), verbose_, and vFunction_.

Here is the call graph for this function:

◆ _recurExtractOptPol_()

NodeId gum::StructuredPlaner< double >::_recurExtractOptPol_ ( NodeId currentNodeId,
const MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * argMaxOptVFunc,
HashTable< NodeId, NodeId > & visitedNodes )
privateinherited

Recursion part for the createArgMaxCopy.

Definition at line 307 of file structuredPlaner_tpl.h.

580 {
582
583 NodeId nody;
584 if (argMaxOptVFunc->isTerminalNode(currentNodeId)) {
587 nody = optimalPolicy_->manager()->addTerminalNode(leaf);
588 } else {
590 NodeId* sonsMap = static_cast< NodeId* >(
591 SOA_ALLOCATE(sizeof(NodeId) * currentNode->nodeVar()->domainSize()));
592 for (Idx moda = 0; moda < currentNode->nodeVar()->domainSize(); ++moda)
594 nody = optimalPolicy_->manager()->addInternalNode(currentNode->nodeVar(), sonsMap);
595 }
597 return nody;
598 }
NodeId _recurExtractOptPol_(NodeId, const MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > *, HashTable< NodeId, NodeId > &)
void _transferActionIds_(const ArgMaxSet< double, Idx > &, ActionSet &)

◆ _transferActionIds_()

void gum::StructuredPlaner< double >::_transferActionIds_ ( const ArgMaxSet< double, Idx > & src,
ActionSet & dest )
privateinherited

Extract from an ArgMaxSet the associated ActionSet.

Definition at line 315 of file structuredPlaner_tpl.h.

606 {
607 for (auto idi = src.beginSafe(); idi != src.endSafe(); ++idi)
608 dest += *idi;
609 }

◆ _visitLearner_()

std::pair< NodeId, NodeId > gum::AdaptiveRMaxPlaner::_visitLearner_ ( const IVisitableGraphLearner * visited,
NodeId currentNodeId,
MultiDimFunctionGraph< double > * rmax,
MultiDimFunctionGraph< double > * boolQ )
private

Definition at line 313 of file adaptiveRMaxPlaner.cpp.

316 {
317 std::pair< NodeId, NodeId > rep;
318 if (visited->isTerminal(currentNodeId)) {
319 rep.first = rmax->manager()->addTerminalNode(
320 visited->nodeNbObservation(currentNodeId) < _rThreshold_ ? _rmax_ : 0.0);
321 rep.second = boolQ->manager()->addTerminalNode(
322 visited->nodeNbObservation(currentNodeId) < _rThreshold_ ? 0.0 : 1.0);
323 return rep;
324 }
325
326 auto rmaxsons = static_cast< NodeId* >(
327 SOA_ALLOCATE(sizeof(NodeId) * visited->nodeVar(currentNodeId)->domainSize()));
328 auto bqsons = static_cast< NodeId* >(
329 SOA_ALLOCATE(sizeof(NodeId) * visited->nodeVar(currentNodeId)->domainSize()));
330
331 for (Idx moda = 0; moda < visited->nodeVar(currentNodeId)->domainSize(); ++moda) {
332 std::pair< NodeId, NodeId > sonp
333 = _visitLearner_(visited, visited->nodeSon(currentNodeId, moda), rmax, boolQ);
334 rmaxsons[moda] = sonp.first;
335 bqsons[moda] = sonp.second;
336 }
337
338 rep.first = rmax->manager()->addInternalNode(visited->nodeVar(currentNodeId), rmaxsons);
339 rep.second = boolQ->manager()->addInternalNode(visited->nodeVar(currentNodeId), bqsons);
340 return rep;
341 }
Size Idx
Type for indexes.
Definition types.h:79
Size NodeId
Type for node ids.

References _rmax_, _rThreshold_, _visitLearner_(), gum::MultiDimFunctionGraphManager< GUM_ELEMENT, TerminalNodePolicy >::addInternalNode(), gum::MultiDimFunctionGraphManager< GUM_ELEMENT, TerminalNodePolicy >::addTerminalNode(), gum::DiscreteVariable::domainSize(), gum::IVisitableGraphLearner::isTerminal(), gum::MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy >::manager(), gum::IVisitableGraphLearner::nodeNbObservation(), gum::IVisitableGraphLearner::nodeSon(), gum::IVisitableGraphLearner::nodeVar(), and SOA_ALLOCATE.

Referenced by _makeRMaxFunctionGraphs_(), and _visitLearner_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addReward_()

MultiDimFunctionGraph< double > * gum::StructuredPlaner< double >::addReward_ ( MultiDimFunctionGraph< double > * function,
Idx actionId = 0 )
protectedvirtualinherited

Perform the R(s) + gamma . function.

Warning
function is deleted, new one is returned

Definition at line 242 of file structuredPlaner_tpl.h.

409 {
410 // *****************************************************************************************
411 // ... we multiply the result by the discount factor, ...
413 newVFunction->copyAndMultiplyByScalar(*Vold, this->discountFactor_);
414 delete Vold;
415
416 // *****************************************************************************************
417 // ... and finally add reward
419
420 return newVFunction;
421 }
#define RECAST(x)
For shorter line and hence more comprehensive code only.

Referenced by gum::AdaptiveRMaxPlaner::evalPolicy_(), and gum::AdaptiveRMaxPlaner::valueIteration_().

Here is the caller graph for this function:

◆ argmaximiseQactions_()

MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * gum::StructuredPlaner< double >::argmaximiseQactions_ ( std::vector< MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * > & qActionsSet)
protectedvirtualinherited

Performs argmax_a Q(s,a).

Warning
Performs also the deallocation of the QActions

Definition at line 290 of file structuredPlaner_tpl.h.

References _threshold_, and vFunction_.

Referenced by gum::AdaptiveRMaxPlaner::evalPolicy_().

Here is the caller graph for this function:

◆ checkState()

INLINE void gum::AdaptiveRMaxPlaner::checkState ( const Instantiation & newState,
Idx actionId )
overridevirtual

Implements gum::IDecisionStrategy.

Definition at line 71 of file adaptiveRMaxPlaner_inl.h.

71 {
72 if (!_initializedTable_[actionId]) {
73 _counterTable_[actionId]->reset(newState);
74 _initializedTable_[actionId] = true;
75 } else _counterTable_[actionId]->incState(newState);
76 }
HashTable< Idx, bool > _initializedTable_

References _counterTable_, and _initializedTable_.

◆ evalPolicy_()

void gum::AdaptiveRMaxPlaner::evalPolicy_ ( )
overrideprotectedvirtual

Perform the required tasks to extract an optimal policy.

Reimplemented from gum::StructuredPlaner< double >.

Definition at line 208 of file adaptiveRMaxPlaner.cpp.

208 {
209 // *****************************************************************************************
210 // Loop reset
211 MultiDimFunctionGraph< double >* newVFunction = operator_->getFunctionInstance();
212 newVFunction->copyAndReassign(*vFunction_, fmdp_->mapMainPrime());
213
214 std::vector< MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy >* >
215 argMaxQActionsSet;
216 // *****************************************************************************************
217 // For each action
218 for (auto actionIter = fmdp_->beginActions(); actionIter != fmdp_->endActions(); ++actionIter) {
219 MultiDimFunctionGraph< double >* qAction = this->evalQaction_(newVFunction, *actionIter);
220
221 qAction = this->addReward_(qAction, *actionIter);
222
223 qAction = this->operator_->maximize(
224 _actionsRMaxTable_[*actionIter],
225 this->operator_->multiply(qAction, _actionsBoolTable_[*actionIter], 1),
226 2);
227
228 argMaxQActionsSet.push_back(makeArgMax_(qAction, *actionIter));
229 }
230 delete newVFunction;
231
232 // *****************************************************************************************
233 // Next to evaluate main value function, we take maximise over all action
234 // value, ...
235 MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy >* argMaxVFunction
236 = argmaximiseQactions_(argMaxQActionsSet);
237
238 // *****************************************************************************************
239 // Next to evaluate main value function, we take maximise over all action
240 // value, ...
241 extractOptimalPolicy_(argMaxVFunction);
242 }
virtual MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * argmaximiseQactions_(std::vector< MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * > &)
void extractOptimalPolicy_(const MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > *optimalValueFunction)
virtual MultiDimFunctionGraph< double > * addReward_(MultiDimFunctionGraph< double > *function, Idx actionId=0)
MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * makeArgMax_(const MultiDimFunctionGraph< double > *Qaction, Idx actionId)
MultiDimFunctionGraph< double > * vFunction_
virtual MultiDimFunctionGraph< double > * evalQaction_(const MultiDimFunctionGraph< double > *, Idx)

References _actionsBoolTable_, _actionsRMaxTable_, gum::StructuredPlaner< double >::addReward_(), gum::StructuredPlaner< double >::argmaximiseQactions_(), gum::MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy >::copyAndReassign(), gum::StructuredPlaner< double >::evalQaction_(), gum::StructuredPlaner< double >::extractOptimalPolicy_(), gum::StructuredPlaner< double >::fmdp_, gum::StructuredPlaner< double >::makeArgMax_(), gum::StructuredPlaner< double >::operator_, and gum::StructuredPlaner< double >::vFunction_.

Here is the call graph for this function:

◆ evalQaction_()

MultiDimFunctionGraph< double > * gum::StructuredPlaner< double >::evalQaction_ ( const MultiDimFunctionGraph< double > * Vold,
Idx actionId )
protectedvirtualinherited

Performs the P(s'|s,a).V^{t-1}(s') part of the value itération.

Definition at line 221 of file structuredPlaner_tpl.h.

358 {
359 // ******************************************************************************
360 // Initialisation :
361 // Creating a copy of last Vfunction to deduce from the new Qaction
362 // And finding the first var to eleminate (the one at the end)
363
364 return operator_->regress(Vold, actionId, this->fmdp_, this->elVarSeq_);
365 }

Referenced by gum::AdaptiveRMaxPlaner::evalPolicy_(), and gum::AdaptiveRMaxPlaner::valueIteration_().

Here is the caller graph for this function:

◆ extractOptimalPolicy_()

void gum::StructuredPlaner< double >::extractOptimalPolicy_ ( const MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * optimalValueFunction)
protectedinherited

From V(s)* = argmax_a Q*(s,a), this function extract pi*(s) This function mainly consists in extracting from each ArgMaxSet presents at the leaves the associated ActionSet.

Warning
deallocate the argmax optimal value function

Definition at line 299 of file structuredPlaner_tpl.h.

554 {
555 optimalPolicy_->clear();
556
557 // Insertion des nouvelles variables
559 = argMaxOptimalValueFunction->variablesSequence().beginSafe();
560 varIter != argMaxOptimalValueFunction->variablesSequence().endSafe();
561 ++varIter)
562 optimalPolicy_->add(**varIter);
563
565 optimalPolicy_->manager()->setRootNode(_recurExtractOptPol_(argMaxOptimalValueFunction->root(),
567 src2dest));
568
570 }

References evalPolicy_().

Referenced by gum::AdaptiveRMaxPlaner::evalPolicy_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fmdp()

const FMDP< double > * gum::StructuredPlaner< double >::fmdp ( )
inherited

Returns a const ptr on the Factored Markov Decision Process on which we're planning.

Definition at line 138 of file structuredPlaner_tpl.h.

634 {
635 return fmdp_;
636 }

Referenced by gum::AdaptiveRMaxPlaner::_clearTables_(), gum::AdaptiveRMaxPlaner::_makeRMaxFunctionGraphs_(), and gum::AdaptiveRMaxPlaner::initialize().

Here is the caller graph for this function:

◆ initialize() [1/3]

void gum::AdaptiveRMaxPlaner::initialize ( const FMDP< double > * fmdp)
overridevirtual

Initializes data structure needed for making the planning.

Warning
No calling this methods before starting the first makePlaninng will surely and definitely result in a crash

Reimplemented from gum::IDecisionStrategy.

Definition at line 121 of file adaptiveRMaxPlaner.cpp.

121 {
122 if (!_initialized_) {
125 for (auto actionIter = fmdp->beginActions(); actionIter != fmdp->endActions(); ++actionIter) {
126 _counterTable_.insert(*actionIter, new StatesCounter());
127 _initializedTable_.insert(*actionIter, false);
128 }
129 _initialized_ = true;
130 }
131 }
virtual void initialize(const FMDP< double > *fmdp)
Initializes the learner.
void initialize(const FMDP< GUM_ELEMENT > *fmdp) override
Initializes data structure needed for making the planning.

References _counterTable_, _initialized_, _initializedTable_, gum::StructuredPlaner< double >::fmdp(), gum::IDecisionStrategy::initialize(), and gum::StructuredPlaner< GUM_ELEMENT >::initialize().

Here is the call graph for this function:

◆ initialize() [2/3]

virtual void gum::IPlanningStrategy< GUM_SCALAR >::initialize ( const FMDP< GUM_SCALAR > * fmdp)
pure virtualinherited

Initializes the learner.

◆ initialize() [3/3]

void gum::StructuredPlaner< double >::initialize ( const FMDP< double > * fmdp)
overrideinherited

Initializes data structure needed for making the planning.

Warning
No calling this methods before starting the first makePlaninng will surely and definitely result in a crash

Definition at line 183 of file structuredPlaner_tpl.h.

243 {
244 fmdp_ = fmdp;
245
246 // Determination of the threshold value
248
249 // Establishement of sequence of variable elemination
250 for (auto varIter = fmdp_->beginVariables(); varIter != fmdp_->endVariables(); ++varIter)
251 elVarSeq_ << fmdp_->main2prime(*varIter);
252
253 // Initialisation of the value function
254 vFunction_ = operator_->getFunctionInstance();
255 optimalPolicy_ = operator_->getAggregatorInstance();
256 _firstTime_ = true;
257 }

◆ initVFunction_()

void gum::AdaptiveRMaxPlaner::initVFunction_ ( )
overrideprotectedvirtual

Performs a single step of value iteration.

Reimplemented from gum::StructuredPlaner< double >.

Definition at line 155 of file adaptiveRMaxPlaner.cpp.

155 {
156 vFunction_->manager()->setRootNode(vFunction_->manager()->addTerminalNode(0.0));
157 for (auto actionIter = fmdp_->beginActions(); actionIter != fmdp_->endActions(); ++actionIter)
158 vFunction_ = this->operator_->add(vFunction_, RECASTED(this->fmdp_->reward(*actionIter)), 1);
159 }
#define RECASTED(x)
For shorter line and hence more comprehensive code purposes only.

References gum::StructuredPlaner< double >::fmdp_, gum::StructuredPlaner< double >::operator_, RECASTED, and gum::StructuredPlaner< double >::vFunction_.

◆ makeArgMax_()

MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * gum::StructuredPlaner< double >::makeArgMax_ ( const MultiDimFunctionGraph< double > * Qaction,
Idx actionId )
protectedinherited

Creates a copy of given Qaction that can be exploit by a Argmax.

Hence, this step consists in replacing each lea by an ArgMaxSet containing the value of the leaf and the actionId of the Qaction

Parameters
Qaction: the function graph we want to transform
actionId: the action Id associated to that graph
Warning
delete the original Qaction, returns its conversion

Definition at line 271 of file structuredPlaner_tpl.h.

476 {
478 = operator_->getArgMaxFunctionInstance();
479
480 // Insertion des nouvelles variables
482 = qAction->variablesSequence().beginSafe();
483 varIter != qAction->variablesSequence().endSafe();
484 ++varIter)
485 amcpy->add(**varIter);
486
488 amcpy->manager()->setRootNode(
490
491 delete qAction;
492 return amcpy;
493 }

References _threshold_.

Referenced by gum::AdaptiveRMaxPlaner::evalPolicy_().

Here is the caller graph for this function:

◆ makePlanning()

void gum::AdaptiveRMaxPlaner::makePlanning ( Idx nbStep = 1000000)
overridevirtual

Performs a value iteration.

Parameters
nbStep: enables you to specify how many value iterations you wish to do. makePlanning will then stop whether when optimal value function is reach or when nbStep have been performed

Implements gum::IPlanningStrategy< double >.

Definition at line 136 of file adaptiveRMaxPlaner.cpp.

136 {
138
140
142 }
void makePlanning(Idx nbStep=1000000) override
Performs a value iteration.

References _clearTables_(), _makeRMaxFunctionGraphs_(), and gum::StructuredPlaner< GUM_ELEMENT >::makePlanning().

Here is the call graph for this function:

◆ maximiseQactions_()

MultiDimFunctionGraph< double > * gum::StructuredPlaner< double >::maximiseQactions_ ( std::vector< MultiDimFunctionGraph< double > * > & qActionsSet)
protectedvirtualinherited

Performs max_a Q(s,a).

Warning
Performs also the deallocation of the QActions

Definition at line 228 of file structuredPlaner_tpl.h.

372 {
374 qActionsSet.pop_back();
375
376 while (!qActionsSet.empty()) {
378 qActionsSet.pop_back();
380 }
381
382 return newVFunction;
383 }

Referenced by gum::AdaptiveRMaxPlaner::_makeRMaxFunctionGraphs_(), and gum::AdaptiveRMaxPlaner::valueIteration_().

Here is the caller graph for this function:

◆ minimiseFunctions_()

MultiDimFunctionGraph< double > * gum::StructuredPlaner< double >::minimiseFunctions_ ( std::vector< MultiDimFunctionGraph< double > * > & qActionsSet)
protectedvirtualinherited

Performs min_i F_i.

Warning
Performs also the deallocation of the F_i

Definition at line 235 of file structuredPlaner_tpl.h.

390 {
392 qActionsSet.pop_back();
393
394 while (!qActionsSet.empty()) {
396 qActionsSet.pop_back();
398 }
399
400 return newVFunction;
401 }

Referenced by gum::AdaptiveRMaxPlaner::_makeRMaxFunctionGraphs_().

Here is the caller graph for this function:

◆ optimalPolicy()

MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * gum::StructuredPlaner< double >::optimalPolicy ( )
overridevirtualinherited

Returns the best policy obtained so far.

Implements gum::IPlanningStrategy< double >.

Definition at line 153 of file structuredPlaner_tpl.h.

650 {
651 return optimalPolicy_;
652 }

References optimalPolicy_.

◆ optimalPolicy2String()

std::string gum::StructuredPlaner< double >::optimalPolicy2String ( )
overridevirtualinherited

Provide a better toDot for the optimal policy where the leaves have the action name instead of its id.

Implements gum::IPlanningStrategy< double >.

Definition at line 165 of file structuredPlaner_tpl.h.

125 {
126 // ************************************************************************
127 // Discarding the case where no \pi* have been computed
128 if (!optimalPolicy_ || optimalPolicy_->root() == 0) return "NO OPTIMAL POLICY CALCULATED YET";
129
130 // ************************************************************************
131 // Initialisation
132
133 // Declaration of the needed string stream
138
139 // First line for the toDot
140 output += "\ndigraph \" OPTIMAL POLICY \" {\n";
141
142 // Form line for the internal node stream en the terminal node stream
143 terminalStream += "node [shape = box];\n";
144 nonTerminalStream += "node [shape = ellipse];\n";
145
146 // For somme clarity in the final string
147 std::string tab = "\t";
148
149 // To know if we already checked a node or not
151
152 // FIFO of nodes to visit
154
155 // Loading the FIFO
156 fifo.push(optimalPolicy_->root());
157 visited << optimalPolicy_->root();
158
159
160 // ************************************************************************
161 // Main loop
162 while (!fifo.empty()) {
163 // Node to visit
164 NodeId currentNodeId = fifo.front();
165 fifo.pop();
166
167 // Checking if it is terminal
168 if (optimalPolicy_->isTerminalNode(currentNodeId)) {
169 // Get back the associated ActionSet
171
172 // Creating a line for this node
173 terminalStream += std::format("{0}{1};{0}{1} [label=\"{1} - ", tab, currentNodeId);
174
175 // Enumerating and adding to the line the associated optimal actions
176 for (SequenceIteratorSafe< Idx > valIter = ase.beginSafe(); valIter != ase.endSafe();
177 ++valIter) {
178 terminalStream += fmdp_->actionName(*valIter);
179 terminalStream += ' ';
180 }
181
182 // Terminating line
183 terminalStream += "\"];\n";
184 continue;
185 }
186
187 // Either wise
188 {
189 // Geting back the associated internal node
191
192 // Creating a line in internalnode stream for this node
193 nonTerminalStream += std::format("{0}{1};{0}{1} [label=\"{1} - {2}\"];\n",
194 tab,
196 currentNode->nodeVar()->name());
197
198 // Going through the sons and agregating them according the the sons Ids
200 for (Idx sonIter = 0; sonIter < currentNode->nbSons(); ++sonIter) {
201 if (!visited.exists(currentNode->son(sonIter))) {
202 fifo.push(currentNode->son(sonIter));
203 visited << currentNode->son(sonIter);
204 }
205 if (!sonMap.exists(currentNode->son(sonIter)))
206 sonMap.insert(currentNode->son(sonIter), new LinkedList< Idx >());
207 sonMap[currentNode->son(sonIter)]->addLink(sonIter);
208 }
209
210 // Adding to the arc stram
211 for (auto sonIter = sonMap.beginSafe(); sonIter != sonMap.endSafe(); ++sonIter) {
212 arcstream += std::format("{}{} -> {} [label=\" ", tab, currentNodeId, sonIter.key());
213 Link< Idx >* modaIter = sonIter.val()->list();
214 while (modaIter) {
215 arcstream += currentNode->nodeVar()->label(modaIter->element());
216 if (modaIter->nextLink()) arcstream += ", ";
217 modaIter = modaIter->nextLink();
218 }
219 arcstream += "\",color=\"#00ff00\"];\n";
220 delete sonIter.val();
221 }
222 }
223 }
224
225 // Terminating
226 output += terminalStream + '\n' + nonTerminalStream + '\n' + arcstream + "\n}\n";
227
228 return output;
229 }

References gum::ActionSet::beginSafe(), gum::ActionSet::endSafe(), fmdp_, and optimalPolicy_.

Here is the call graph for this function:

◆ optimalPolicySize()

Size gum::StructuredPlaner< double >::optimalPolicySize ( )
overridevirtualinherited

Returns optimalPolicy computed so far current size.

Implements gum::IPlanningStrategy< double >.

Definition at line 158 of file structuredPlaner_tpl.h.

655 {
656 return optimalPolicy_ != nullptr ? optimalPolicy_->realSize() : 0;
657 }

◆ ReducedAndOrderedInstance()

INLINE AdaptiveRMaxPlaner * gum::AdaptiveRMaxPlaner::ReducedAndOrderedInstance ( const ILearningStrategy * learner,
double discountFactor = 0.9,
double epsilon = 0.00001,
bool verbose = true )
static

Definition at line 49 of file adaptiveRMaxPlaner_inl.h.

52 {
53 return new AdaptiveRMaxPlaner(new MDDOperatorStrategy< double >(),
54 discountFactor,
55 epsilon,
56 learner,
57 verbose);
58 }

References AdaptiveRMaxPlaner().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOptimalStrategy()

INLINE void gum::IDecisionStrategy::setOptimalStrategy ( MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optPol)
inherited

Definition at line 55 of file IDecisionStrategy_inl.h.

56 {
57 optPol_ = optPol;
58 }
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optPol_

References optPol_.

◆ spumddInstance()

StructuredPlaner< double > * gum::StructuredPlaner< double >::spumddInstance ( double discountFactor = 0.9,
double epsilon = 0.00001,
bool verbose = true )
staticinherited

Definition at line 92 of file structuredPlaner_tpl.h.

References StructuredPlaner(), _threshold_, optimalPolicy_, and vFunction_.

Here is the call graph for this function:

◆ stateOptimalPolicy()

INLINE ActionSet gum::IDecisionStrategy::stateOptimalPolicy ( const Instantiation & curState)
virtualinherited

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

Definition at line 60 of file IDecisionStrategy_inl.h.

60 {
61 return (optPol_ && optPol_->realSize() != 0) ? optPol_->get(curState) : allActions_;
62 }

References allActions_, and optPol_.

Referenced by gum::E_GreedyDecider::stateOptimalPolicy().

Here is the caller graph for this function:

◆ sviInstance()

StructuredPlaner< double > * gum::StructuredPlaner< double >::sviInstance ( double discountFactor = 0.9,
double epsilon = 0.00001,
bool verbose = true )
staticinherited

Definition at line 99 of file structuredPlaner_tpl.h.

◆ TreeInstance()

INLINE AdaptiveRMaxPlaner * gum::AdaptiveRMaxPlaner::TreeInstance ( const ILearningStrategy * learner,
double discountFactor = 0.9,
double epsilon = 0.00001,
bool verbose = true )
static

Definition at line 60 of file adaptiveRMaxPlaner_inl.h.

63 {
64 return new AdaptiveRMaxPlaner(new TreeOperatorStrategy< double >(),
65 discountFactor,
66 epsilon,
67 learner,
68 verbose);
69 }

References AdaptiveRMaxPlaner().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ valueIteration_()

MultiDimFunctionGraph< double > * gum::AdaptiveRMaxPlaner::valueIteration_ ( )
overrideprotectedvirtual

Performs a single step of value iteration.

Reimplemented from gum::StructuredPlaner< double >.

Definition at line 164 of file adaptiveRMaxPlaner.cpp.

164 {
165 // *****************************************************************************************
166 // Loop reset
167 MultiDimFunctionGraph< double >* newVFunction = operator_->getFunctionInstance();
168 newVFunction->copyAndReassign(*vFunction_, fmdp_->mapMainPrime());
169
170 // *****************************************************************************************
171 // For each action
172 std::vector< MultiDimFunctionGraph< double >* > qActionsSet;
173 for (auto actionIter = fmdp_->beginActions(); actionIter != fmdp_->endActions(); ++actionIter) {
174 MultiDimFunctionGraph< double >* qAction = evalQaction_(newVFunction, *actionIter);
175
176 // *******************************************************************************************
177 // Next, we add the reward
178 qAction = addReward_(qAction, *actionIter);
179
180 qAction = this->operator_->maximize(
181 _actionsRMaxTable_[*actionIter],
182 this->operator_->multiply(qAction, _actionsBoolTable_[*actionIter], 1),
183 2);
184
185 qActionsSet.push_back(qAction);
186 }
187 delete newVFunction;
188
189 // *****************************************************************************************
190 // Next to evaluate main value function, we take maximise over all action
191 // value, ...
192 newVFunction = maximiseQactions_(qActionsSet);
193
194 return newVFunction;
195 }

References _actionsBoolTable_, _actionsRMaxTable_, gum::StructuredPlaner< double >::addReward_(), gum::MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy >::copyAndReassign(), gum::StructuredPlaner< double >::evalQaction_(), gum::StructuredPlaner< double >::fmdp_, gum::StructuredPlaner< double >::maximiseQactions_(), gum::StructuredPlaner< double >::operator_, and gum::StructuredPlaner< double >::vFunction_.

Here is the call graph for this function:

◆ vFunction()

const MultiDimFunctionGraph< double > * gum::StructuredPlaner< double >::vFunction ( )
inherited

Returns a const ptr on the value function computed so far.

Definition at line 143 of file structuredPlaner_tpl.h.

639 {
640 return vFunction_;
641 }

◆ vFunctionSize()

Size gum::StructuredPlaner< double >::vFunctionSize ( )
overridevirtualinherited

Returns vFunction computed so far current size.

Implements gum::IPlanningStrategy< double >.

Definition at line 148 of file structuredPlaner_tpl.h.

644 {
645 return vFunction_ != nullptr ? vFunction_->realSize() : 0;
646 }

Member Data Documentation

◆ _actionsBoolTable_

HashTable< Idx, MultiDimFunctionGraph< double >* > gum::AdaptiveRMaxPlaner::_actionsBoolTable_
private

◆ _actionsRMaxTable_

HashTable< Idx, MultiDimFunctionGraph< double >* > gum::AdaptiveRMaxPlaner::_actionsRMaxTable_
private

◆ _counterTable_

HashTable< Idx, StatesCounter* > gum::AdaptiveRMaxPlaner::_counterTable_
private

◆ _firstTime_

bool gum::StructuredPlaner< double >::_firstTime_
privateinherited

Definition at line 368 of file structuredPlaner.h.

Referenced by evalPolicy_().

◆ _fmdpLearner_

const ILearningStrategy* gum::AdaptiveRMaxPlaner::_fmdpLearner_
private

Definition at line 198 of file adaptiveRMaxPlaner.h.

Referenced by AdaptiveRMaxPlaner(), and _makeRMaxFunctionGraphs_().

◆ _initialized_

bool gum::AdaptiveRMaxPlaner::_initialized_
private

Definition at line 216 of file adaptiveRMaxPlaner.h.

Referenced by AdaptiveRMaxPlaner(), and initialize().

◆ _initializedTable_

HashTable< Idx, bool > gum::AdaptiveRMaxPlaner::_initializedTable_
private

Definition at line 214 of file adaptiveRMaxPlaner.h.

Referenced by checkState(), and initialize().

◆ _rmax_

double gum::AdaptiveRMaxPlaner::_rmax_
private

Definition at line 201 of file adaptiveRMaxPlaner.h.

Referenced by _makeRMaxFunctionGraphs_(), and _visitLearner_().

◆ _rThreshold_

double gum::AdaptiveRMaxPlaner::_rThreshold_
private

Definition at line 200 of file adaptiveRMaxPlaner.h.

Referenced by _makeRMaxFunctionGraphs_(), and _visitLearner_().

◆ _threshold_

double gum::StructuredPlaner< double >::_threshold_
privateinherited

The threshold value Whenever | V^{n} - V^{n+1} | < threshold, we consider that V ~ V*.

Definition at line 367 of file structuredPlaner.h.

Referenced by argmaximiseQactions_(), makeArgMax_(), and spumddInstance().

◆ allActions_

ActionSet gum::IDecisionStrategy::allActions_
protectedinherited

◆ discountFactor_

double gum::StructuredPlaner< double >::discountFactor_
protectedinherited

Discount Factor used for infinite horizon planning.

Definition at line 351 of file structuredPlaner.h.

Referenced by gum::AdaptiveRMaxPlaner::_makeRMaxFunctionGraphs_().

◆ elVarSeq_

gum::VariableSet gum::StructuredPlaner< double >::elVarSeq_
protectedinherited

A Set to eleminate primed variables.

Definition at line 346 of file structuredPlaner.h.

◆ fmdp_

const FMDP< double >* gum::StructuredPlaner< double >::fmdp_
protectedinherited

The Factored Markov Decision Process describing our planning situation (NB : this one must have function graph as transitions and reward functions ).

Definition at line 326 of file structuredPlaner.h.

Referenced by gum::AdaptiveRMaxPlaner::evalPolicy_(), gum::AdaptiveRMaxPlaner::initVFunction_(), optimalPolicy2String(), and gum::AdaptiveRMaxPlaner::valueIteration_().

◆ operator_

◆ optimalPolicy_

The associated optimal policy.

Warning
Leaves are ActionSet which contains the ids of the best actions While this is sufficient to be exploited, to be understood by a human somme translation from the fmdp_ is required. optimalPolicy2String do this job.

Definition at line 341 of file structuredPlaner.h.

Referenced by optimalPolicy(), optimalPolicy2String(), and spumddInstance().

◆ optPol_

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

Definition at line 112 of file IDecisionStrategy.h.

112{nullptr};

Referenced by initialize(), setOptimalStrategy(), and stateOptimalPolicy().

◆ verbose_

bool gum::StructuredPlaner< double >::verbose_
protectedinherited

Boolean used to indcates whether or not iteration informations should be displayed on terminal.

Definition at line 359 of file structuredPlaner.h.

Referenced by _recurArgMaxCopy_().

◆ vFunction_


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