![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
<agrum/FMDP/planning/structuredPlaner.h> More...
#include <structuredPlaner.h>
Public Member Functions | |
Datastructure access methods | |
INLINE const FMDP< GUM_SCALAR > * | fmdp () |
Returns a const ptr on the Factored Markov Decision Process on which we're planning. More... | |
INLINE const MultiDimFunctionGraph< GUM_SCALAR > * | vFunction () |
Returns a const ptr on the value function computed so far. More... | |
virtual Size | vFunctionSize () |
Returns vFunction computed so far current size. More... | |
INLINE const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * | optimalPolicy () |
Returns the best policy obtained so far. More... | |
virtual Size | optimalPolicySize () |
Returns optimalPolicy computed so far current size. More... | |
std::string | optimalPolicy2String () |
Provide a better toDot for the optimal policy where the leaves have the action name instead of its id. More... | |
Planning Methods | |
virtual void | initialize (const FMDP< GUM_SCALAR > *fmdp) |
Initializes data structure needed for making the planning. More... | |
virtual void | makePlanning (Idx nbStep=1000000) |
Performs a value iteration. More... | |
Static Public Member Functions | |
static StructuredPlaner< GUM_SCALAR > * | spumddInstance (GUM_SCALAR discountFactor=0.9, GUM_SCALAR epsilon=0.00001, bool verbose=true) |
static StructuredPlaner< GUM_SCALAR > * | sviInstance (GUM_SCALAR discountFactor=0.9, GUM_SCALAR epsilon=0.00001, bool verbose=true) |
Protected Attributes | |
const FMDP< GUM_SCALAR > * | fmdp_ |
The Factored Markov Decision Process describing our planning situation (NB : this one must have function graph as transitions and reward functions ) More... | |
MultiDimFunctionGraph< GUM_SCALAR > * | vFunction_ |
The Value Function computed iteratively. More... | |
MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * | optimalPolicy_ |
The associated optimal policy. More... | |
Set< const DiscreteVariable *> | elVarSeq_ |
A Set to eleminate primed variables. More... | |
GUM_SCALAR | discountFactor_ |
Discount Factor used for infinite horizon planning. More... | |
IOperatorStrategy< GUM_SCALAR > * | operator_ |
bool | verbose_ |
Boolean used to indcates whether or not iteration informations should be displayed on terminal. More... | |
Protected Member Functions | |
Value Iteration Methods | |
virtual void | initVFunction_ () |
Performs a single step of value iteration. More... | |
virtual MultiDimFunctionGraph< GUM_SCALAR > * | valueIteration_ () |
Performs a single step of value iteration. More... | |
virtual MultiDimFunctionGraph< GUM_SCALAR > * | evalQaction_ (const MultiDimFunctionGraph< GUM_SCALAR > *, Idx) |
Performs the P(s'|s,a).V^{t-1}(s') part of the value itération. More... | |
virtual MultiDimFunctionGraph< GUM_SCALAR > * | maximiseQactions_ (std::vector< MultiDimFunctionGraph< GUM_SCALAR > * > &) |
Performs max_a Q(s,a) More... | |
virtual MultiDimFunctionGraph< GUM_SCALAR > * | minimiseFunctions_ (std::vector< MultiDimFunctionGraph< GUM_SCALAR > * > &) |
Performs min_i F_i. More... | |
virtual MultiDimFunctionGraph< GUM_SCALAR > * | addReward_ (MultiDimFunctionGraph< GUM_SCALAR > *function, Idx actionId=0) |
Perform the R(s) + gamma . function. More... | |
Constructor & destructor. | |
StructuredPlaner (IOperatorStrategy< GUM_SCALAR > *opi, GUM_SCALAR discountFactor, GUM_SCALAR epsilon, bool verbose) | |
Default constructor. More... | |
virtual | ~StructuredPlaner () |
Default destructor. More... | |
Optimal policy extraction methods | |
virtual void | evalPolicy_ () |
Perform the required tasks to extract an optimal policy. More... | |
MultiDimFunctionGraph< ArgMaxSet< GUM_SCALAR, Idx >, SetTerminalNodePolicy > * | makeArgMax_ (const MultiDimFunctionGraph< GUM_SCALAR > *Qaction, Idx actionId) |
Creates a copy of given Qaction that can be exploit by a Argmax. More... | |
virtual MultiDimFunctionGraph< ArgMaxSet< GUM_SCALAR, Idx >, SetTerminalNodePolicy > * | argmaximiseQactions_ (std::vector< MultiDimFunctionGraph< ArgMaxSet< GUM_SCALAR, Idx >, SetTerminalNodePolicy > * > &) |
Performs argmax_a Q(s,a) More... | |
void | extractOptimalPolicy_ (const MultiDimFunctionGraph< ArgMaxSet< GUM_SCALAR, 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. More... | |
NodeId | _recurArgMaxCopy_ (NodeId, Idx, const MultiDimFunctionGraph< GUM_SCALAR > *, MultiDimFunctionGraph< ArgMaxSet< GUM_SCALAR, Idx >, SetTerminalNodePolicy > *, HashTable< NodeId, NodeId > &) |
Recursion part for the createArgMaxCopy. More... | |
NodeId | _recurExtractOptPol_ (NodeId, const MultiDimFunctionGraph< ArgMaxSet< GUM_SCALAR, Idx >, SetTerminalNodePolicy > *, HashTable< NodeId, NodeId > &) |
Recursion part for the createArgMaxCopy. More... | |
void | _transferActionIds_ (const ArgMaxSet< GUM_SCALAR, Idx > &, ActionSet &) |
Extract from an ArgMaxSet the associated ActionSet. More... | |
<agrum/FMDP/planning/structuredPlaner.h>
A class to find optimal policy for a given FMDP.
Perform a structure value iteration planning
Pure virtual functions : regress_, maximize_, argmaximize_, add_ and subtract_ are a priori the ones to be respecified according to the used datastructure (MDDs, DTs, BNs, ...)
Definition at line 70 of file structuredPlaner.h.
|
protected |
Default constructor.
Definition at line 64 of file structuredPlaner_tpl.h.
|
virtual |
Default destructor.
Definition at line 81 of file structuredPlaner_tpl.h.
|
private |
Recursion part for the createArgMaxCopy.
Definition at line 488 of file structuredPlaner_tpl.h.
|
private |
Recursion part for the createArgMaxCopy.
Definition at line 567 of file structuredPlaner_tpl.h.
|
private |
Extract from an ArgMaxSet the associated ActionSet.
Definition at line 595 of file structuredPlaner_tpl.h.
|
protectedvirtual |
Perform the R(s) + gamma . function.
Definition at line 395 of file structuredPlaner_tpl.h.
|
protectedvirtual |
Performs argmax_a Q(s,a)
Definition at line 519 of file structuredPlaner_tpl.h.
Referenced by gum::StructuredPlaner< double >::fmdp(), gum::StructuredPlaner< double >::optimalPolicy(), gum::StructuredPlaner< double >::optimalPolicySize(), gum::StructuredPlaner< double >::vFunction(), and gum::StructuredPlaner< double >::vFunctionSize().
|
protectedvirtual |
Perform the required tasks to extract an optimal policy.
Reimplemented in gum::AdaptiveRMaxPlaner.
Definition at line 423 of file structuredPlaner_tpl.h.
|
protectedvirtual |
Performs the P(s'|s,a).V^{t-1}(s') part of the value itération.
Definition at line 341 of file structuredPlaner_tpl.h.
|
protected |
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.
Definition at line 542 of file structuredPlaner_tpl.h.
|
inline |
Returns a const ptr on the Factored Markov Decision Process on which we're planning.
Definition at line 133 of file structuredPlaner.h.
|
virtual |
Initializes data structure needed for making the planning.
Implements gum::IPlanningStrategy< GUM_SCALAR >.
Reimplemented in gum::AdaptiveRMaxPlaner.
Definition at line 224 of file structuredPlaner_tpl.h.
|
protectedvirtual |
Performs a single step of value iteration.
Reimplemented in gum::AdaptiveRMaxPlaner.
Definition at line 291 of file structuredPlaner_tpl.h.
|
protected |
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
Qaction | : the function graph we want to transform |
actionId | : the action Id associated to that graph |
Definition at line 463 of file structuredPlaner_tpl.h.
|
virtual |
Performs a value iteration.
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< GUM_SCALAR >.
Reimplemented in gum::AdaptiveRMaxPlaner.
Definition at line 245 of file structuredPlaner_tpl.h.
|
protectedvirtual |
Performs max_a Q(s,a)
Definition at line 356 of file structuredPlaner_tpl.h.
|
protectedvirtual |
Performs min_i F_i.
Definition at line 375 of file structuredPlaner_tpl.h.
|
inlinevirtual |
Returns the best policy obtained so far.
Implements gum::IPlanningStrategy< GUM_SCALAR >.
Definition at line 148 of file structuredPlaner.h.
|
virtual |
Provide a better toDot for the optimal policy where the leaves have the action name instead of its id.
Implements gum::IPlanningStrategy< GUM_SCALAR >.
Definition at line 104 of file structuredPlaner_tpl.h.
|
inlinevirtual |
Returns optimalPolicy computed so far current size.
Implements gum::IPlanningStrategy< GUM_SCALAR >.
Definition at line 155 of file structuredPlaner.h.
|
inlinestatic |
Definition at line 79 of file structuredPlaner.h.
|
inlinestatic |
Definition at line 91 of file structuredPlaner.h.
|
protectedvirtual |
Performs a single step of value iteration.
Reimplemented in gum::AdaptiveRMaxPlaner.
Definition at line 308 of file structuredPlaner_tpl.h.
|
inline |
Returns a const ptr on the value function computed so far.
Definition at line 138 of file structuredPlaner.h.
|
inlinevirtual |
Returns vFunction computed so far current size.
Implements gum::IPlanningStrategy< GUM_SCALAR >.
Definition at line 143 of file structuredPlaner.h.
|
private |
Definition at line 367 of file structuredPlaner.h.
|
private |
The threshold value Whenever | V^{n} - V^{n+1} | < threshold, we consider that V ~ V*.
Definition at line 366 of file structuredPlaner.h.
|
protected |
Discount Factor used for infinite horizon planning.
Definition at line 350 of file structuredPlaner.h.
|
protected |
A Set to eleminate primed variables.
Definition at line 345 of file structuredPlaner.h.
|
protected |
The Factored Markov Decision Process describing our planning situation (NB : this one must have function graph as transitions and reward functions )
Definition at line 325 of file structuredPlaner.h.
|
protected |
Definition at line 352 of file structuredPlaner.h.
|
protected |
The associated optimal policy.
Definition at line 340 of file structuredPlaner.h.
|
protected |
Boolean used to indcates whether or not iteration informations should be displayed on terminal.
Definition at line 358 of file structuredPlaner.h.
|
protected |
The Value Function computed iteratively.
Definition at line 330 of file structuredPlaner.h.