aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
gum::FMDP< GUM_ELEMENT > Class Template Reference

This class is used to implement factored decision process. More...

#include <fmdp.h>

Collaboration diagram for gum::FMDP< GUM_ELEMENT >:

Public Member Functions

Constructors, Destructors.
 FMDP (bool onDestructionDeleteVar=false)
 Default constructor.
 ~FMDP ()
 Default destructor.
Variable Handling Methods.
void addVariable (const DiscreteVariable *var)
 Adds a variable to FMDP description.
SequenceIteratorSafe< const DiscreteVariable * > beginVariables () const
 Returns an iterator reference to he beginning of the list of variables.
SequenceIteratorSafe< const DiscreteVariable * > endVariables () const
 Returns an iterator reference to the end of the list of variables.
const DiscreteVariablemain2prime (const DiscreteVariable *mainVar) const
 Returns the primed variable associate to the given main variable.
const Bijection< const DiscreteVariable *, const DiscreteVariable * > & mapMainPrime () const
 Returns the map binding main variables and prime variables.
Action Handling Methods.
void addAction (Idx actionId, std::string_view action)
 Adds an action to FMDP description.
SequenceIteratorSafe< IdxbeginActions () const
 Returns an iterator reference to he beginning of the list of actions.
SequenceIteratorSafe< IdxendActions () const
 Returns an iterator reference to the end of the list of actions.
Transition methods.
void addTransitionForAction (Idx actionId, const DiscreteVariable *var, const MultiDimImplementation< GUM_ELEMENT > *transition)
 Adds a variable transition table to specified action.
void addTransition (const DiscreteVariable *var, const MultiDimImplementation< GUM_ELEMENT > *transition)
 Adds a default variable transition.
const MultiDimImplementation< GUM_ELEMENT > * transition (Idx actionId, const DiscreteVariable *v) const
 Returns transition associated to given in parameter variable and the given action.
Cost methods.
void addCostForAction (Idx actionId, const MultiDimImplementation< GUM_ELEMENT > *cost)
 Adds a cost table to specified action.
void addCost (const MultiDimImplementation< GUM_ELEMENT > *cost)
 Adds a default variable cost.
const MultiDimImplementation< GUM_ELEMENT > * cost (Idx actionId=0) const
 Returns the reward table of mdp.
Reward methods.
void addRewardForAction (Idx actionId, const MultiDimImplementation< GUM_ELEMENT > *reward)
 Adds a default variable reward.
void addReward (const MultiDimImplementation< GUM_ELEMENT > *reward)
 Adds a default variable reward.
const MultiDimImplementation< GUM_ELEMENT > * reward (Idx actionId=0) const
 Returns the reward table of mdp.
FMPD miscelleanous methods.
const std::string & actionName (Idx actionId) const
 Returns name of action given in parameter.
Idx actionId (std::string_view) const
 Returns action id.
std::string toString () const
 Displays the FMDP in a Dot format.
Size size () const
 Returns the map binding main variables and prime variables.
void setDeleteVariablesOnDestruction (bool b)
 Transfers ownership of variables to this FMDP (they will be deleted on destruction).
void setDiscount (GUM_ELEMENT discount)
 Sets the discount factor.
GUM_ELEMENT discount () const
 Returns the discount factor.

Private Types

template<typename GUM_ELEMENT_O>
using VarTransitionTable = HashTable< const DiscreteVariable*, const MultiDimImplementation< GUM_ELEMENT_O >* >

Private Attributes

Sequence< const DiscreteVariable * > _varSeq_
 Sequence de variables and its iterator.
Sequence< Idx_actionSeq_
Bijection< const DiscreteVariable *, const DiscreteVariable * > _main2primed_
 Mapping from a main variable to its associated primed version.
Bijection< Idx, const std::string * > _actionMap_
 Bijection mapping an action name to its id.
HashTable< Idx, VarTransitionTable< GUM_ELEMENT > * > _actionTransitionTable_
 Table which give for each action a table containing variables transition cpt.
HashTable< Idx, const MultiDimImplementation< GUM_ELEMENT > * > _actionCostTable_
 Table which give for each action cost table.
