![]() |
aGrUM
0.20.2
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().
|
protectedvirtualinherited |
Perform the R(s) + gamma . function.
Definition at line 409 of file structuredPlaner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
Performs argmax_a Q(s,a)
Definition at line 548 of file structuredPlaner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlinevirtual |
Implements gum::IDecisionStrategy.
Definition at line 201 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 350 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtual |
Perform the required tasks to extract an optimal policy.
Reimplemented from gum::StructuredPlaner< double >.
Definition at line 195 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 353 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 574 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 137 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 97 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 133 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 485 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 114 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
Definition at line 240 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
Performs max_a Q(s,a)
Definition at line 370 of file structuredPlaner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
Performs min_i F_i.
Definition at line 390 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 157 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 105 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 164 of file structuredPlaner.h.
References gum::StructuredPlaner< GUM_SCALAR >::argmaximiseQactions_().
|
inlinestatic |
Definition at line 65 of file adaptiveRMaxPlaner.h.
|
inlineinherited |
Definition at line 90 of file IDecisionStrategy.h.
|
inlinestaticinherited |
Definition at line 80 of file structuredPlaner.h.
|
inlinevirtualinherited |
Reimplemented in gum::E_GreedyDecider, and gum::RandomDecider.
Definition at line 96 of file IDecisionStrategy.h.
|
inlinestaticinherited |
Definition at line 94 of file structuredPlaner.h.
|
inlinestatic |
Definition at line 79 of file adaptiveRMaxPlaner.h.
|
protectedvirtual |
Performs a single step of value iteration.
Reimplemented from gum::StructuredPlaner< double >.
Definition at line 147 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 142 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 149 of file structuredPlaner.h.
References gum::StructuredPlaner< GUM_SCALAR >::argmaximiseQactions_().
|
private |
Definition at line 311 of file adaptiveRMaxPlaner.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
Definition at line 189 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 188 of file adaptiveRMaxPlaner.h.
|
protectedinherited |
Definition at line 106 of file IDecisionStrategy.h.
|
private |
Definition at line 210 of file adaptiveRMaxPlaner.h.
|
protectedinherited |
Discount Factor used for infinite horizon planning.
Definition at line 363 of file structuredPlaner.h.
|
protectedinherited |
A Set to eleminate primed variables.
Definition at line 358 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 338 of file structuredPlaner.h.
|
private |
Definition at line 190 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 213 of file adaptiveRMaxPlaner.h.
Definition at line 211 of file adaptiveRMaxPlaner.h.
|
protectedinherited |
Definition at line 365 of file structuredPlaner.h.
|
protectedinherited |
The associated optimal policy.
Definition at line 353 of file structuredPlaner.h.
|
protectedinherited |
Definition at line 103 of file IDecisionStrategy.h.
|
private |
Definition at line 193 of file adaptiveRMaxPlaner.h.
|
private |
Definition at line 192 of file adaptiveRMaxPlaner.h.
|
protectedinherited |
Boolean used to indcates whether or not iteration informations should be displayed on terminal.
Definition at line 371 of file structuredPlaner.h.
|
protectedinherited |
The Value Function computed iteratively.
Definition at line 343 of file structuredPlaner.h.