aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::FMDPFactory< GUM_SCALAR > Class Template Reference

A factory class to ease Factored Markov Decision Process construction. More...

#include <agrum/FMDP/fmdpFactory.h>

+ Inheritance diagram for gum::FMDPFactory< GUM_SCALAR >:
+ Collaboration diagram for gum::FMDPFactory< GUM_SCALAR >:

Public Member Functions

Constructor & destructor.
 FMDPFactory (FMDP< GUM_SCALAR > *fmdp)
 Use this constructor if you want to use an already created factored markov decision process. More...
 
 ~FMDPFactory ()
 Destructor. More...
 
Getter and setters.
FMDP< GUM_SCALAR > * fmdp () const
 Returns the Factored Markov Decision Process created by this factory. More...
 
FMDPfactory_state state () const
 Returns the current state of the factory. More...
 
const DiscreteVariablevariable (const std::string &name) const
 Returns a constant reference on a variable given it's name. More...
 
Variable declaration methods (NONE -> VARIABLE)
void startVariableDeclaration ()
 Tells the factory that we're in a variable declaration. More...
 
void variableName (const std::string &name)
 Tells the factory the current variable's name. More...
 
void variableDescription (const std::string &desc)
 Tells the factory the current variable's description. More...
 
void addModality (const std::string &name)
 Adds a modality to the current variable. More...
 
void endVariableDeclaration ()
 Tells the factory that we're out of a variable declaration. More...
 
Action declaration methods (NONE -> ACTION)
void startActionDeclaration ()
 Tells the factory that we're in an action declaration. More...
 
void addAction (const std::string &action)
 Tells the factory to add an action to the current fmdp. More...
 
void endActionDeclaration ()
 Tells the factory that we're out of an action declaration. More...
 
Transition declaration methods (NONE -> TRANSITION <- ACTION)
void startTransitionDeclaration ()
 Tells the factory that we're in a transition declaration. More...
 
void addTransition (const std::string &var, const MultiDimAdressable *transition)
 Tells the factory to add a transition table to the current fmdp. More...
 
void addTransition (const std::string &var)
 Tells the factory to add a transition table to the current fmdp. This transition table will be extracted from incorporated multiDimFunctionGraph. More...
 
void endTransitionDeclaration ()
 Tells the factory that we're out of a transition declaration. More...
 
Cost declaration methods (NONE -> COST <- ACTION)
void startCostDeclaration ()
 Tells the factory that we're in a cost declaration. More...
 
void addCost (const MultiDimAdressable *cost)
 Tells the factory to add a cost table to the current fmdp. More...
 
void addCost ()
 Tells the factory to add a cost table to the current fmdp. This cost table will be extracted from incorporated multiDimFunctionGraph. More...
 
void endCostDeclaration ()
 Tells the factory that we're out of a cost declaration. More...
 
Reward declaration methods (NONE -> REWARD <- ACTION)
void startRewardDeclaration ()
 Tells the factory that we're in a reward declaration. More...
 
void setOperationModeOn (std::string operationType)
 Tells the factory that we're in a reward declaration mode where the global reward diagram is an operation between simplier decision diagram.. More...
 
void addReward (const MultiDimAdressable *reward)
 Tells the factory to add a reward table to the current fmdp. More...
 
void addReward ()
 Tells the factory to add a reward table to the current fmdp. This reward table will be extracted from incorporated multiDimFunctionGraph. More...
 
void endRewardDeclaration ()
 Tells the factory that we're out of a cost declaration. More...
 
Discount declaration methods (NONE -> DISCOUNT)
void startDiscountDeclaration ()
 Tells the factory that we're in a cost declaration. More...
 
void addDiscount (float discount)
 Tells the factory to add a cost table to the current fmdp. More...
 
void endDiscountDeclaration ()
 Tells the factory that we're out of a cost declaration. More...
 
FunctionGraph Creation specific methods

methods used by internal FunctionGraphfactory to build up a multidimFunctionGraph

NodeId addInternalNode (std::string name_of_var)
 Insert in diagram a non terminal node. More...
 
NodeId addTerminalNode (float value)
 Insert in diagram a terminal node. More...
 
void addArc (NodeId from, NodeId to, Idx modality)
 Insert in diagram a non terminal node. More...
 
void setRoot (NodeId rootId)
 add an arc in diagram More...
 
verbosity control
void setVerbose ()
 
void resetVerbose ()
 
bool isVerbose ()
 

Current constructed FMDP's parts.

bool _foo_flag_
 Depending on the context this flag is used for some VERY important reasons. More...
 
