84 Idx observationPhaseLenght,
85 Idx nbValueIterationStep,
92 GUM_CONSTRUCTOR(
SDYNA);
109 for (
auto obsIter =
_bin_.beginSafe(); obsIter !=
_bin_.endSafe(); ++obsIter)
114 GUM_DESTRUCTOR(
SDYNA);
211 if (
verbose_) std::cout <<
"Updating decision trees ..." << std::endl;
215 if (
verbose_) std::cout <<
"Planning ..." << std::endl;
240 if (actionSet.
size() == 1) {
A class to store the optimal actions.
Size size() const
Gives the size.
const DiscreteVariable * main2prime(const DiscreteVariable *mainVar) const
Returns the primed variable associate to the given main variable.
std::string toString() const
Displays the FMDP in a Dot format.
<agrum/FMDP/SDyna/IDecisionStrategy.h>
virtual void checkState(const Instantiation &newState, Idx actionId)=0
virtual void initialize(const FMDP< double > *fmdp)
Initializes the learner.
void setOptimalStrategy(MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > *optPol)
virtual ActionSet stateOptimalPolicy(const Instantiation &curState)
<agrum/FMDP/SDyna/ILearningStrategy.h>
virtual void initialize(FMDP< double > *fmdp)=0
Initializes the learner.
virtual void updateFMDP()=0
Starts an update of datastructure in the associated FMDP.
virtual bool addObservation(Idx actionId, const Observation *obs)=0
Gives to the learner a new transition.
virtual MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * optimalPolicy()=0
Returns optimalPolicy computed so far current size.
virtual std::string optimalPolicy2String()=0
Returns a string describing the optimal policy in a dot format.
virtual void makePlanning(Idx nbIte)=0
Starts a new planning.
virtual void initialize(const FMDP< GUM_SCALAR > *fmdp)=0
Initializes the learner.
Class for assigning/browsing values to tuples of discrete variables.
const Sequence< const DiscreteVariable * > & variablesSequence() const final
Returns the sequence of DiscreteVariable of this instantiation.
Idx val(Idx i) const
Returns the current value of the variable at position i.
void setReward(double reward)
Returns the modality assumed by the given variable in this observation.
void setRModality(const DiscreteVariable *var, Idx modality)
Returns the modality assumed by the given variable in this observation.
Observation()
Default constructor.
void setModality(const DiscreteVariable *var, Idx modality)
Sets the modality assumed by the given variable in this observation.
void initialize()
Initializes the Sdyna instance.
ILearningStrategy * _learner_
The learner used to learn the FMDP.
Idx _lastAction_
The last performed action.
Idx _nbValueIterationStep_
The number of Value Iteration step we perform.
Instantiation lastState_
The state in which the system is before we perform a new action.
void setCurrentState(const Instantiation ¤tState)
Sets last state visited to the given state.
IPlanningStrategy< double > * _planer_
The planer used to plan an optimal strategy.
FMDP< double > * fmdp_
The learnt Markovian Decision Process.
Set< Observation * > _bin_
Since SDYNA made these observation, it has to delete them on quitting.
Idx _nbObservation_
The total number of observation made so far.
IDecisionStrategy * _decider_
The decider.
Idx takeAction(const Instantiation &curState)
std::string toString()
Returns.
void feedback(const Instantiation &originalState, const Instantiation &reachedState, Idx performedAction, double obtainedReward)
Performs a feedback on the last transition.
void makePlanning(Idx nbStep)
Starts a new planning.
Idx _observationPhaseLenght_
The number of observation we make before using again the planer.
SDYNA(ILearningStrategy *learner, IPlanningStrategy< double > *planer, IDecisionStrategy *decider, Idx observationPhaseLenght, Idx nbValueIterationStep, bool actionReward, bool verbose=true)
Constructor.
Size Idx
Type for indexes.
GUM_SHARED_PUBLIC Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
gum is the global namespace for all aGrUM entities
Headers of the SDyna abstract class.