aGrUM  0.20.2
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  :
58  fmdp__(fmdp) {
59  GUM_CONSTRUCTOR(FMDPFactory);
60 
62  resetVerbose();
63  actionIdcpt__ = 1;
64  }
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
FMDP< GUM_SCALAR > * fmdp() const
Returns the Factored Markov Decision Process created by this factory.
std::vector< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
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:307
+ 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 70 of file fmdpFactory_tpl.h.

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

70  {
71  GUM_DESTRUCTOR(FMDPFactory);
72  }
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

◆ 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 284 of file fmdpFactory_tpl.h.

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

284  {
286  illegalStateError__("addAction");
287  else {
288  stringBag__.push_back(action);
289  fmdp__->addAction(actionIdcpt__++, action);
290  }
291  }
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
Idx actionIdcpt__
Action Id counter.
Definition: fmdpFactory.h:307
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 665 of file fmdpFactory_tpl.h.

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

665  {
666  FunctionGraph__->manager()->setSon(from, modality, to);
667  }
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:301
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 420 of file fmdpFactory_tpl.h.

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

420  {
421  const MultiDimImplementation< GUM_SCALAR >* c
422  = reinterpret_cast< const MultiDimImplementation< GUM_SCALAR >* >(cost);
423 
425  illegalStateError__("addCost");
426  else if (foo_flag__)
427  fmdp__->addCostForAction(fmdp__->actionId(stringBag__[0]), c);
428  else
429  fmdp__->addCost(c);
430  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 437 of file fmdpFactory_tpl.h.

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

437  {
439  illegalStateError__("addCost");
440  else {
441  this->finalizeFunctionGraph__();
442 
443  if (foo_flag__)
444  fmdp__->addCostForAction(fmdp__->actionId(stringBag__[0]),
445  this->FunctionGraph__);
446  else
447  fmdp__->addCost(this->FunctionGraph__);
448  }
449  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
MultiDimFunctionGraph< GUM_SCALAR > * FunctionGraph__
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:301
void finalizeFunctionGraph__()
Insert every variables in the function graph.
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 614 of file fmdpFactory_tpl.h.

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

614  {
615  if (state() != FMDPfactory_state::DISCOUNT) illegalStateError__("addDiscount");
616  // else
617  // fmdp__->setDiscount ( ( GUM_SCALAR ) discount );
618  }
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 649 of file fmdpFactory_tpl.h.

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

649  {
650  return FunctionGraph__->manager()->addInternalNode(variable(name_of_var));
651  }
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.
MultiDimFunctionGraph< GUM_SCALAR > * FunctionGraph__
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:301
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 185 of file fmdpFactory_tpl.h.

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

185  {
187  illegalStateError__("addModality");
188  else {
189  checkModalityInBag__(name);
190  stringBag__.push_back(name);
191  }
192  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
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.".
+ 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 506 of file fmdpFactory_tpl.h.

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

506  {
507  const MultiDimImplementation< GUM_SCALAR >* r
508  = reinterpret_cast< const MultiDimImplementation< GUM_SCALAR >* >(reward);
509 
511  illegalStateError__("addReward");
512  else
513  fmdp__->addReward(r);
514  }
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
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 522 of file fmdpFactory_tpl.h.

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

522  {
524  illegalStateError__("addReward");
525  else {
526  this->finalizeFunctionGraph__();
527  FunctionGraph__->setTableName("Reward");
528 
529  if (foo_flag__)
530  ddBag__.push_back(this->FunctionGraph__);
531  else
532  fmdp__->addReward(this->FunctionGraph__);
533  }
534  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< const MultiDimImplementation< GUM_SCALAR > *> ddBag__
Just to keep track of multidim between two start/end calls.
Definition: fmdpFactory.h:277
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
MultiDimFunctionGraph< GUM_SCALAR > * FunctionGraph__
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:301
void finalizeFunctionGraph__()
Insert every variables in the function graph.
void setTableName(const std::string &name)
Sets the name of the table represented by this structure.
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 657 of file fmdpFactory_tpl.h.

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

657  {
658  return FunctionGraph__->manager()->addTerminalNode((GUM_SCALAR)value);
659  }
MultiDimFunctionGraph< GUM_SCALAR > * FunctionGraph__
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:301
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 337 of file fmdpFactory_tpl.h.

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

339  {
340  const MultiDimImplementation< GUM_SCALAR >* t
341  = reinterpret_cast< const MultiDimImplementation< GUM_SCALAR >* >(
342  transition);
343 
345  illegalStateError__("addTransition");
346  else if (foo_flag__)
347  fmdp__->addTransitionForAction(fmdp__->actionId(stringBag__[0]),
348  varNameMap__[var],
349  t);
350  else
351  fmdp__->addTransition(varNameMap__[var], t);
352  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
HashTable< std::string, const DiscreteVariable *> varNameMap__
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:304
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 360 of file fmdpFactory_tpl.h.

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

360  {
362  illegalStateError__("addTransition");
363  else {
364  this->finalizeFunctionGraph__();
365 
366  if (foo_flag__) {
367  this->FunctionGraph__->setTableName("ACTION :" + stringBag__[0]
368  + " - VARIABLE : " + var);
369  fmdp__->addTransitionForAction(fmdp__->actionId(stringBag__[0]),
370  varNameMap__[var],
371  this->FunctionGraph__);
372  } else {
373  fmdp__->addTransition(varNameMap__[var], this->FunctionGraph__);
374  }
375  }
376  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
HashTable< std::string, const DiscreteVariable *> varNameMap__
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:304
MultiDimFunctionGraph< GUM_SCALAR > * FunctionGraph__
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:301
void finalizeFunctionGraph__()
Insert every variables in the function graph.
void setTableName(const std::string &name)
Sets the name of the table represented by this structure.
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ Here is the call graph for this function:

◆ 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 199 of file fmdpFactory_tpl.h.

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

199  {
200  for (size_t i = 2; i < stringBag__.size(); ++i)
201  if (mod == stringBag__[i])
202  GUM_ERROR(DuplicateElement, "Modality" << mod << " already exists.");
203  }
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54
+ 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 297 of file fmdpFactory_tpl.h.

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

297  {
299  illegalStateError__("endActionDeclaration");
300  else {
301  states__.pop_back();
302  resetParts__();
303  }
304 
305  // VERBOSITY ( "action OK" );
306  }
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:295
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 455 of file fmdpFactory_tpl.h.

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

455  {
457  illegalStateError__("endCostDeclaration");
458  else
459  states__.pop_back();
460 
461  // VERBOSITY ( "Cost OK" );
462  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
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 624 of file fmdpFactory_tpl.h.

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

624  {
626  illegalStateError__("endDiscountDeclaration");
627  else
628  states__.pop_back();
629 
630  // VERBOSITY ( "discount OK" );
631  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
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 540 of file fmdpFactory_tpl.h.

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

540  {
542  illegalStateError__("endRewardDeclaration");
543  else {
544  if (foo_flag__) {
545  MultiDimImplementation< GUM_SCALAR >* res = nullptr;
546  MultiDimImplementation< GUM_SCALAR >* temp;
547 
548  for (const auto elt: ddBag__) {
549  temp = res;
550 
551  switch (stringBag__[0][0]) {
552  case '+':
553  res = add2MultiDimFunctionGraphs(res, elt);
554  break;
555 
556  case '-':
557  res = subtract2MultiDimFunctionGraphs(res, elt);
558  break;
559 
560  case '*':
561  res = multiply2MultiDimFunctionGraphs(res, elt);
562  break;
563 
564  case '/':
565  res = divide2MultiDimFunctionGraphs(res, elt);
566  break;
567 
568  default:
569  break;
570  }
571 
572  delete elt;
573 
574  if (temp != nullptr) delete temp;
575  }
576  reinterpret_cast< MultiDimFunctionGraph< GUM_SCALAR >* >(res)
577  ->setTableName("Reward");
578  fmdp__->addReward(res);
579  }
580 
581  resetParts__();
582  states__.pop_back();
583  }
584  // VERBOSITY ( "reward OK" );
585  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< const MultiDimImplementation< GUM_SCALAR > *> ddBag__
Just to keep track of multidim between two start/end calls.
Definition: fmdpFactory.h:277
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
MultiDimFunctionGraph< T > * subtract2MultiDimFunctionGraphs(const MultiDimFunctionGraph< T > *t1, const MultiDimFunctionGraph< T > *t2)
a specialized function for subtracting two multiDimArraysThe function produces a tensorial subtractio...
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
MultiDimFunctionGraph< T > * multiply2MultiDimFunctionGraphs(const MultiDimFunctionGraph< T > *t1, const MultiDimFunctionGraph< T > *t2)
a specialized function for multiplying two multiDimArraysThe function produces a tensorial product of...
void resetParts__()
Reset the different parts used to constructed the FMDP.
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< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 382 of file fmdpFactory_tpl.h.

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

382  {
384  illegalStateError__("endTransitionDeclaration");
385  else
386  states__.pop_back();
387 
388  // VERBOSITY ( "transition OK" );
389  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
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 209 of file fmdpFactory_tpl.h.

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

209  {
211  illegalStateError__("endVariableDeclaration");
212  else if (foo_flag__ && (stringBag__.size() > 3)) {
213  LabelizedVariable* var
214  = new LabelizedVariable(stringBag__[0],
215  (bar_flag__) ? stringBag__[1] : "",
216  0);
217 
218  for (size_t i = 2; i < stringBag__.size(); ++i) {
219  var->addLabel(stringBag__[i]);
220  }
221 
222  fmdp__->addVariable(var);
223  varNameMap__.insert(var->name(), var);
224  varNameMap__.insert(fmdp__->main2prime(var)->name(),
225  fmdp__->main2prime(var));
226 
227  resetParts__();
228  states__.pop_back();
229 
230  // VERBOSITY ( " variable " << var->name() << " OK" );
231 
232  } else {
233  std::stringstream msg;
234  msg << "Not enough modalities (";
235 
236  if (stringBag__.size() > 2)
237  msg << stringBag__.size() - 2;
238  else
239  msg << 0;
240 
241  msg << ") declared for variable ";
242 
243  if (foo_flag__)
244  msg << stringBag__[0];
245  else
246  msg << "unknown";
247 
248  resetParts__();
249  states__.pop_back();
250 
251  GUM_ERROR(OperationNotAllowed, msg.str());
252  }
253  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
HashTable< std::string, const DiscreteVariable *> varNameMap__
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:304
void resetParts__()
Reset the different parts used to constructed the FMDP.
bool bar_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:271
std::vector< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 762 of file fmdpFactory_tpl.h.

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

762  {
763  this->FunctionGraph__->manager()->reduce();
764  this->FunctionGraph__->manager()->clean();
765  }
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:301
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:

◆ 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 87 of file fmdpFactory_tpl.h.

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

87  {
89  GUM_ERROR(OperationNotAllowed,
90  "Illegal state to return the factored "
91  "markov decision process: it is not yet "
92  "finished.");
93 
94  return fmdp__;
95  }
FMDPfactory_state state() const
Returns the current state of the factory.
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54
+ 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 688 of file fmdpFactory_tpl.h.

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

688  {
689  std::string msg = "Illegal state call (";
690  msg += s;
691  msg += ") in state ";
692 
693  switch (state()) {
695  msg += "FMDPfactory_state::NONE";
696  break;
697 
699  msg += "FMDPfactory_state::VARIABLE";
700  break;
701 
703  msg += "FMDPfactory_state::ACTION";
704  break;
705 
707  msg += "FMDPfactory_state::TRANSITION";
708  break;
709 
711  msg += "FMDPfactory_state::COST";
712  break;
713 
715  msg += "FMDPfactory_state::REWARD";
716  break;
717 
719  msg += "FMDPfactory_state::DISCOUNT";
720  break;
721 
722  default:
723  msg += "Unknown state";
724  }
725 
726  GUM_ERROR(OperationNotAllowed, msg);
727  }
FMDPfactory_state state() const
Returns the current state of the factory.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54
+ 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 742 of file fmdpFactory_tpl.h.

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

742  {
743  this->FunctionGraph__
745  // Recopie des variables principales dans le graphe de décision
746  for (auto varIter = fmdp__->beginVariables();
747  varIter != fmdp__->endVariables();
748  ++varIter) {
749  FunctionGraph__->add(**varIter);
750  }
751 
752  // Recopie des version primes des variables dans le graphe de décision
753  for (auto varIter = fmdp__->beginVariables();
754  varIter != fmdp__->endVariables();
755  ++varIter) {
756  FunctionGraph__->add(*(fmdp__->main2prime(*varIter)));
757  }
758  }
FMDP< GUM_SCALAR > * fmdp__
The constructed FMDP.
Definition: fmdpFactory.h:298
virtual void add(const DiscreteVariable &v)
Adds a new var to the variables of the multidimensional matrix.
MultiDimFunctionGraph< GUM_SCALAR > * FunctionGraph__
The FunctionGraph we&#39;re building at a given time.
Definition: fmdpFactory.h:301
static MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * getReducedAndOrderedInstance()
Returns a reduced and ordered instance.
+ Here is the call graph for this function:

◆ isVerbose()

bool gum::AbstractFMDPFactory::isVerbose ( )
inlineinherited

Definition at line 278 of file IfmdpFactory.h.

References gum::AbstractFMDPFactory::verbose__.

278 { 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 783 of file fmdpFactory_tpl.h.

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

784  {
785  GUM_ERROR(FatalError, "Illegal!");
786  // For noisy compilers
787  return *this;
788  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54
+ 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 733 of file fmdpFactory_tpl.h.

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

733  {
734  foo_flag__ = false;
735  bar_flag__ = false;
736  stringBag__.clear();
737  ddBag__.clear();
738  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
std::vector< const MultiDimImplementation< GUM_SCALAR > *> ddBag__
Just to keep track of multidim between two start/end calls.
Definition: fmdpFactory.h:277
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
bool bar_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:271
+ Here is the call graph for this function:

◆ resetVerbose()

void gum::AbstractFMDPFactory::resetVerbose ( )
inlineinherited

Definition at line 276 of file IfmdpFactory.h.

References gum::AbstractFMDPFactory::verbose__.

276 { 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 495 of file fmdpFactory_tpl.h.

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

495  {
496  foo_flag__ = true;
497  std::string ot(operationType);
498  stringBag__.push_back(ot);
499  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
+ 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 671 of file fmdpFactory_tpl.h.

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

671  {
672  FunctionGraph__->manager()->setRootNode(rootId);
673  }
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:301
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 274 of file IfmdpFactory.h.

References gum::AbstractFMDPFactory::verbose__.

274 { 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 269 of file fmdpFactory_tpl.h.

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

269  {
271  illegalStateError__("startActionDeclaration");
272  else {
273  foo_flag__ = true;
275  }
276 
277  // VERBOSITY ( "starting action declaration" );
278  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 406 of file fmdpFactory_tpl.h.

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

406  {
408  illegalStateError__("startTransitionDeclaration");
409  else
411 
412  // VERBOSITY ( "starting Cost declaration" );
414  }
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:295
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 601 of file fmdpFactory_tpl.h.

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

601  {
603  illegalStateError__("startDiscountDeclaration");
604  else
606 
607  // VERBOSITY ( "starting discount declaration" );
608  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
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 479 of file fmdpFactory_tpl.h.

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

479  {
481  illegalStateError__("startRewardDeclaration");
482  else
484 
485  // VERBOSITY ( "starting reward declaration" );
487  }
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:295
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 323 of file fmdpFactory_tpl.h.

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

323  {
325  illegalStateError__("startTransitionDeclaration");
326  else
328 
329  // VERBOSITY ( "starting transition declaration" );
331  }
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:295
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 136 of file fmdpFactory_tpl.h.

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

136  {
138  illegalStateError__("startVariableDeclaration");
139  else {
141  stringBag__.push_back("name");
142  stringBag__.push_back("desc");
143  }
144 
145  // VERBOSITY ( " starting variable" );
146  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
std::vector< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 101 of file fmdpFactory_tpl.h.

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

101  {
102  // This is ok because there is alway at least the state
103  // FMDPfactory_state::NONE in the stack.
104  return states__.back();
105  }
std::vector< FMDPfactory_state > states__
State stack.
Definition: fmdpFactory.h:295
+ 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 113 of file fmdpFactory_tpl.h.

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

113  {
114  for (const auto& elt: varNameMap__)
115  if (elt.first.compare(name) == 0) return elt.second;
116 
117  GUM_ERROR(NotFound, name);
118 
119  return nullptr;
120  }
HashTable< std::string, const DiscreteVariable *> varNameMap__
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:304
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54
+ 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 170 of file fmdpFactory_tpl.h.

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

170  {
172  illegalStateError__("variableDescription");
173  else {
174  bar_flag__ = true;
175  stringBag__[1] = desc;
176  }
177  }
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
bool bar_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:271
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 152 of file fmdpFactory_tpl.h.

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

152  {
154  illegalStateError__("variableName");
155  else {
156  if (varNameMap__.exists(name))
157  GUM_ERROR(DuplicateElement, "Name already used: " + name);
158 
159  foo_flag__ = true;
160  stringBag__[0] = name;
161  // VERBOSITY ( " -- variable " << name );
162  }
163  }
bool foo_flag__
Depending on the context this flag is used for some VERY important reasons.
Definition: fmdpFactory.h:267
FMDPfactory_state state() const
Returns the current state of the factory.
std::vector< std::string > stringBag__
Just to keep track of strings between two start/end calls.
Definition: fmdpFactory.h:274
HashTable< std::string, const DiscreteVariable *> varNameMap__
Mapping between a declared variable&#39;s name and itself.
Definition: fmdpFactory.h:304
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54
void illegalStateError__(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
+ 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 307 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 271 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 277 of file fmdpFactory.h.

◆ fmdp__

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

The constructed FMDP.

Definition at line 298 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 267 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 301 of file fmdpFactory.h.

◆ states__

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

State stack.

Definition at line 295 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 274 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 304 of file fmdpFactory.h.


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