HashTable< Idx, const MultiDimImplementation< GUM_ELEMENT > * > _actionRewardTable_
 Table which give for each action reward table.
bool _onDestructionDeleteVars_
 Boolean indicates whether or not main variables should be deleted on destruction of this instance Usually the case when fmdp has been initialized with the factory.
GUM_ELEMENT _discount_ {GUM_ELEMENT(1)}

Detailed Description

template<typename GUM_ELEMENT>
class gum::FMDP< GUM_ELEMENT >

This class is used to implement factored decision process.

This class supports a mechanism which allows user to give, for each variable ivolved in the process, a default transition probability table and to describe for specific actions a different table.

Definition at line 75 of file fmdp.h.

Member Typedef Documentation

◆ VarTransitionTable

template<typename GUM_ELEMENT>
template<typename GUM_ELEMENT_O>
using gum::FMDP< GUM_ELEMENT >::VarTransitionTable = HashTable< const DiscreteVariable*, const MultiDimImplementation< GUM_ELEMENT_O >* >
private

Definition at line 77 of file fmdp.h.

Constructor & Destructor Documentation

◆ FMDP()

template<typename GUM_ELEMENT>
gum::FMDP< GUM_ELEMENT >::FMDP ( bool onDestructionDeleteVar = false)

Default constructor.

Definition at line 75 of file fmdp_tpl.h.

75 {
78
79 // Default Action initialisation
80 _actionMap_.insert(0, new std::string("DEFAULT"));
82 _actionCostTable_.insert(0, nullptr);
83 _actionRewardTable_.insert(0, nullptr);
84 }
This class is used to implement factored decision process.
Definition fmdp.h:75
Bijection< Idx, const std::string * > _actionMap_
Bijection mapping an action name to its id.
Definition fmdp.h:286
HashTable< Idx, const MultiDimImplementation< GUM_ELEMENT > * > _actionRewardTable_
Table which give for each action reward table.
Definition fmdp.h:296
HashTable< Idx, const MultiDimImplementation< GUM_ELEMENT > * > _actionCostTable_
Table which give for each action cost table.
Definition fmdp.h:293
FMDP(bool onDestructionDeleteVar=false)
Default constructor.
Definition fmdp_tpl.h:75
bool _onDestructionDeleteVars_
Boolean indicates whether or not main variables should be deleted on destruction of this instance Usu...
Definition fmdp.h:301
HashTable< const DiscreteVariable *, const MultiDimImplementation< GUM_ELEMENT_O > * > VarTransitionTable
Definition fmdp.h:77
HashTable< Idx, VarTransitionTable< GUM_ELEMENT > * > _actionTransitionTable_
Table which give for each action a table containing variables transition cpt.
Definition fmdp.h:290

References FMDP(), _actionCostTable_, _actionMap_, _actionRewardTable_, _actionTransitionTable_, and _onDestructionDeleteVars_.

Referenced by FMDP(), and cost().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~FMDP()

template<typename GUM_ELEMENT>
gum::FMDP< GUM_ELEMENT >::~FMDP ( )

Default destructor.

Definition at line 90 of file fmdp_tpl.h.

90 {
91 // Action Transition Graph deletion
92 for (auto iterA = _actionTransitionTable_.beginSafe();
93 iterA != _actionTransitionTable_.endSafe();
94 ++iterA) {
95 if (iterA.val()) {
96 for (auto iterH = (iterA.val())->beginSafe(); iterH != (iterA.val())->endSafe(); ++iterH)
97 if (iterH.val()) delete iterH.val();
98 delete iterA.val();
99 }
100 }
101
102 // Action cost graph deletion
103 for (auto iterA = _actionCostTable_.beginSafe(); iterA != _actionCostTable_.endSafe(); ++iterA)
104 if (iterA.val()) delete iterA.val();
105
106 // Action reward graph deletion
107 for (auto iterA = _actionRewardTable_.beginSafe(); iterA != _actionRewardTable_.endSafe();
108 ++iterA)
109 if (iterA.val()) delete iterA.val();
110
111 // Action Name deletion
112 for (auto iterId = _actionMap_.beginSafe(); iterId != _actionMap_.endSafe(); ++iterId)
113 delete iterId.second();
114
115 // Primed Variables deletion
116 for (auto varIter = _main2primed_.beginSafe(); varIter != _main2primed_.endSafe(); ++varIter) {
117 delete varIter.second();
118 if (_onDestructionDeleteVars_) delete varIter.first();
119 }
120
122 }
Bijection< const DiscreteVariable *, const DiscreteVariable * > _main2primed_
Mapping from a main variable to its associated primed version.
Definition fmdp.h:283

