![]() |
aGrUM
0.16.0
|
The general SDyna architecture abstract class. More...
#include <agrum/FMDP/SDyna/sdyna.h>
Public Member Functions | |
std::string | toString () |
Returns. More... | |
std::string | optimalPolicy2String () |
Problem specification methods | |
void | addAction (const Idx actionId, const std::string &actionName) |
Inserts a new action in the SDyna instance. More... | |
void | addVariable (const DiscreteVariable *var) |
Inserts a new variable in the SDyna instance. More... | |
Initialization | |
void | initialize () |
Initializes the Sdyna instance. More... | |
void | initialize (const Instantiation &initialState) |
Initializes the Sdyna instance at given state. More... | |
Incremental methods | |
void | setCurrentState (const Instantiation ¤tState) |
Sets last state visited to the given state. More... | |
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. More... | |
void | feedback (const Instantiation &reachedState, double obtainedReward) |
Performs a feedback on the last transition. More... | |
void | makePlanning (Idx nbStep) |
Starts a new planning. More... | |
Size methods | |
just to get the size of the different data structure for performance evaluation purposes only | |
Size | learnerSize () |
learnerSize More... | |
Size | modelSize () |
modelSize More... | |
Size | valueFunctionSize () |
valueFunctionSize More... | |
Size | optimalPolicySize () |
optimalPolicySize More... | |
Static Public Member Functions | |
static SDYNA * | spitiInstance (double attributeSelectionThreshold=0.99, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
@ More... | |
static SDYNA * | spimddiInstance (double attributeSelectionThreshold=0.99, double similarityThreshold=0.3, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
@ More... | |
static SDYNA * | RMaxMDDInstance (double attributeSelectionThreshold=0.99, double similarityThreshold=0.3, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
@ More... | |
static SDYNA * | RMaxTreeInstance (double attributeSelectionThreshold=0.99, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
@ More... | |
static SDYNA * | RandomMDDInstance (double attributeSelectionThreshold=0.99, double similarityThreshold=0.3, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
@ More... | |
static SDYNA * | RandomTreeInstance (double attributeSelectionThreshold=0.99, double discountFactor=0.9, double epsilon=1, Idx observationPhaseLenght=100, Idx nbValueIterationStep=10) |
@ More... | |
Protected Attributes | |
FMDP< double > * | _fmdp |
The learnt Markovian Decision Process. More... | |
Instantiation | _lastState |
The state in which the system is before we perform a new action. More... | |
Constructor & destructor. | |
SDYNA (ILearningStrategy *learner, IPlanningStrategy< double > *planer, IDecisionStrategy *decider, Idx observationPhaseLenght, Idx nbValueIterationStep, bool actionReward, bool verbose=true) | |
Constructor. More... | |
~SDYNA () | |
Destructor. More... | |
The general SDyna architecture abstract class.
Instance of SDyna architecture should inherit
|
private |
Constructor.
Definition at line 57 of file sdyna.cpp.
References __nbObservation, and _fmdp.
Referenced by RandomMDDInstance(), RandomTreeInstance(), RMaxMDDInstance(), RMaxTreeInstance(), spimddiInstance(), and spitiInstance().
gum::SDYNA::~SDYNA | ( | ) |
Destructor.
Definition at line 79 of file sdyna.cpp.
References __bin, __decider, __learner, __planer, and _fmdp.
Referenced by RandomTreeInstance().
|
inline |
Inserts a new action in the SDyna instance.
actionId | : an id to identify the action |
actionName | : its human name |
Definition at line 236 of file sdyna.h.
References _fmdp, and gum::FMDP< GUM_SCALAR >::addAction().
|
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 250 of file sdyna.h.
References _fmdp, gum::FMDP< GUM_SCALAR >::addVariable(), and initialize().
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 130 of file sdyna.cpp.
References __lastAction, and _lastState.
Referenced by setCurrentState().
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 150 of file sdyna.cpp.
References __actionReward, __bin, __decider, __lastAction, __learner, __nbObservation, __nbValueIterationStep, __observationPhaseLenght, _fmdp, _lastState, gum::ILearningStrategy::addObservation(), gum::IDecisionStrategy::checkState(), gum::FMDP< GUM_SCALAR >::main2prime(), makePlanning(), setCurrentState(), gum::Observation::setModality(), gum::Observation::setReward(), gum::Observation::setRModality(), gum::Instantiation::val(), and gum::Instantiation::variablesSequence().
void gum::SDYNA::initialize | ( | ) |
Initializes the Sdyna instance.
Definition at line 98 of file sdyna.cpp.
References __decider, __learner, __planer, _fmdp, gum::IDecisionStrategy::initialize(), gum::IPlanningStrategy< GUM_SCALAR >::initialize(), and gum::ILearningStrategy::initialize().
Referenced by addVariable(), and 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 111 of file sdyna.cpp.
References initialize(), and setCurrentState().
|
inline |
learnerSize
Definition at line 379 of file sdyna.h.
References __learner, and gum::ILearningStrategy::size().
void gum::SDYNA::makePlanning | ( | Idx | nbStep | ) |
Starts a new planning.
nbStep | : the maximal number of value iteration performed in this planning |
Definition at line 190 of file sdyna.cpp.
References __decider, __learner, __planer, _verbose, gum::IPlanningStrategy< GUM_SCALAR >::makePlanning(), gum::IPlanningStrategy< GUM_SCALAR >::optimalPolicy(), gum::IDecisionStrategy::setOptimalStrategy(), and gum::ILearningStrategy::updateFMDP().
Referenced by feedback(), and setCurrentState().
|
inline |
modelSize
Definition at line 387 of file sdyna.h.
References _fmdp, and gum::FMDP< GUM_SCALAR >::size().
|
inline |
Definition at line 363 of file sdyna.h.
References __planer, and gum::IPlanningStrategy< GUM_SCALAR >::optimalPolicy2String().
|
inline |
optimalPolicySize
Definition at line 403 of file sdyna.h.
References __planer, and gum::IPlanningStrategy< GUM_SCALAR >::optimalPolicySize().
|
inlinestatic |
@
Definition at line 156 of file sdyna.h.
References SDYNA(), and gum::StructuredPlaner< GUM_SCALAR >::spumddInstance().
|
inlinestatic |
@
Definition at line 175 of file sdyna.h.
References SDYNA(), gum::StructuredPlaner< GUM_SCALAR >::sviInstance(), and ~SDYNA().
|
inlinestatic |
@
Definition at line 117 of file sdyna.h.
References gum::AdaptiveRMaxPlaner::ReducedAndOrderedInstance(), and SDYNA().
|
inlinestatic |
@
Definition at line 137 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 292 of file sdyna.h.
References _lastState, feedback(), makePlanning(), takeAction(), and toString().
Referenced by feedback(), and initialize().
|
inlinestatic |
@
Definition at line 93 of file sdyna.h.
References SDYNA(), and gum::StructuredPlaner< GUM_SCALAR >::spumddInstance().
|
inlinestatic |
@
Definition at line 75 of file sdyna.h.
References SDYNA(), and gum::StructuredPlaner< GUM_SCALAR >::sviInstance().
Idx gum::SDYNA::takeAction | ( | const Instantiation & | curState | ) |
curState | the state in which we currently are |
Definition at line 208 of file sdyna.cpp.
References _lastState, and takeAction().
Idx gum::SDYNA::takeAction | ( | ) |
Definition at line 218 of file sdyna.cpp.
References __decider, __lastAction, _lastState, gum::ActionSet::size(), and gum::IDecisionStrategy::stateOptimalPolicy().
Referenced by setCurrentState(), and takeAction().
std::string gum::SDYNA::toString | ( | ) |
Returns.
Definition at line 232 of file sdyna.cpp.
References __planer, _fmdp, gum::IPlanningStrategy< GUM_SCALAR >::optimalPolicy2String(), and gum::FMDP< GUM_SCALAR >::toString().
Referenced by setCurrentState().
|
inline |
valueFunctionSize
Definition at line 395 of file sdyna.h.
References __planer, and gum::IPlanningStrategy< GUM_SCALAR >::vFunctionSize().
|
private |
Definition at line 441 of file sdyna.h.
Referenced by feedback().
|
private |
Since SDYNA made these observation, it has to delete them on quitting.
Definition at line 439 of file sdyna.h.
Referenced by feedback(), and ~SDYNA().
|
private |
The decider.
Definition at line 423 of file sdyna.h.
Referenced by feedback(), initialize(), makePlanning(), takeAction(), and ~SDYNA().
|
private |
The last performed action.
Definition at line 436 of file sdyna.h.
Referenced by feedback(), and takeAction().
|
private |
The learner used to learn the FMDP.
Definition at line 417 of file sdyna.h.
Referenced by feedback(), initialize(), learnerSize(), makePlanning(), and ~SDYNA().
|
private |
The total number of observation made so far.
Definition at line 430 of file sdyna.h.
Referenced by feedback(), and SDYNA().
|
private |
The number of Value Iteration step we perform.
Definition at line 433 of file sdyna.h.
Referenced by feedback().
|
private |
The number of observation we make before using again the planer.
Definition at line 427 of file sdyna.h.
Referenced by feedback().
|
private |
The planer used to plan an optimal strategy.
Definition at line 420 of file sdyna.h.
Referenced by initialize(), makePlanning(), optimalPolicy2String(), optimalPolicySize(), toString(), valueFunctionSize(), and ~SDYNA().
The learnt Markovian Decision Process.
Definition at line 410 of file sdyna.h.
Referenced by addAction(), addVariable(), feedback(), initialize(), modelSize(), SDYNA(), toString(), and ~SDYNA().
|
protected |
The state in which the system is before we perform a new action.
Definition at line 413 of file sdyna.h.
Referenced by feedback(), setCurrentState(), and takeAction().
|
private |
Definition at line 443 of file sdyna.h.
Referenced by makePlanning().