![]() |
aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
|
<agrum/FMDP/simulation/fmdpSimulator.h> More...
#include <fmdpSimulator.h>
Public Member Functions | |
Constructors, Destructors. | |
| FMDPSimulator (const FMDP< double > *fmdp) | |
| Default constructor. | |
| FMDPSimulator (std::string_view resource) | |
| Default constructor. | |
| ~FMDPSimulator () override | |
| Default destructor. | |
| double | reward () override |
| Sets the intial statefrom which we begun the simulation. | |
| void | perform (Idx) override |
| Sets the intial statefrom which we begun the simulation. | |
| const DiscreteVariable * | primeVar (const DiscreteVariable *mainVar) override |
| Iteration over the variables of the simulated probleme. | |
| SequenceIteratorSafe< const DiscreteVariable * > | beginVariables () override |
| Iteration over the variables of the simulated probleme. | |
| SequenceIteratorSafe< const DiscreteVariable * > | endVariables () override |
| Iteration over the variables of the simulated probleme. | |
| const std::string & | actionName (Idx actionId) override |
| Iteration over the variables of the simulated probleme. | |
| SequenceIteratorSafe< Idx > | beginActions () override |
| Iteration over the variables of the simulated probleme. | |
| SequenceIteratorSafe< Idx > | endActions () override |
| Iteration over the variables of the simulated probleme. | |
Public Attributes | |
| Instantiation | currentState_ |
| Tha state in which the system currently is. | |
| Instantiation | endState_ |
Protected Member Functions | |
| virtual double | transitionProbability_ (const DiscreteVariable *var, const Instantiation &transit, Idx actionId) |
Private Attributes | |
| FMDP< double > * | _fmdp_ |
| The Factored Markov Decision Process that describes how the system evolves. | |
| const bool | _loaded_ |
| Just to know if it should be deleted in the end. | |
| void | setInitialState (const Instantiation &initialState) |
| Sets the intial statefrom which we begun the simulation. | |
| void | setInitialStateRandomly () |
| Sets the intial statefrom which we begun the simulation. | |
| void | setEndState (const Instantiation &endState) |
| Sets the final states upon which a run is over. | |
| virtual bool | hasReachEnd () |
| Tests if end state has been reached. | |
| const Instantiation & | currentState () |
| Sets the intial statefrom which we begun the simulation. | |
| virtual Instantiation | randomState_ () |
| Choses a random state as the first test for a run. | |
<agrum/FMDP/simulation/fmdpSimulator.h>
A class to simulate a Factored Markov Decision Process.
Definition at line 67 of file fmdpSimulator.h.
Default constructor.
Definition at line 73 of file fmdpSimulator.cpp.
References gum::AbstractSimulator::AbstractSimulator(), FMDPSimulator(), _fmdp_, and _loaded_.
Referenced by FMDPSimulator(), FMDPSimulator(), and ~FMDPSimulator().
| gum::FMDPSimulator::FMDPSimulator | ( | std::string_view | resource | ) |
Default constructor.
Definition at line 78 of file fmdpSimulator.cpp.
References gum::AbstractSimulator::AbstractSimulator(), FMDPSimulator(), _fmdp_, _loaded_, gum::FMDPDatReader< GUM_ELEMENT >::proceed(), and gum::FMDPDatReader< GUM_ELEMENT >::trace().
|
override |
Default destructor.
Definition at line 90 of file fmdpSimulator.cpp.
References FMDPSimulator(), _fmdp_, and _loaded_.
|
overridevirtual |
Iteration over the variables of the simulated probleme.
Implements gum::AbstractSimulator.
Definition at line 62 of file fmdpSimulator_inl.h.
References _fmdp_.
|
overridevirtual |
Iteration over the variables of the simulated probleme.
Implements gum::AbstractSimulator.
Definition at line 66 of file fmdpSimulator_inl.h.
References _fmdp_.
|
overridevirtual |
Iteration over the variables of the simulated probleme.
Implements gum::AbstractSimulator.
Definition at line 54 of file fmdpSimulator_inl.h.
References _fmdp_.
Referenced by perform().
|
inherited |
Sets the intial statefrom which we begun the simulation.
Definition at line 56 of file abstractSimulator_inl.h.
References currentState_.
|
overridevirtual |
Iteration over the variables of the simulated probleme.
Implements gum::AbstractSimulator.
Definition at line 70 of file fmdpSimulator_inl.h.
References _fmdp_.
|
overridevirtual |
Iteration over the variables of the simulated probleme.
Implements gum::AbstractSimulator.
Definition at line 58 of file fmdpSimulator_inl.h.
References _fmdp_.
Referenced by perform().
|
virtualinherited |
Tests if end state has been reached.
Reimplemented in gum::FactorySimulator, and gum::TaxiSimulator.
Definition at line 104 of file abstractSimulator.cpp.
References currentState_, and endState_.
Referenced by setInitialStateRandomly().
|
overridevirtual |
Sets the intial statefrom which we begun the simulation.
Implements gum::AbstractSimulator.
Definition at line 99 of file fmdpSimulator.cpp.
References gum::Instantiation::add(), beginVariables(), gum::Instantiation::chgVal(), gum::AbstractSimulator::currentState_, gum::Instantiation::end(), endVariables(), gum::Instantiation::incOut(), primeVar(), gum::randomProba(), gum::Instantiation::setFirstOut(), transitionProbability_(), and gum::Instantiation::val().
|
overridevirtual |
Iteration over the variables of the simulated probleme.
Implements gum::AbstractSimulator.
Definition at line 50 of file fmdpSimulator_inl.h.
References _fmdp_.
Referenced by perform().
|
protectedvirtualinherited |
Choses a random state as the first test for a run.
Reimplemented in gum::FactorySimulator, and gum::TaxiSimulator.
Definition at line 94 of file abstractSimulator.cpp.
References gum::Instantiation::add(), beginVariables(), gum::Instantiation::chgVal(), endVariables(), and gum::randomValue().
Referenced by gum::TaxiSimulator::randomState_(), and setInitialStateRandomly().
|
overridevirtual |
Sets the intial statefrom which we begun the simulation.
Implements gum::AbstractSimulator.
Definition at line 48 of file fmdpSimulator_inl.h.
References _fmdp_, and gum::AbstractSimulator::currentState_.
|
inherited |
Sets the final states upon which a run is over.
Definition at line 52 of file abstractSimulator_inl.h.
References endState_.
|
inherited |
Sets the intial statefrom which we begun the simulation.
Definition at line 48 of file abstractSimulator_inl.h.
References currentState_.
|
inherited |
Sets the intial statefrom which we begun the simulation.
Definition at line 86 of file abstractSimulator.cpp.
References currentState_, hasReachEnd(), and randomState_().
|
protectedvirtual |
Definition at line 72 of file fmdpSimulator_inl.h.
References _fmdp_, and gum::MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy >::get().
Referenced by perform().
The Factored Markov Decision Process that describes how the system evolves.
Definition at line 135 of file fmdpSimulator.h.
Referenced by FMDPSimulator(), FMDPSimulator(), ~FMDPSimulator(), actionName(), beginActions(), beginVariables(), endActions(), endVariables(), primeVar(), reward(), and transitionProbability_().
|
private |
Just to know if it should be deleted in the end.
Definition at line 138 of file fmdpSimulator.h.
Referenced by FMDPSimulator(), FMDPSimulator(), and ~FMDPSimulator().
|
inherited |
Tha state in which the system currently is.
Definition at line 146 of file abstractSimulator.h.
Referenced by gum::TaxiSimulator::_evalReward_(), gum::TaxiSimulator::_performFillUp_(), gum::TaxiSimulator::_performGoEast_(), gum::TaxiSimulator::_performGoNorth_(), gum::TaxiSimulator::_performGoSouth_(), gum::TaxiSimulator::_performGoWest_(), gum::TaxiSimulator::_performPickUp_(), gum::TaxiSimulator::_performPutDown_(), currentState(), hasReachEnd(), gum::FMDPSimulator::perform(), gum::TaxiSimulator::perform(), gum::FMDPSimulator::reward(), setInitialState(), and setInitialStateRandomly().
|
inherited |
Definition at line 146 of file abstractSimulator.h.
Referenced by hasReachEnd(), and setEndState().