References _actionTransitionTable_.

Member Function Documentation

◆ actionId()

template<typename GUM_ELEMENT>
Idx gum::FMDP< GUM_ELEMENT >::actionId ( std::string_view action) const

Returns action id.

Definition at line 336 of file fmdp_tpl.h.

336 {
338 actIter != _actionMap_.end();
339 ++actIter)
340 if (*(actIter.second()) == action) { return actIter.first(); }
341
342 GUM_ERROR(NotFound, " Action " << action << " has not been declared before.")
343 }
#define GUM_ERROR(type, msg)
Definition exceptions.h:76

References _actionMap_, and GUM_ERROR.

Referenced by actionName(), addAction(), addCostForAction(), addRewardForAction(), addTransitionForAction(), cost(), reward(), and transition().

Here is the caller graph for this function:

◆ actionName()

template<typename GUM_ELEMENT>
const std::string & gum::FMDP< GUM_ELEMENT >::actionName ( Idx actionId) const

Returns name of action given in parameter.

Definition at line 325 of file fmdp_tpl.h.

325 {
326 if (!_actionMap_.existsFirst(actionId))
327 GUM_ERROR(NotFound, "No action with " << actionId << " as identifiant.")
328
330 }
Idx actionId(std::string_view) const
Returns action id.
Definition fmdp_tpl.h:336

References _actionMap_, actionId(), and GUM_ERROR.

Referenced by addRewardForAction(), reward(), and transition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addAction()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::addAction ( Idx actionId,
std::string_view action )

Adds an action to FMDP description.

Exceptions
DuplicateElementif an action with same name already exists

Definition at line 164 of file fmdp_tpl.h.

164 {
165 if (actionId == 0) GUM_ERROR(DuplicateElement, " Action Id 0 is reserved.")
166
169 ++actIter)
170 if (*(actIter.second()) == action)
172 " Action " << action << " has already been inserted in FMDP with this name.");
173
176 " An action with same id (" << actionId << ") has already been inserted.");
177
179
183
185 }
Sequence< Idx > _actionSeq_
Definition fmdp.h:280

References _actionMap_, actionId(), and GUM_ERROR.

Here is the call graph for this function:

◆ addCost()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::addCost ( const MultiDimImplementation< GUM_ELEMENT > * cost)

Adds a default variable cost.

Exceptions
DuplicateElementif a default cost exists already

Definition at line 430 of file fmdp_tpl.h.

430 {
431 this->addCostForAction(0, cost);
432 }
void addCostForAction(Idx actionId, const MultiDimImplementation< GUM_ELEMENT > *cost)
Adds a cost table to specified action.
Definition fmdp_tpl.h:250
const MultiDimImplementation< GUM_ELEMENT > * cost(Idx actionId=0) const
Returns the reward table of mdp.
Definition fmdp_tpl.h:266

References addCostForAction(), and cost().

Here is the call graph for this function:

◆ addCostForAction()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::addCostForAction ( Idx actionId,
const MultiDimImplementation< GUM_ELEMENT > * cost )

Adds a cost table to specified action.

Exceptions
NotFoundif action does not exists

Definition at line 250 of file fmdp_tpl.h.

251 {
252 if (!_actionCostTable_.exists(actionId))
253 GUM_ERROR(NotFound, " Action " << actionName(actionId) << " has not been declared before.");
254
255 if (_actionCostTable_[actionId] != nullptr)
256 GUM_ERROR(DuplicateElement, " Action " << actionName(actionId) << " already has a cost table")
257
259 }
const std::string & actionName(Idx actionId) const
Returns name of action given in parameter.
Definition fmdp_tpl.h:325

References actionId().

Referenced by addCost().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addReward()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::addReward ( const MultiDimImplementation< GUM_ELEMENT > * reward)