bool _bar_flag_
 Depending on the context this flag is used for some VERY important reasons. More...
 
std::vector< std::string > _stringBag_
 Just to keep track of strings between two start/end calls. More...
 
std::vector< const MultiDimImplementation< GUM_SCALAR > *> _ddBag_
 Just to keep track of multidim between two start/end calls. More...
 
void _checkModalityInBag_ (const std::string &mod)
 Used in VARIABLE mode Checks if in stringBag there is no other modality with the same name. More...
 
void _resetParts_ ()
 Reset the different parts used to constructed the FMDP. More...
 
void _initializeFunctionGraph_ ()
 Insert every variables in the function graph. More...
 
void _finalizeFunctionGraph_ ()
 Insert every variables in the function graph. More...
 

Detailed Description

template<typename GUM_SCALAR>
class gum::FMDPFactory< GUM_SCALAR >

A factory class to ease Factored Markov Decision Process construction.

A FMDPFactory will never create a Factored Markov Decision Process and works on only one Factored Markov Decision Process.

The only exception of this behaviour is when you create a copy of the factory, it will create a copy of its FMDP. This is useful when you want to create two FMDP sharing a common base. However be very careful because the copy will not delete its FMDP.

Each method will raise an OperationNotAllowed if you call it when the factory is not in a valid state for that call. The error message is "Illegal state.".

Definition at line 71 of file fmdpFactory.h.

Constructor & Destructor Documentation

◆ FMDPFactory()

template<typename GUM_SCALAR >
INLINE gum::FMDPFactory< GUM_SCALAR >::FMDPFactory ( FMDP< GUM_SCALAR > *  fmdp)

Use this constructor if you want to use an already created factored markov decision process.

Parameters
fmdpA pointer over the FMDP filled by this factory.

Definition at line 57 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

57  : _fmdp_(fmdp) {
58  GUM_CONSTRUCTOR(FMDPFactory);
59 
61  resetVerbose();
62  _actionIdcpt_ = 1;
63  }
FMDP< GUM_SCALAR > * fmdp() const
Returns the Factored Markov Decision Process created by this factory.
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
FMDPFactory(FMDP< GUM_SCALAR > *fmdp)
Use this constructor if you want to use an already created factored markov decision process...
Idx _actionIdcpt_
Action Id counter.
Definition: fmdpFactory.h:306
+ Here is the call graph for this function:

◆ ~FMDPFactory()

template<typename GUM_SCALAR >
INLINE gum::FMDPFactory< GUM_SCALAR >::~FMDPFactory ( )

Destructor.

To prevent strange behaviour you should always destroy a FMDPFactory when it's state equals NONE.

Exceptions
FatalErrorRaised if the state of the factory prevents it to die peacefully.

Definition at line 69 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

69  {
70  GUM_DESTRUCTOR(FMDPFactory);
71  }
FMDPFactory(FMDP< GUM_SCALAR > *fmdp)
Use this constructor if you want to use an already created factored markov decision process...
+ Here is the call graph for this function:

Member Function Documentation

◆ _checkModalityInBag_()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::_checkModalityInBag_ ( const std::string &  mod)
private

Used in VARIABLE mode Checks if in stringBag there is no other modality with the same name.

Definition at line 195 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

195  {
196  for (size_t i = 2; i < _stringBag_.size(); ++i)
197  if (mod == _stringBag_[i])
198  GUM_ERROR(DuplicateElement, "Modality" << mod << " already exists.")
199  }
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ _finalizeFunctionGraph_()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::_finalizeFunctionGraph_ ( )
private

Insert every variables in the function graph.

Definition at line 738 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

738  {
739  this->_FunctionGraph_->manager()->reduce();
740  this->_FunctionGraph_->manager()->clean();
741  }
void clean()
Removes var without nodes in the diagram.
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:300
MultiDimFunctionGraphManager< GUM_SCALAR, TerminalNodePolicy > * manager()
Returns a const reference to the manager of this diagram.
virtual void reduce()=0
Ensures that every isomorphic subgraphs are merged together.
+ Here is the call graph for this function:

◆ _illegalStateError_()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::_illegalStateError_ ( const std::string &  s)
private

Raise an OperationNotAllowed with the message "Illegal state.".

Definition at line 669 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

