![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
The general SDyna architecture abstract class. More...
#include <agrum/FMDP/SDyna/sdyna.h>
Public Member Functions | |
| std::string | toString () |
| Returns. | |
| std::string | optimalPolicy2String () |
Problem specification methods | |
| void | addAction (const Idx actionId, const std::string &actionName) |
| Inserts a new action in the SDyna instance. | |
| void | addVariable (const DiscreteVariable *var) |
| Inserts a new variable in the SDyna instance. | |
Initialization | |
| void | initialize () |
| Initializes the Sdyna instance. | |
| void | initialize (const Instantiation &initialState) |
| Initializes the Sdyna instance at given state. | |
Incremental methods | |
| void | setCurrentState (const Instantiation ¤tState) |
| Sets last state visited to the given state. | |
| Idx | takeAction (const Instantiation &curState) |
| Idx | takeAction () |
| void | feedback (const Instantiation &originalState, const Instantiation &reachedState, Idx performedAction, double obtainedReward) |
| Performs a feedback on the last transition. | |
| void | feedback (const Instantiation &reachedState, double obtainedReward) |
| Performs a feedback on the last transition. | |
| void | makePlanning (Idx nbStep) |
| Starts a new planning. | |
Size methods | |
just to get the size of the different data structure for performance evaluation purposes only | |
| Size | learnerSize () |
| learnerSize | |
| Size | modelSize () |
| modelSize | |
| Size | valueFunctionSize () |
| valueFunctionSize | |
| Size | optimalPolicySize () |
| optimalPolicySize | |
Static Public Member Functions | |
| static SDYNA * | spitiInstance (double attributeSelectionThreshold=0.99, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
| @ | |
| static SDYNA * | spimddiInstance (double attributeSelectionThreshold=0.99, double similarityThreshold=0.3, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
| @ | |
| static SDYNA * | RMaxMDDInstance (double attributeSelectionThreshold=0.99, double similarityThreshold=0.3, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
| @ | |
| static SDYNA * | RMaxTreeInstance (double attributeSelectionThreshold=0.99, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
| @ | |
| static SDYNA * | RandomMDDInstance (double attributeSelectionThreshold=0.99, double similarityThreshold=0.3, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
| @ | |
| static SDYNA * | RandomTreeInstance (double attributeSelectionThreshold=0.99, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
| @ | |
Protected Attributes | |
| FMDP< double > * | fmdp_ |
| The learnt Markovian Decision Process. | |
| Instantiation | lastState_ |
| The state in which the system is before we perform a new action. | |
Private Attributes | |
| ILearningStrategy * | _learner_ |
| The learner used to learn the FMDP. | |
| IPlanningStrategy< double > * | _planer_ |
| The planer used to plan an optimal strategy. | |
| IDecisionStrategy * | _decider_ |
| The decider. | |
| Idx | _observationPhaseLenght_ |
| The number of observation we make before using again the planer. | |
| Idx | _nbObservation_ |
| The total number of observation made so far. | |
| Idx | _nbValueIterationStep_ |
| The number of Value Iteration step we perform. | |
| Idx | _lastAction_ |
| The last performed action. | |
| Set< Observation * > | _bin_ |
| Since SDYNA made these observation, it has to delete them on quitting. | |
| bool | _actionReward_ |
| bool | verbose_ |
Constructor & destructor. | |
| SDYNA (ILearningStrategy *learner, IPlanningStrategy< double > *planer, IDecisionStrategy *decider, Idx observationPhaseLenght, Idx nbValueIterationStep, bool actionReward, bool verbose=true) | |
| Constructor. | |
| ~SDYNA () | |
| Destructor. | |
The general SDyna architecture abstract class.
Instance of SDyna architecture should inherit
|
private |
Constructor.
Definition at line 77 of file sdyna.cpp.
References SDYNA(), _actionReward_, _decider_, _learner_, _nbObservation_, _nbValueIterationStep_, _observationPhaseLenght_, _planer_, fmdp_, and verbose_.
Referenced by SDYNA(), ~SDYNA(), RandomMDDInstance(), RandomTreeInstance(), RMaxMDDInstance(), RMaxTreeInstance(), spimddiInstance(), and spitiInstance().
| gum::SDYNA::~SDYNA | ( | ) |
Destructor.
Definition at line 98 of file sdyna.cpp.
References SDYNA(), _bin_, _decider_, _learner_, _planer_, and fmdp_.
|
inline |
|
inline |
Inserts a new variable in the SDyna instance.
| var | : the var to be added. Note that variable may or may not have all its modalities given. If not they will be discovered by the SDyna architecture during the process |
Definition at line 266 of file sdyna.h.
References fmdp_.
| void gum::SDYNA::feedback | ( | const Instantiation & | originalState, |
| const Instantiation & | reachedState, | ||
| Idx | performedAction, | ||
| double | obtainedReward ) |
Performs a feedback on the last transition.
Incremental methods.
In extenso, learn from the transition.
| originalState | : the state we were in before the transition |
| reachedState | : the state we reached after |
| performedAction | : the action we performed |
| obtainedReward | : the reward we obtained |
Definition at line 149 of file sdyna.cpp.
References _lastAction_, feedback(), and lastState_.
Referenced by feedback().
| void gum::SDYNA::feedback | ( | const Instantiation & | reachedState, |
| double | obtainedReward ) |
Performs a feedback on the last transition.
In extenso, learn from the transition.
| reachedState | : the state reached after the transition |
| obtainedReward | : the reward obtained during the transition |
Definition at line 169 of file sdyna.cpp.
References _actionReward_, _bin_, _decider_, _lastAction_, _learner_, _nbObservation_, _nbValueIterationStep_, _observationPhaseLenght_, fmdp_, lastState_, makePlanning(), setCurrentState(), gum::Observation::setModality(), gum::Observation::setReward(), gum::Observation::setRModality(), gum::Instantiation::val(), and gum::Instantiation::variablesSequence().
| void gum::SDYNA::initialize | ( | ) |
| void gum::SDYNA::initialize | ( | const Instantiation & | initialState | ) |
Initializes the Sdyna instance at given state.
| initialState | : the state of the studied system from which we will begin the explore, learn and exploit process |
Definition at line 130 of file sdyna.cpp.
References initialize(), and setCurrentState().
|
inline |
| void gum::SDYNA::makePlanning | ( | Idx | nbStep | ) |
Starts a new planning.
| nbStep | : the maximal number of value iteration performed in this planning |
Definition at line 206 of file sdyna.cpp.
References _decider_, _learner_, _planer_, and verbose_.
Referenced by feedback().
|
inline |
|
inline |
|
inline |
|
inlinestatic |
@
Definition at line 169 of file sdyna.h.
References SDYNA(), and gum::StructuredPlaner< GUM_SCALAR >::spumddInstance().
|
inlinestatic |
@
Definition at line 189 of file sdyna.h.
References SDYNA(), and gum::StructuredPlaner< GUM_SCALAR >::sviInstance().
|
inlinestatic |
@
Definition at line 131 of file sdyna.h.
References SDYNA(), and gum::AdaptiveRMaxPlaner::ReducedAndOrderedInstance().
|
inlinestatic |
@
Definition at line 152 of file sdyna.h.
References SDYNA(), and gum::AdaptiveRMaxPlaner::TreeInstance().
|
inline |
Sets last state visited to the given state.
During the learning process, we will consider that were in this state before the transition.
| currentState | : the state |
Definition at line 310 of file sdyna.h.
References lastState_.
Referenced by feedback(), and initialize().
|
inlinestatic |
@
Definition at line 105 of file sdyna.h.
References SDYNA(), and gum::StructuredPlaner< GUM_SCALAR >::spumddInstance().
|
inlinestatic |
@
Definition at line 87 of file sdyna.h.
References SDYNA(), and gum::StructuredPlaner< GUM_SCALAR >::sviInstance().
| Idx gum::SDYNA::takeAction | ( | ) |
Definition at line 234 of file sdyna.cpp.
References _decider_, _lastAction_, lastState_, gum::randomValue(), and gum::ActionSet::size().
Referenced by takeAction().
| Idx gum::SDYNA::takeAction | ( | const Instantiation & | curState | ) |
| curState | the state in which we currently are |
Definition at line 224 of file sdyna.cpp.
References lastState_, and takeAction().
| std::string gum::SDYNA::toString | ( | ) |
Returns.
|
inline |
|
private |
Definition at line 457 of file sdyna.h.
Referenced by SDYNA(), and feedback().
|
private |
Since SDYNA made these observation, it has to delete them on quitting.
Definition at line 455 of file sdyna.h.
Referenced by ~SDYNA(), and feedback().
|
private |
The decider.
Definition at line 439 of file sdyna.h.
Referenced by SDYNA(), ~SDYNA(), feedback(), initialize(), makePlanning(), and takeAction().
|
private |
The last performed action.
Definition at line 452 of file sdyna.h.
Referenced by feedback(), feedback(), and takeAction().
|
private |
The learner used to learn the FMDP.
Definition at line 433 of file sdyna.h.
Referenced by SDYNA(), ~SDYNA(), feedback(), initialize(), learnerSize(), and makePlanning().
|
private |
The total number of observation made so far.
Definition at line 446 of file sdyna.h.
Referenced by SDYNA(), and feedback().
|
private |
The number of Value Iteration step we perform.
Definition at line 449 of file sdyna.h.
Referenced by SDYNA(), and feedback().
|
private |
The number of observation we make before using again the planer.
Definition at line 443 of file sdyna.h.
Referenced by SDYNA(), and feedback().
|
private |
The planer used to plan an optimal strategy.
Definition at line 436 of file sdyna.h.
Referenced by SDYNA(), ~SDYNA(), initialize(), makePlanning(), optimalPolicy2String(), optimalPolicySize(), toString(), and valueFunctionSize().
The learnt Markovian Decision Process.
Definition at line 426 of file sdyna.h.
Referenced by SDYNA(), ~SDYNA(), addAction(), addVariable(), feedback(), initialize(), modelSize(), and toString().
|
protected |
The state in which the system is before we perform a new action.
Definition at line 429 of file sdyna.h.
Referenced by feedback(), feedback(), setCurrentState(), takeAction(), and takeAction().
|
private |
Definition at line 459 of file sdyna.h.
Referenced by SDYNA(), and makePlanning().