Adds a default variable reward.

Exceptions
DuplicateElementif a default reward exists already

Definition at line 435 of file fmdp_tpl.h.

435 {
436 this->addRewardForAction(0, reward);
437 }
void addRewardForAction(Idx actionId, const MultiDimImplementation< GUM_ELEMENT > *reward)
Adds a default variable reward.
Definition fmdp_tpl.h:288
const MultiDimImplementation< GUM_ELEMENT > * reward(Idx actionId=0) const
Returns the reward table of mdp.
Definition fmdp_tpl.h:305

References addRewardForAction(), and reward().

Here is the call graph for this function:

◆ addRewardForAction()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::addRewardForAction ( Idx actionId,
const MultiDimImplementation< GUM_ELEMENT > * reward )

Adds a default variable reward.

Exceptions
DuplicateElementif a default reward exists already

Definition at line 288 of file fmdp_tpl.h.

289 {
290 if (!_actionRewardTable_.exists(actionId))
291 GUM_ERROR(NotFound, " Action " << actionName(actionId) << " has not been declared before.");
292
293 if (_actionRewardTable_[actionId] != nullptr)
295 " Action " << actionName(actionId) << " already has a reward table");
296
298 }

References _actionRewardTable_, actionId(), actionName(), GUM_ERROR, and reward().

Referenced by addReward().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addTransition()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::addTransition ( const DiscreteVariable * var,
const MultiDimImplementation< GUM_ELEMENT > * transition )

Adds a default variable transition.

Exceptions
NotFoundif var does not exists
DuplicateElementif variable already has a default transition

Definition at line 424 of file fmdp_tpl.h.

425 {
427 }
void addTransitionForAction(Idx actionId, const DiscreteVariable *var, const MultiDimImplementation< GUM_ELEMENT > *transition)
Adds a variable transition table to specified action.
Definition fmdp_tpl.h:202
const MultiDimImplementation< GUM_ELEMENT > * transition(Idx actionId, const DiscreteVariable *v) const
Returns transition associated to given in parameter variable and the given action.
Definition fmdp_tpl.h:226

References addTransitionForAction(), and transition().

Here is the call graph for this function:

◆ addTransitionForAction()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::addTransitionForAction ( Idx actionId,
const DiscreteVariable * var,
const MultiDimImplementation< GUM_ELEMENT > * transition )

Adds a variable transition table to specified action.

Exceptions
NotFoundif action or var does not exists
DuplicateElementif variable already has a transition for this action

Definition at line 202 of file fmdp_tpl.h.

205 {
206 if (!_varSeq_.exists(var))
207 GUM_ERROR(NotFound, " Variable " << var->name() << " has not been declared before.")
208
210 GUM_ERROR(NotFound, " Action " << actionName(actionId) << " has not been declared before.");
211
214 " Variable " << var->name() << " already has a transition table in " << actionId
215 << " table.");
216
218 }
Sequence< const DiscreteVariable * > _varSeq_
Sequence de variables and its iterator.
Definition fmdp.h:278

References actionId().

Referenced by addTransition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addVariable()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::addVariable ( const DiscreteVariable * var)

Adds a variable to FMDP description.

Exceptions
DuplicateElementif a similar variable already exists

Definition at line 137 of file fmdp_tpl.h.

137 {
138 if (_varSeq_.exists(var))
140 " Variable " << var->name() << " has already been inserted in FMDP.");
141
142
143 _varSeq_.insert(var);
144
145 // Prime version creation
146 DiscreteVariable* primeVar = var->clone();
147 primeVar->setName(var->name() + "'");
148 _main2primed_.insert(var, primeVar);
149 }

References _varSeq_.

◆ beginActions()

template<typename GUM_ELEMENT>
SequenceIteratorSafe< Idx > gum::FMDP< GUM_ELEMENT >::beginActions ( ) const

Returns an iterator reference to he beginning of the list of actions.

Definition at line 414 of file fmdp_tpl.h.

414 {
415 return _actionSeq_.beginSafe();
416 }

References _actionSeq_.

Referenced by gum::IDecisionStrategy::initialize(), size(), and toString().

