![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
<agrum/FMDP/planning/adaptiveRMaxPlaner.h> More...
#include <adaptiveRMaxPlaner.h>
Public Member Functions | |
Planning Methods | |
void | initialize (const FMDP< double > *fmdp) |
Initializes data structure needed for making the planning. More... | |
void | makePlanning (Idx nbStep=1000000) |
Performs a value iteration. More... | |
Datastructure access methods | |
INLINE const FMDP< double > * | fmdp () |
Returns a const ptr on the Factored Markov Decision Process on which we're planning. More... | |
INLINE const MultiDimFunctionGraph< double > * | 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... | |
Static Public Member Functions | |
static AdaptiveRMaxPlaner * | ReducedAndOrderedInstance (const ILearningStrategy *learner, double discountFactor=0.9, double epsilon=0.00001, bool verbose=true) |
static AdaptiveRMaxPlaner * | TreeInstance (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 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 ) More... | |
MultiDimFunctionGraph< double > * | 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... | |
double | discountFactor_ |
Discount Factor used for infinite horizon planning. More... | |
IOperatorStrategy< double > * | 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< double > * | valueIteration_ () |
Performs a single step of value iteration. More... | |
Optimal policy extraction methods | |
virtual void | evalPolicy_ () |
Perform the required tasks to extract an optimal policy. More... | |
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. More... | |
virtual MultiDimFunctionGraph< double > * | maximiseQactions_ (std::vector< MultiDimFunctionGraph< double > *> &) |
Performs max_a Q(s,a) More... | |
virtual MultiDimFunctionGraph< double > * | minimiseFunctions_ (std::vector< MultiDimFunctionGraph< double > *> &) |
Performs min_i F_i. More... | |
virtual MultiDimFunctionGraph< double > * | addReward_ (MultiDimFunctionGraph< double > *function, Idx actionId=0) |
Perform the R(s) + gamma . function. More... | |
Optimal policy extraction methods | |
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. More... | |
virtual MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > * | argmaximiseQactions_ (std::vector< MultiDimFunctionGraph< ArgMaxSet< double, Idx >, SetTerminalNodePolicy > *> &) |
Performs argmax_a Q(s,a) More... | |
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. More... | |
Constructor & destructor. | |
AdaptiveRMaxPlaner (IOperatorStrategy< double > *opi, double discountFactor, double epsilon, const ILearningStrategy *learner, bool verbose) | |
Default constructor. More... | |
~AdaptiveRMaxPlaner () | |
Default destructor. More... | |
Incremental methods | |
HashTable< Idx, StatesCounter *> | _counterTable_ |
HashTable< Idx, bool > | _initializedTable_ |
bool | _initialized_ |
void | checkState (const Instantiation &newState, Idx actionId) |
Incremental methods | |
void | setOptimalStrategy (const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > *optPol) |
virtual ActionSet | stateOptimalPolicy (const Instantiation &curState) |
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * | optPol_ |
ActionSet | allActions_ |
<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 53 of file adaptiveRMaxPlaner.h.
|
private |
Default constructor.
Definition at line 63 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::AdaptiveRMaxPlaner::~AdaptiveRMaxPlaner | ( | ) |
Default destructor.
Definition at line 76 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
Definition at line 321 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
Definition at line 222 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
Definition at line 288 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
Perform the R(s) + gamma . function.
Definition at line 395 of file structuredPlaner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
Performs argmax_a Q(s,a)
Definition at line 519 of file structuredPlaner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlinevirtual |
Implements gum::IDecisionStrategy.
Definition at line 198 of file adaptiveRMaxPlaner.h.
|
protectedvirtual |
Perform the required tasks to extract an optimal policy.
Reimplemented from gum::StructuredPlaner< double >.
Definition at line 183 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
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.
References gum::Set< Key, Alloc >::emplace().
|
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.
Definition at line 542 of file structuredPlaner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlineinherited |
Returns a const ptr on the Factored Markov Decision Process on which we're planning.
Definition at line 133 of file structuredPlaner.h.
References gum::StructuredPlaner< GUM_SCALAR >::argmaximiseQactions_().
Initializes data structure needed for making the planning.
Reimplemented from gum::IDecisionStrategy.
Definition at line 96 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtual |
Performs a single step of value iteration.
Reimplemented from gum::StructuredPlaner< double >.
Definition at line 130 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
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
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.
References gum::Set< Key, Alloc >::emplace().
|
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 |
Reimplemented from gum::StructuredPlaner< double >.
Definition at line 111 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
Performs max_a Q(s,a)
Definition at line 356 of file structuredPlaner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
Performs min_i F_i.
Definition at line 375 of file structuredPlaner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlinevirtualinherited |
Returns the best policy obtained so far.
Implements gum::IPlanningStrategy< double >.
Definition at line 148 of file structuredPlaner.h.
References gum::StructuredPlaner< GUM_SCALAR >::argmaximiseQactions_().
|
virtualinherited |
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 104 of file structuredPlaner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlinevirtualinherited |
Returns optimalPolicy computed so far current size.
Implements gum::IPlanningStrategy< double >.
Definition at line 155 of file structuredPlaner.h.
References gum::StructuredPlaner< GUM_SCALAR >::argmaximiseQactions_().
|
inlinestatic |
Definition at line 62 of file adaptiveRMaxPlaner.h.
|
inlineinherited |
Definition at line 89 of file IDecisionStrategy.h.
|
inlinestaticinherited |
Definition at line 79 of file structuredPlaner.h.
|
inlinevirtualinherited |
Reimplemented in gum::E_GreedyDecider, and gum::RandomDecider.
Definition at line 93 of file IDecisionStrategy.h.
|
inlinestaticinherited |
Definition at line 91 of file structuredPlaner.h.
|
inlinestatic |
Definition at line 76 of file adaptiveRMaxPlaner.h.
|
protectedvirtual |
Performs a single step of value iteration.
Reimplemented from gum::StructuredPlaner< double >.
Definition at line 139 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
inlineinherited |
Returns a const ptr on the value function computed so far.
Definition at line 138 of file structuredPlaner.h.
References gum::StructuredPlaner< GUM_SCALAR >::argmaximiseQactions_().
|
inlinevirtualinherited |
Returns vFunction computed so far current size.
Implements gum::IPlanningStrategy< double >.
Definition at line 143 of file structuredPlaner.h.
References gum::StructuredPlaner< GUM_SCALAR >::argmaximiseQactions_().
|
private |
Definition at line 186 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 185 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 207 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 187 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 210 of file adaptiveRMaxPlaner.h.
Definition at line 208 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 190 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 189 of file adaptiveRMaxPlaner.h.
|
protectedinherited |
Definition at line 102 of file IDecisionStrategy.h.
|
protectedinherited |
Discount Factor used for infinite horizon planning.
Definition at line 350 of file structuredPlaner.h.
|
protectedinherited |
A Set to eleminate primed variables.
Definition at line 345 of file structuredPlaner.h.
|
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 325 of file structuredPlaner.h.
|
protectedinherited |
Definition at line 352 of file structuredPlaner.h.
|
protectedinherited |
The associated optimal policy.
Definition at line 340 of file structuredPlaner.h.
|
protectedinherited |
Definition at line 99 of file IDecisionStrategy.h.
|
protectedinherited |
Boolean used to indcates whether or not iteration informations should be displayed on terminal.
Definition at line 358 of file structuredPlaner.h.
|
protectedinherited |
The Value Function computed iteratively.
Definition at line 330 of file structuredPlaner.h.