669  {
670  std::string msg = "Illegal state call (";
671  msg += s;
672  msg += ") in state ";
673 
674  switch (state()) {
676  msg += "FMDPfactory_state::NONE";
677  break;
678 
680  msg += "FMDPfactory_state::VARIABLE";
681  break;
682 
684  msg += "FMDPfactory_state::ACTION";
685  break;
686 
688  msg += "FMDPfactory_state::TRANSITION";
689  break;
690 
692  msg += "FMDPfactory_state::COST";
693  break;
694 
696  msg += "FMDPfactory_state::REWARD";
697  break;
698 
700  msg += "FMDPfactory_state::DISCOUNT";
701  break;
702 
703  default:
704  msg += "Unknown state";
705  }
706 
707  GUM_ERROR(OperationNotAllowed, msg)
708  }
FMDPfactory_state state() const
Returns the current state of the factory.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ _initializeFunctionGraph_()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::_initializeFunctionGraph_ ( )
private

Insert every variables in the function graph.

Definition at line 723 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

723  {
725  // Recopie des variables principales dans le graphe de décision
726  for (auto varIter = _fmdp_->beginVariables(); varIter != _fmdp_->endVariables(); ++varIter) {
727  _FunctionGraph_->add(**varIter);
728  }
729 
730  // Recopie des version primes des variables dans le graphe de décision
731  for (auto varIter = _fmdp_->beginVariables(); varIter != _fmdp_->endVariables(); ++varIter) {
732  _FunctionGraph_->add(*(_fmdp_->main2prime(*varIter)));
733  }
734  }
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:300
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
virtual void add(const DiscreteVariable &v)
Adds a new var to the variables of the multidimensional matrix.
static MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * getReducedAndOrderedInstance()
Returns a reduced and ordered instance.
+ Here is the call graph for this function:

◆ _resetParts_()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::_resetParts_ ( )
private

Reset the different parts used to constructed the FMDP.

Definition at line 714 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

714  {
715  _foo_flag_ = false;
716  _bar_flag_ = false;
717  _stringBag_.clear();
718  _ddBag_.clear();
719  }
std::vector< const MultiDimImplementation< GUM_SCALAR > *> _ddBag_
Just to keep track of multidim between two start/end calls.
Definition: fmdpFactory.h:276
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
bool _bar_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:270
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
+ Here is the call graph for this function:

◆ addAction()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addAction ( const std::string &  action)
virtual

Tells the factory to add an action to the current fmdp.

Implements gum::AbstractFMDPFactory.

Definition at line 277 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

277  {
279  _illegalStateError_("addAction");
280  else {
281  _stringBag_.push_back(action);
282  _fmdp_->addAction(_actionIdcpt_++, action);
283  }
284  }
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
Idx _actionIdcpt_
Action Id counter.
Definition: fmdpFactory.h:306
+ Here is the call graph for this function:

◆ addArc()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addArc ( NodeId  from,
NodeId  to,
Idx  modality 
)
virtual

Insert in diagram a non terminal node.

Implements gum::AbstractFMDPFactory.

Definition at line 647 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

647  {
648  _FunctionGraph_->manager()->setSon(from, modality, to);
649  }
void setSon(const NodeId &node, const Idx &modality, const NodeId &sonNode)
Sets nodes son for given modality to designated son node.
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:300
MultiDimFunctionGraphManager< GUM_SCALAR, TerminalNodePolicy > * manager()
Returns a const reference to the manager of this diagram.
+ Here is the call graph for this function:

◆ addCost() [1/2]

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addCost ( const MultiDimAdressable cost)
virtual

Tells the factory to add a cost table to the current fmdp.

Implements gum::AbstractFMDPFactory.

Definition at line 408 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

408  {
409  const MultiDimImplementation< GUM_SCALAR >* c
410  = reinterpret_cast< const MultiDimImplementation< GUM_SCALAR >* >(cost);
411 
413  _illegalStateError_("addCost");
414  else if (_foo_flag_)
415  _fmdp_->addCostForAction(_fmdp_->actionId(_stringBag_[0]), c);
416  else
417  _fmdp_->addCost(c);
418  }
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
+ Here is the call graph for this function:

◆ addCost() [2/2]

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addCost ( )
virtual

Tells the factory to add a cost table to the current fmdp. This cost table will be extracted from incorporated multiDimFunctionGraph.

Implements gum::AbstractFMDPFactory.

Definition at line 425 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

425  {
427  _illegalStateError_("addCost");
428  else {
429  this->_finalizeFunctionGraph_();
430 
431  if (_foo_flag_)
432  _fmdp_->addCostForAction(_fmdp_->actionId(_stringBag_[0]), this->_FunctionGraph_);
433  else
434  _fmdp_->addCost(this->_FunctionGraph_);
435  }
436  }
void _finalizeFunctionGraph_()
Insert every variables in the function graph.
FMDPfactory_state state() const
Returns the current state of the factory.
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:300
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
+ Here is the call graph for this function:

◆ addDiscount()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addDiscount ( float  discount)
virtual

Tells the factory to add a cost table to the current fmdp.

Implements gum::AbstractFMDPFactory.

Definition at line 598 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

598  {
599  if (state() != FMDPfactory_state::DISCOUNT) _illegalStateError_("addDiscount");
600  // else
601  // _fmdp_->setDiscount ( ( GUM_SCALAR ) discount );
602  }
FMDPfactory_state state() const
Returns the current state of the factory.
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ addInternalNode()

template<typename GUM_SCALAR >
INLINE NodeId gum::FMDPFactory< GUM_SCALAR >::addInternalNode ( std::string  name_of_var)
virtual

Insert in diagram a non terminal node.

Implements gum::AbstractFMDPFactory.

Definition at line 632 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

632  {
633  return _FunctionGraph_->manager()->addInternalNode(variable(name_of_var));
634  }
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:300
const DiscreteVariable * variable(const std::string &name) const
Returns a constant reference on a variable given it&#39;s name.
NodeId addInternalNode(const DiscreteVariable *var)
Inserts a new non terminal node in graph.
MultiDimFunctionGraphManager< GUM_SCALAR, TerminalNodePolicy > * manager()
Returns a const reference to the manager of this diagram.
+ Here is the call graph for this function:

◆ addModality()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addModality ( const std::string &  name)
virtual

Adds a modality to the current variable.

Implements gum::AbstractFMDPFactory.

Definition at line 182 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

182  {
184  _illegalStateError_("addModality");
185  else {
186  _checkModalityInBag_(name);
187  _stringBag_.push_back(name);
188  }
189  }
FMDPfactory_state state() const
Returns the current state of the factory.
void _checkModalityInBag_(const std::string &mod)
Used in VARIABLE mode Checks if in stringBag there is no other modality with the same name...
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
+ Here is the call graph for this function:

◆ addReward() [1/2]

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addReward ( const MultiDimAdressable reward)
virtual

Tells the factory to add a reward table to the current fmdp.

Implements gum::AbstractFMDPFactory.

Definition at line 491 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

491  {
492  const MultiDimImplementation< GUM_SCALAR >* r
493  = reinterpret_cast< const MultiDimImplementation< GUM_SCALAR >* >(reward);
494 
496  _illegalStateError_("addReward");
497  else
498  _fmdp_->addReward(r);
499  }
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ addReward() [2/2]

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addReward ( )
virtual

Tells the factory to add a reward table to the current fmdp. This reward table will be extracted from incorporated multiDimFunctionGraph.

Implements gum::AbstractFMDPFactory.

Definition at line 507 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

507  {
509  _illegalStateError_("addReward");
510  else {
511  this->_finalizeFunctionGraph_();
512  _FunctionGraph_->setTableName("Reward");
513 
514  if (_foo_flag_)
515  _ddBag_.push_back(this->_FunctionGraph_);
516  else
517  _fmdp_->addReward(this->_FunctionGraph_);
518  }
519  }
void _finalizeFunctionGraph_()
Insert every variables in the function graph.
FMDPfactory_state state() const
Returns the current state of the factory.
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:300
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
std::vector< const MultiDimImplementation< GUM_SCALAR > *> _ddBag_
Just to keep track of multidim between two start/end calls.
Definition: fmdpFactory.h:276
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
void setTableName(const std::string &name)
Sets the name of the table represented by this structure.
+ Here is the call graph for this function:

◆ addTerminalNode()

template<typename GUM_SCALAR >
INLINE NodeId gum::FMDPFactory< GUM_SCALAR >::addTerminalNode ( float  value)
virtual

Insert in diagram a terminal node.

Implements gum::AbstractFMDPFactory.

Definition at line 640 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

640  {
641  return _FunctionGraph_->manager()->addTerminalNode((GUM_SCALAR)value);
642  }
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:300
NodeId addTerminalNode(const GUM_SCALAR &value)
Adds a value to the MultiDimFunctionGraph.
MultiDimFunctionGraphManager< GUM_SCALAR, TerminalNodePolicy > * manager()
Returns a const reference to the manager of this diagram.
+ Here is the call graph for this function:

◆ addTransition() [1/2]

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addTransition ( const std::string &  var,
const MultiDimAdressable transition 
)
virtual

Tells the factory to add a transition table to the current fmdp.

Implements gum::AbstractFMDPFactory.

Definition at line 330 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

331  {
332  const MultiDimImplementation< GUM_SCALAR >* t
333  = reinterpret_cast< const MultiDimImplementation< GUM_SCALAR >* >(transition);
334 
336  _illegalStateError_("addTransition");
337  else if (_foo_flag_)
338  _fmdp_->addTransitionForAction(_fmdp_->actionId(_stringBag_[0]), _varNameMap_[var], t);
339  else
340  _fmdp_->addTransition(_varNameMap_[var], t);
341  }
FMDPfactory_state state() const
Returns the current state of the factory.
HashTable< std::string, const DiscreteVariable *> _varNameMap_
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:303
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
+ Here is the call graph for this function:

◆ addTransition() [2/2]

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::addTransition ( const std::string &  var)
virtual

Tells the factory to add a transition table to the current fmdp. This transition table will be extracted from incorporated multiDimFunctionGraph.

Implements gum::AbstractFMDPFactory.

Definition at line 349 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

349  {
351  _illegalStateError_("addTransition");
352  else {
353  this->_finalizeFunctionGraph_();
354 
355  if (_foo_flag_) {
356  this->_FunctionGraph_->setTableName("ACTION :" + _stringBag_[0] + " - VARIABLE : " + var);
357  _fmdp_->addTransitionForAction(_fmdp_->actionId(_stringBag_[0]),
358  _varNameMap_[var],
359  this->_FunctionGraph_);
360  } else {
361  _fmdp_->addTransition(_varNameMap_[var], this->_FunctionGraph_);
362  }
363  }
364  }
void _finalizeFunctionGraph_()
Insert every variables in the function graph.
FMDPfactory_state state() const
Returns the current state of the factory.
HashTable< std::string, const DiscreteVariable *> _varNameMap_
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:303
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:300
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
void setTableName(const std::string &name)
Sets the name of the table represented by this structure.
+ Here is the call graph for this function:

◆ endActionDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::endActionDeclaration ( )
virtual

Tells the factory that we're out of an action declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 290 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

290  {
292  _illegalStateError_("endActionDeclaration");
293  else {
294  _states_.pop_back();
295  _resetParts_();
296  }
297 
298  // VERBOSITY ( "action OK" );
299  }
FMDPfactory_state state() const
Returns the current state of the factory.
void _resetParts_()
Reset the different parts used to constructed the FMDP.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ endCostDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::endCostDeclaration ( )
virtual

Tells the factory that we're out of a cost declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 442 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

442  {
444  _illegalStateError_("endCostDeclaration");
445  else
446  _states_.pop_back();
447 
448  // VERBOSITY ( "Cost OK" );
449  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ endDiscountDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::endDiscountDeclaration ( )
virtual

Tells the factory that we're out of a cost declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 608 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

608  {
610  _illegalStateError_("endDiscountDeclaration");
611  else
612  _states_.pop_back();
613 
614  // VERBOSITY ( "discount OK" );
615  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ endRewardDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::endRewardDeclaration ( )
virtual

Tells the factory that we're out of a cost declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 525 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

525  {
527  _illegalStateError_("endRewardDeclaration");
528  else {
529  if (_foo_flag_) {
530  MultiDimImplementation< GUM_SCALAR >* res = nullptr;
531  MultiDimImplementation< GUM_SCALAR >* temp;
532 
533  for (const auto elt: _ddBag_) {
534  temp = res;
535 
536  switch (_stringBag_[0][0]) {
537  case '+':
538  res = add2MultiDimFunctionGraphs(res, elt);
539  break;
540 
541  case '-':
542  res = subtract2MultiDimFunctionGraphs(res, elt);
543  break;
544 
545  case '*':
546  res = multiply2MultiDimFunctionGraphs(res, elt);
547  break;
548 
549  case '/':
550  res = divide2MultiDimFunctionGraphs(res, elt);
551  break;
552 
553  default:
554  break;
555  }
556 
557  delete elt;
558 
559  if (temp != nullptr) delete temp;
560  }
561  reinterpret_cast< MultiDimFunctionGraph< GUM_SCALAR >* >(res)->setTableName("Reward");
562  _fmdp_->addReward(res);
563  }
564 
565  _resetParts_();
566  _states_.pop_back();
567  }
568  // VERBOSITY ( "reward OK" );
569  }
FMDPfactory_state state() const
Returns the current state of the factory.
void _resetParts_()
Reset the different parts used to constructed the FMDP.
MultiDimFunctionGraph< T > * subtract2MultiDimFunctionGraphs(const MultiDimFunctionGraph< T > *t1, const MultiDimFunctionGraph< T > *t2)
a specialized function for subtracting two multiDimArraysThe function produces a tensorial subtractio...
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
std::vector< const MultiDimImplementation< GUM_SCALAR > *> _ddBag_
Just to keep track of multidim between two start/end calls.
Definition: fmdpFactory.h:276
MultiDimFunctionGraph< T > * multiply2MultiDimFunctionGraphs(const MultiDimFunctionGraph< T > *t1, const MultiDimFunctionGraph< T > *t2)
a specialized function for multiplying two multiDimArraysThe function produces a tensorial product of...
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
MultiDimFunctionGraph< T > * add2MultiDimFunctionGraphs(const MultiDimFunctionGraph< T > *t1, const MultiDimFunctionGraph< T > *t2)
a specialized function for summing two multiDimArraysThe function produces a tensorial addition of t1...
MultiDimFunctionGraph< T > * divide2MultiDimFunctionGraphs(const MultiDimFunctionGraph< T > *t1, const MultiDimFunctionGraph< T > *t2)
a specialized function for dividing two multiDimArraysThe function produces a tensorial division of t...
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
+ Here is the call graph for this function:

◆ endTransitionDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::endTransitionDeclaration ( )
virtual

Tells the factory that we're out of a transition declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 370 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

370  {
372  _illegalStateError_("endTransitionDeclaration");
373  else
374  _states_.pop_back();
375 
376  // VERBOSITY ( "transition OK" );
377  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ endVariableDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::endVariableDeclaration ( )
virtual

Tells the factory that we're out of a variable declaration.

Exceptions
UndefinedElementRaised if the variable isn't defined (or not enough defined).

Implements gum::AbstractFMDPFactory.

Definition at line 205 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

205  {
207  _illegalStateError_("endVariableDeclaration");
208  else if (_foo_flag_ && (_stringBag_.size() > 3)) {
209  LabelizedVariable* var
210  = new LabelizedVariable(_stringBag_[0], (_bar_flag_) ? _stringBag_[1] : "", 0);
211 
212  for (size_t i = 2; i < _stringBag_.size(); ++i) {
213  var->addLabel(_stringBag_[i]);
214  }
215 
216  _fmdp_->addVariable(var);
217  _varNameMap_.insert(var->name(), var);
218  _varNameMap_.insert(_fmdp_->main2prime(var)->name(), _fmdp_->main2prime(var));
219 
220  _resetParts_();
221  _states_.pop_back();
222 
223  // VERBOSITY ( " variable " << var->name() << " OK" );
224 
225  } else {
226  std::stringstream msg;
227  msg << "Not enough modalities (";
228 
229  if (_stringBag_.size() > 2)
230  msg << _stringBag_.size() - 2;
231  else
232  msg << 0;
233 
234  msg << ") declared for variable ";
235 
236  if (_foo_flag_)
237  msg << _stringBag_[0];
238  else
239  msg << "unknown";
240 
241  _resetParts_();
242  _states_.pop_back();
243 
244  GUM_ERROR(OperationNotAllowed, msg.str())
245  }
246  }
FMDPfactory_state state() const
Returns the current state of the factory.
void _resetParts_()
Reset the different parts used to constructed the FMDP.
HashTable< std::string, const DiscreteVariable *> _varNameMap_
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:303
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
bool _bar_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:270
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ fmdp()

template<typename GUM_SCALAR >
INLINE FMDP< GUM_SCALAR > * gum::FMDPFactory< GUM_SCALAR >::fmdp ( ) const

Returns the Factored Markov Decision Process created by this factory.

Exceptions
OperationNotAllowedRaise if the state of the factory is different than NONE.

Definition at line 86 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

86  {
88  GUM_ERROR(OperationNotAllowed,
89  "Illegal state to return the factored "
90  "markov decision process: it is not yet "
91  "finished.");
92 
93  return _fmdp_;
94  }
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
Definition: fmdpFactory.h:297
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ isVerbose()

bool gum::AbstractFMDPFactory::isVerbose ( )
inlineinherited

Definition at line 276 of file IfmdpFactory.h.

References gum::AbstractFMDPFactory::_verbose_.

276 { return _verbose_; }

◆ operator=()

template<typename GUM_SCALAR >
INLINE FMDPFactory< GUM_SCALAR > & gum::FMDPFactory< GUM_SCALAR >::operator= ( const FMDPFactory< GUM_SCALAR > &  source)
private

Copy operator is illegal, use only copy constructor.

Definition at line 760 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

760  {
761  GUM_ERROR(FatalError, "Illegal!")
762  // For noisy compilers
763  return *this;
764  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ resetVerbose()

void gum::AbstractFMDPFactory::resetVerbose ( )
inlineinherited

Definition at line 274 of file IfmdpFactory.h.

References gum::AbstractFMDPFactory::_verbose_.

274 { _verbose_ = false; }

◆ setOperationModeOn()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::setOperationModeOn ( std::string  operationType)
virtual

Tells the factory that we're in a reward declaration mode where the global reward diagram is an operation between simplier decision diagram..

Implements gum::AbstractFMDPFactory.

Definition at line 481 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

481  {
482  _foo_flag_ = true;
483  std::string ot(operationType);
484  _stringBag_.push_back(ot);
485  }
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
+ Here is the call graph for this function:

◆ setRoot()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::setRoot ( NodeId  rootId)
virtual

add an arc in diagram

Implements gum::AbstractFMDPFactory.

Definition at line 653 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

653  {
654  _FunctionGraph_->manager()->setRootNode(rootId);
655  }
void setRootNode(const NodeId &root)
Sets root node of decision diagram.
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:300
MultiDimFunctionGraphManager< GUM_SCALAR, TerminalNodePolicy > * manager()
Returns a const reference to the manager of this diagram.
+ Here is the call graph for this function:

◆ setVerbose()

void gum::AbstractFMDPFactory::setVerbose ( )
inlineinherited

Definition at line 272 of file IfmdpFactory.h.

References gum::AbstractFMDPFactory::_verbose_.

272 { _verbose_ = true; }

◆ startActionDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::startActionDeclaration ( )
virtual

Tells the factory that we're in an action declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 262 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

262  {
264  _illegalStateError_("startActionDeclaration");
265  else {
266  _foo_flag_ = true;
268  }
269 
270  // VERBOSITY ( "starting action declaration" );
271  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
+ Here is the call graph for this function:

◆ startCostDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::startCostDeclaration ( )
virtual

Tells the factory that we're in a cost declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 394 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

394  {
396  _illegalStateError_("startTransitionDeclaration");
397  else
399 
400  // VERBOSITY ( "starting Cost declaration" );
402  }
FMDPfactory_state state() const
Returns the current state of the factory.
void _initializeFunctionGraph_()
Insert every variables in the function graph.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ startDiscountDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::startDiscountDeclaration ( )
virtual

Tells the factory that we're in a cost declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 585 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

585  {
587  _illegalStateError_("startDiscountDeclaration");
588  else
590 
591  // VERBOSITY ( "starting discount declaration" );
592  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ startRewardDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::startRewardDeclaration ( )
virtual

Tells the factory that we're in a reward declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 466 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

466  {
468  _illegalStateError_("startRewardDeclaration");
469  else
471 
472  // VERBOSITY ( "starting reward declaration" );
474  }
FMDPfactory_state state() const
Returns the current state of the factory.
void _initializeFunctionGraph_()
Insert every variables in the function graph.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ startTransitionDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::startTransitionDeclaration ( )
virtual

Tells the factory that we're in a transition declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 316 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

316  {
318  _illegalStateError_("startTransitionDeclaration");
319  else
321 
322  // VERBOSITY ( "starting transition declaration" );
324  }
FMDPfactory_state state() const
Returns the current state of the factory.
void _initializeFunctionGraph_()
Insert every variables in the function graph.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ startVariableDeclaration()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::startVariableDeclaration ( )
virtual

Tells the factory that we're in a variable declaration.

Implements gum::AbstractFMDPFactory.

Definition at line 135 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

135  {
137  _illegalStateError_("startVariableDeclaration");
138  else {
140  _stringBag_.push_back("name");
141  _stringBag_.push_back("desc");
142  }
143 
144  // VERBOSITY ( " starting variable" );
145  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
+ Here is the call graph for this function:

◆ state()

template<typename GUM_SCALAR >
INLINE FMDPfactory_state gum::FMDPFactory< GUM_SCALAR >::state ( ) const
virtual

Returns the current state of the factory.

Implements gum::AbstractFMDPFactory.

Definition at line 100 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

100  {
101  // This is ok because there is alway at least the state
102  // FMDPfactory_state::NONE in the stack.
103  return _states_.back();
104  }
std::vector< FMDPfactory_state > _states_
State stack.
Definition: fmdpFactory.h:294
+ Here is the call graph for this function:

◆ variable()

template<typename GUM_SCALAR >
INLINE const DiscreteVariable * gum::FMDPFactory< GUM_SCALAR >::variable ( const std::string &  name) const
virtual

Returns a constant reference on a variable given it's name.

Exceptions
NotFoundRaised if no variable matches the name.

Implements gum::AbstractFMDPFactory.

Definition at line 112 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

112  {
113  for (const auto& elt: _varNameMap_)
114  if (elt.first.compare(name) == 0) return elt.second;
115 
116  GUM_ERROR(NotFound, name)
117 
118  return nullptr;
119  }
HashTable< std::string, const DiscreteVariable *> _varNameMap_
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:303
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

◆ variableDescription()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::variableDescription ( const std::string &  desc)
virtual

Tells the factory the current variable's description.

Implements gum::AbstractFMDPFactory.

Definition at line 167 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

167  {
169  _illegalStateError_("variableDescription");
170  else {
171  _bar_flag_ = true;
172  _stringBag_[1] = desc;
173  }
174  }
FMDPfactory_state state() const
Returns the current state of the factory.
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
bool _bar_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:270
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
+ Here is the call graph for this function:

◆ variableName()

template<typename GUM_SCALAR >
INLINE void gum::FMDPFactory< GUM_SCALAR >::variableName ( const std::string &  name)
virtual

Tells the factory the current variable's name.

Exceptions
DuplicateElementRaised if a variable with the same name already exist.

Implements gum::AbstractFMDPFactory.

Definition at line 151 of file fmdpFactory_tpl.h.

References gum::Set< Key, Alloc >::emplace().

151  {
153  _illegalStateError_("variableName");
154  else {
155  if (_varNameMap_.exists(name)) GUM_ERROR(DuplicateElement, "Name already used: " + name)
156 
157  _foo_flag_ = true;
158  _stringBag_[0] = name;
159  // VERBOSITY ( " -- variable " << name );
160  }
161  }
FMDPfactory_state state() const
Returns the current state of the factory.
HashTable< std::string, const DiscreteVariable *> _varNameMap_
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:303
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:266
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:273
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51
+ Here is the call graph for this function:

Member Data Documentation

◆ _actionIdcpt_

template<typename GUM_SCALAR >
Idx gum::FMDPFactory< GUM_SCALAR >::_actionIdcpt_
private

Action Id counter.

Definition at line 306 of file fmdpFactory.h.

◆ _bar_flag_

template<typename GUM_SCALAR >
bool gum::FMDPFactory< GUM_SCALAR >::_bar_flag_
private

Depending on the context this flag is used for some VERY important reasons.

Definition at line 270 of file fmdpFactory.h.

◆ _ddBag_

template<typename GUM_SCALAR >
std::vector< const MultiDimImplementation< GUM_SCALAR >* > gum::FMDPFactory< GUM_SCALAR >::_ddBag_
private

Just to keep track of multidim between two start/end calls.

Definition at line 276 of file fmdpFactory.h.

◆ _fmdp_

template<typename GUM_SCALAR >
FMDP< GUM_SCALAR >* gum::FMDPFactory< GUM_SCALAR >::_fmdp_
private

The constructed FMDP.

Definition at line 297 of file fmdpFactory.h.

◆ _foo_flag_

template<typename GUM_SCALAR >
bool gum::FMDPFactory< GUM_SCALAR >::_foo_flag_
private

Depending on the context this flag is used for some VERY important reasons.

Definition at line 266 of file fmdpFactory.h.

◆ _FunctionGraph_

template<typename GUM_SCALAR >
MultiDimFunctionGraph< GUM_SCALAR >* gum::FMDPFactory< GUM_SCALAR >::_FunctionGraph_
private

The FunctionGraph we're building at a given time.

Definition at line 300 of file fmdpFactory.h.

◆ _states_

template<typename GUM_SCALAR >
std::vector< FMDPfactory_state > gum::FMDPFactory< GUM_SCALAR >::_states_
private

State stack.

Definition at line 294 of file fmdpFactory.h.

◆ _stringBag_

template<typename GUM_SCALAR >
std::vector< std::string > gum::FMDPFactory< GUM_SCALAR >::_stringBag_
private

Just to keep track of strings between two start/end calls.

Definition at line 273 of file fmdpFactory.h.

◆ _varNameMap_

template<typename GUM_SCALAR >
HashTable< std::string, const DiscreteVariable* > gum::FMDPFactory< GUM_SCALAR >::_varNameMap_
private

Mapping between a declared variable's name and itself.

Definition at line 303 of file fmdpFactory.h.


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