Here is the caller graph for this function:

◆ beginVariables()

template<typename GUM_ELEMENT>
SequenceIteratorSafe< const DiscreteVariable * > gum::FMDP< GUM_ELEMENT >::beginVariables ( ) const

Returns an iterator reference to he beginning of the list of variables.

Definition at line 393 of file fmdp_tpl.h.

393 {
394 return _varSeq_.beginSafe();
395 }

References _varSeq_.

Referenced by gum::E_GreedyDecider::initialize(), size(), and toString().

Here is the caller graph for this function:

◆ cost()

template<typename GUM_ELEMENT>
const MultiDimImplementation< GUM_ELEMENT > * gum::FMDP< GUM_ELEMENT >::cost ( Idx actionId = 0) const

Returns the reward table of mdp.

Definition at line 266 of file fmdp_tpl.h.

266 {
267 if (!_actionCostTable_.exists(actionId))
268 GUM_ERROR(NotFound, " Action " << actionName(actionId) << " has not been declared before.");
269
271 return _actionCostTable_[0];
272 }

References FMDP(), actionId(), and cost().

Referenced by addCost(), and cost().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ discount()

template<typename GUM_ELEMENT>
GUM_ELEMENT gum::FMDP< GUM_ELEMENT >::discount ( ) const

Returns the discount factor.

Definition at line 450 of file fmdp_tpl.h.

450 {
451 return _discount_;
452 }
GUM_ELEMENT _discount_
Definition fmdp.h:303

References _discount_.

Referenced by setDiscount().

Here is the caller graph for this function:

◆ endActions()

template<typename GUM_ELEMENT>
SequenceIteratorSafe< Idx > gum::FMDP< GUM_ELEMENT >::endActions ( ) const

Returns an iterator reference to the end of the list of actions.

Definition at line 419 of file fmdp_tpl.h.

419 {
420 return _actionSeq_.endSafe();
421 }

References _actionSeq_.

Referenced by gum::AdaptiveRMaxPlaner::_clearTables_(), gum::AdaptiveRMaxPlaner::_makeRMaxFunctionGraphs_(), gum::IDecisionStrategy::initialize(), size(), and toString().

Here is the caller graph for this function:

◆ endVariables()

template<typename GUM_ELEMENT>
SequenceIteratorSafe< const DiscreteVariable * > gum::FMDP< GUM_ELEMENT >::endVariables ( ) const

Returns an iterator reference to the end of the list of variables.

Definition at line 398 of file fmdp_tpl.h.

398 {
399 return _varSeq_.endSafe();
400 }

References _varSeq_.

Referenced by gum::AdaptiveRMaxPlaner::_makeRMaxFunctionGraphs_(), gum::E_GreedyDecider::initialize(), size(), and toString().

Here is the caller graph for this function:

◆ main2prime()

template<typename GUM_ELEMENT>
const DiscreteVariable * gum::FMDP< GUM_ELEMENT >::main2prime ( const DiscreteVariable * mainVar) const

Returns the primed variable associate to the given main variable.

Definition at line 403 of file fmdp_tpl.h.

403 {
404 return _main2primed_.second(mainVar);
405 }

References _main2primed_.

◆ mapMainPrime()

template<typename GUM_ELEMENT>
const Bijection< const DiscreteVariable *, const DiscreteVariable * > & gum::FMDP< GUM_ELEMENT >::mapMainPrime ( ) const

Returns the map binding main variables and prime variables.

Definition at line 409 of file fmdp_tpl.h.

409 {
410 return _main2primed_;
411 }

References _main2primed_.

Referenced by gum::MDDOperatorStrategy< GUM_ELEMENT >::regress(), gum::TreeOperatorStrategy< GUM_ELEMENT >::regress(), and gum::MDDOperatorStrategy< GUM_ELEMENT >::shouldEleminateVar_().

Here is the caller graph for this function:

◆ reward()

template<typename GUM_ELEMENT>
const MultiDimImplementation< GUM_ELEMENT > * gum::FMDP< GUM_ELEMENT >::reward ( Idx actionId = 0) const

Returns the reward table of mdp.

Definition at line 305 of file fmdp_tpl.h.

305 {
306 if (!_actionRewardTable_.exists(actionId))
307 GUM_ERROR(NotFound, " Action " << actionName(actionId) << " has not been declared before.");
308
310 return _actionRewardTable_[0];
311 }

References _actionRewardTable_, actionId(), actionName(), and GUM_ERROR.

Referenced by addReward(), addRewardForAction(), size(), and toString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDeleteVariablesOnDestruction()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::setDeleteVariablesOnDestruction ( bool b)

Transfers ownership of variables to this FMDP (they will be deleted on destruction).

Call this when the FMDP has been populated via FMDPFactory.

Definition at line 440 of file fmdp_tpl.h.

440 {
442 }

References _onDestructionDeleteVars_.

◆ setDiscount()

template<typename GUM_ELEMENT>
void gum::FMDP< GUM_ELEMENT >::setDiscount ( GUM_ELEMENT discount)

Sets the discount factor.

Definition at line 445 of file fmdp_tpl.h.

445 {
447 }
GUM_ELEMENT discount() const
Returns the discount factor.
Definition fmdp_tpl.h:450

References _discount_, and discount().

Here is the call graph for this function:

◆ size()

template<typename GUM_ELEMENT>
Size gum::FMDP< GUM_ELEMENT >::size ( ) const

Returns the map binding main variables and prime variables.

Definition at line 377 of file fmdp_tpl.h.

377 {
378 Size s = 0;
379 for (auto actionIter = beginActions(); actionIter != endActions(); ++actionIter) {
380 for (auto varIter = beginVariables(); varIter != endVariables(); ++varIter)
381 if (this->transition(*actionIter, *varIter))
382 s += this->transition(*actionIter, *varIter)->realSize();
383 if (this->reward(*actionIter)) s += this->reward(*actionIter)->realSize();
384 }
385
386 for (auto varIter = beginVariables(); varIter != endVariables(); ++varIter)
387 if (this->transition(0, *varIter)) s += this->transition(0, *varIter)->realSize();
388 if (this->reward()) s += this->reward()->realSize();
389 return s;
390 }
SequenceIteratorSafe< Idx > beginActions() const
Returns an iterator reference to he beginning of the list of actions.
Definition fmdp_tpl.h:414
SequenceIteratorSafe< const DiscreteVariable * > beginVariables() const
Returns an iterator reference to he beginning of the list of variables.
Definition fmdp_tpl.h:393
SequenceIteratorSafe< Idx > endActions() const
Returns an iterator reference to the end of the list of actions.
Definition fmdp_tpl.h:419
SequenceIteratorSafe< const DiscreteVariable * > endVariables() const
Returns an iterator reference to the end of the list of variables.
Definition fmdp_tpl.h:398

References beginActions(), beginVariables(), endActions(), endVariables(), reward(), and transition().

Here is the call graph for this function:

◆ toString()

template<typename GUM_ELEMENT>
std::string gum::FMDP< GUM_ELEMENT >::toString ( ) const

Displays the FMDP in a Dot format.

Definition at line 346 of file fmdp_tpl.h.

346 {
348
349 for (auto actionIter = beginActions(); actionIter != endActions(); ++actionIter) {
350 for (auto varIter = beginVariables(); varIter != endVariables(); ++varIter)
351 if (this->transition(*actionIter, *varIter))
352 fmdpCore += static_cast< const MultiDimFunctionGraph< GUM_ELEMENT >* >(
353 this->transition(*actionIter, *varIter))
354 ->toDot()
355 + '\n';
356 if (this->reward(*actionIter))
358 += static_cast< const MultiDimFunctionGraph< GUM_ELEMENT >* >(this->reward(*actionIter))
359 ->toDot()
360 + '\n';
361 }
362
363 for (auto varIter = beginVariables(); varIter != endVariables(); ++varIter)
364 if (this->transition(0, *varIter))
365 fmdpCore += static_cast< const MultiDimFunctionGraph< GUM_ELEMENT >* >(
366 this->transition(0, *varIter))
367 ->toDot()
368 + '\n';
369 if (this->reward())
371 += static_cast< const MultiDimFunctionGraph< GUM_ELEMENT >* >(this->reward())->toDot()
372 + '\n';
373 return fmdpCore;
374 }

References beginActions(), beginVariables(), endActions(), endVariables(), reward(), and transition().

Here is the call graph for this function:

◆ transition()

template<typename GUM_ELEMENT>
const MultiDimImplementation< GUM_ELEMENT > * gum::FMDP< GUM_ELEMENT >::transition ( Idx actionId,
const DiscreteVariable * v ) const

Returns transition associated to given in parameter variable and the given action.

Definition at line 226 of file fmdp_tpl.h.

226 {
228 GUM_ERROR(NotFound, " Action " << actionName(actionId) << " has not been declared before.");
229
232 else
233 return (*_actionTransitionTable_[0]).exists(v) ? (*_actionTransitionTable_[0])[v] : nullptr;
234 }

References _actionTransitionTable_, actionId(), actionName(), and GUM_ERROR.

Referenced by addTransition(), gum::MDDOperatorStrategy< GUM_ELEMENT >::regress(), gum::TreeOperatorStrategy< GUM_ELEMENT >::regress(), size(), and toString().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _actionCostTable_

template<typename GUM_ELEMENT>
HashTable< Idx, const MultiDimImplementation< GUM_ELEMENT >* > gum::FMDP< GUM_ELEMENT >::_actionCostTable_
private

Table which give for each action cost table.

Definition at line 293 of file fmdp.h.

Referenced by FMDP().

◆ _actionMap_

template<typename GUM_ELEMENT>
Bijection< Idx, const std::string* > gum::FMDP< GUM_ELEMENT >::_actionMap_
private

Bijection mapping an action name to its id.

Definition at line 286 of file fmdp.h.

Referenced by FMDP(), actionId(), actionName(), and addAction().

◆ _actionRewardTable_

template<typename GUM_ELEMENT>
HashTable< Idx, const MultiDimImplementation< GUM_ELEMENT >* > gum::FMDP< GUM_ELEMENT >::_actionRewardTable_
private

Table which give for each action reward table.

Definition at line 296 of file fmdp.h.

Referenced by FMDP(), addRewardForAction(), and reward().

◆ _actionSeq_

template<typename GUM_ELEMENT>
Sequence< Idx > gum::FMDP< GUM_ELEMENT >::_actionSeq_
private

Definition at line 280 of file fmdp.h.

Referenced by beginActions(), and endActions().

◆ _actionTransitionTable_

template<typename GUM_ELEMENT>
HashTable< Idx, VarTransitionTable< GUM_ELEMENT >* > gum::FMDP< GUM_ELEMENT >::_actionTransitionTable_
private

Table which give for each action a table containing variables transition cpt.

Definition at line 290 of file fmdp.h.

Referenced by FMDP(), ~FMDP(), and transition().

◆ _discount_

template<typename GUM_ELEMENT>
GUM_ELEMENT gum::FMDP< GUM_ELEMENT >::_discount_ {GUM_ELEMENT(1)}
private

Definition at line 303 of file fmdp.h.

Referenced by discount(), and setDiscount().

◆ _main2primed_

template<typename GUM_ELEMENT>
Bijection< const DiscreteVariable*, const DiscreteVariable* > gum::FMDP< GUM_ELEMENT >::_main2primed_
private

Mapping from a main variable to its associated primed version.

Definition at line 283 of file fmdp.h.

Referenced by main2prime(), and mapMainPrime().

◆ _onDestructionDeleteVars_

template<typename GUM_ELEMENT>
bool gum::FMDP< GUM_ELEMENT >::_onDestructionDeleteVars_
private

Boolean indicates whether or not main variables should be deleted on destruction of this instance Usually the case when fmdp has been initialized with the factory.

Definition at line 301 of file fmdp.h.

Referenced by FMDP(), and setDeleteVariablesOnDestruction().

◆ _varSeq_

template<typename GUM_ELEMENT>
Sequence< const DiscreteVariable* > gum::FMDP< GUM_ELEMENT >::_varSeq_
private

Sequence de variables and its iterator.

Definition at line 278 of file fmdp.h.

Referenced by addVariable(), beginVariables(), and endVariables().


The documentation for this class was generated from the following files: