aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::AbstractFMDPFactory Class Referenceabstract

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

#include <agrum/FMDP/IfmdpFactory.h>

+ Inheritance diagram for gum::AbstractFMDPFactory:
+ Collaboration diagram for gum::AbstractFMDPFactory:

Public Member Functions

Constructor & destructor.
virtual ~AbstractFMDPFactory ()
 Destructor. More...
 
Getter and setters.
virtual FMDPfactory_state state () const =0
 Returns the current state of the factory. More...
 
virtual const DiscreteVariablevariable (const std::string &name) const =0
 Returns a constant reference on a variable given it's name. More...
 
Variable declaration methods (NONE -> VARIABLE)
virtual void startVariableDeclaration ()=0
 Tells the factory that we're in a variable declaration. More...
 
virtual void variableName (const std::string &name)=0
 Tells the factory the current variable's name. More...
 
virtual void variableDescription (const std::string &desc)=0
 Tells the factory the current variable's description. More...
 
virtual void addModality (const std::string &name)=0
 Adds a modality to the current variable. More...
 
virtual void endVariableDeclaration ()=0
 Tells the factory that we're out of a variable declaration. More...
 
Action declaration methods (NONE -> ACTION)
virtual void startActionDeclaration ()=0
 Tells the factory that we're in an action declaration. More...
 
virtual void addAction (const std::string &action)=0
 Tells the factory to add an action to the current fmdp. More...
 
virtual void endActionDeclaration ()=0
 Tells the factory that we're out of an action declaration. More...
 
Transition declaration methods (NONE -> TRANSITION <- ACTION)
virtual void startTransitionDeclaration ()=0
 Tells the factory that we're in a transition declaration. More...
 
virtual void addTransition (const std::string &var, const MultiDimAdressable *transition)=0
 Tells the factory to add a transition table to the current fmdp. More...
 
virtual void addTransition (const std::string &var)=0
 Tells the factory to add a transition table to the current fmdp. This transition table will be extracted from incorporated multiDimFunctionGraph. More...
 
virtual void endTransitionDeclaration ()=0
 Tells the factory that we're out of a transition declaration. More...
 
Cost declaration methods (NONE -> COST <- ACTION)
virtual void startCostDeclaration ()=0
 Tells the factory that we're in a cost declaration. More...
 
virtual void addCost (const MultiDimAdressable *cost)=0
 Tells the factory to add a cost table to the current fmdp. More...
 
virtual void addCost ()=0
 Tells the factory to add current decision diagram it has as a cost table. More...
 
virtual void endCostDeclaration ()=0
 Tells the factory that we're out of a cost declaration. More...
 
Reward declaration methods (NONE -> REWARD <- ACTION)
virtual void startRewardDeclaration ()=0
 Tells the factory that we're in a cost declaration. More...
 
virtual void setOperationModeOn (std::string operationType)=0
 Tells the factory that we're in a reward declaration mode where the global reward diagram is an operation between simplier decision diagram.. More...
 
virtual void addReward (const MultiDimAdressable *reward)=0
 Tells the factory to add a reward table to the current fmdp. More...
 
virtual void addReward ()=0
 Tells the factory to add current decision diagram it has as a reward table. More...
 
virtual void endRewardDeclaration ()=0
 Tells the factory that we're out of a cost declaration. More...
 
Discount declaration methods (NONE -> DISCOUNT)
virtual void startDiscountDeclaration ()=0
 Tells the factory that we're in a cost declaration. More...
 
virtual void addDiscount (float discount)=0
 Tells the factory to add a cost table to the current fmdp. More...
 
virtual void endDiscountDeclaration ()=0
 Tells the factory that we're out of a cost declaration. More...
 
FunctionGraph Creation specific methods
virtual NodeId addInternalNode (std::string name_of_var)=0
 Insert in diagram a non terminal node. More...
 
virtual NodeId addTerminalNode (float value)=0
 Insert in diagram a terminal node. More...
 
virtual void addArc (NodeId from, NodeId to, Idx modality)=0
 Insert in diagram an arc. More...
 
virtual void setRoot (NodeId rootId)=0
 Set the root of the diagram. More...
 
verbosity control
void setVerbose ()
 
void resetVerbose ()
 
bool isVerbose ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ ~AbstractFMDPFactory()

virtual gum::AbstractFMDPFactory::~AbstractFMDPFactory ( )
inlinevirtual

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 115 of file IfmdpFactory.h.

115 {};

Member Function Documentation

◆ addAction()

virtual void gum::AbstractFMDPFactory::addAction ( const std::string &  action)
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addArc()

virtual void gum::AbstractFMDPFactory::addArc ( NodeId  from,
NodeId  to,
Idx  modality 
)
pure virtual

Insert in diagram an arc.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addCost() [1/2]

virtual void gum::AbstractFMDPFactory::addCost ( const MultiDimAdressable cost)
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addCost() [2/2]

virtual void gum::AbstractFMDPFactory::addCost ( )
pure virtual

Tells the factory to add current decision diagram it has as a cost table.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addDiscount()

virtual void gum::AbstractFMDPFactory::addDiscount ( float  discount)
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addInternalNode()

virtual NodeId gum::AbstractFMDPFactory::addInternalNode ( std::string  name_of_var)
pure virtual

Insert in diagram a non terminal node.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addModality()

virtual void gum::AbstractFMDPFactory::addModality ( const std::string &  name)
pure virtual

Adds a modality to the current variable.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addReward() [1/2]

virtual void gum::AbstractFMDPFactory::addReward ( const MultiDimAdressable reward)
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addReward() [2/2]

virtual void gum::AbstractFMDPFactory::addReward ( )
pure virtual

Tells the factory to add current decision diagram it has as a reward table.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addTerminalNode()

virtual NodeId gum::AbstractFMDPFactory::addTerminalNode ( float  value)
pure virtual

Insert in diagram a terminal node.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addTransition() [1/2]

virtual void gum::AbstractFMDPFactory::addTransition ( const std::string &  var,
const MultiDimAdressable transition 
)
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ addTransition() [2/2]

virtual void gum::AbstractFMDPFactory::addTransition ( const std::string &  var)
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ endActionDeclaration()

virtual void gum::AbstractFMDPFactory::endActionDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ endCostDeclaration()

virtual void gum::AbstractFMDPFactory::endCostDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ endDiscountDeclaration()

virtual void gum::AbstractFMDPFactory::endDiscountDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ endRewardDeclaration()

virtual void gum::AbstractFMDPFactory::endRewardDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ endTransitionDeclaration()

virtual void gum::AbstractFMDPFactory::endTransitionDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ endVariableDeclaration()

virtual void gum::AbstractFMDPFactory::endVariableDeclaration ( )
pure virtual

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

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ isVerbose()

bool gum::AbstractFMDPFactory::isVerbose ( )
inline

Definition at line 276 of file IfmdpFactory.h.

References _verbose_.

276 { return _verbose_; }

◆ resetVerbose()

void gum::AbstractFMDPFactory::resetVerbose ( )
inline

Definition at line 274 of file IfmdpFactory.h.

References _verbose_.

274 { _verbose_ = false; }

◆ setOperationModeOn()

virtual void gum::AbstractFMDPFactory::setOperationModeOn ( std::string  operationType)
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ setRoot()

virtual void gum::AbstractFMDPFactory::setRoot ( NodeId  rootId)
pure virtual

Set the root of the diagram.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ setVerbose()

void gum::AbstractFMDPFactory::setVerbose ( )
inline

Definition at line 272 of file IfmdpFactory.h.

References _verbose_.

272 { _verbose_ = true; }

◆ startActionDeclaration()

virtual void gum::AbstractFMDPFactory::startActionDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ startCostDeclaration()

virtual void gum::AbstractFMDPFactory::startCostDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ startDiscountDeclaration()

virtual void gum::AbstractFMDPFactory::startDiscountDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ startRewardDeclaration()

virtual void gum::AbstractFMDPFactory::startRewardDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ startTransitionDeclaration()

virtual void gum::AbstractFMDPFactory::startTransitionDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ startVariableDeclaration()

virtual void gum::AbstractFMDPFactory::startVariableDeclaration ( )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ state()

virtual FMDPfactory_state gum::AbstractFMDPFactory::state ( ) const
pure virtual

Returns the current state of the factory.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ variable()

virtual const DiscreteVariable* gum::AbstractFMDPFactory::variable ( const std::string &  name) const
pure virtual

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

Exceptions
NotFoundRaised if no variable matches the name.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ variableDescription()

virtual void gum::AbstractFMDPFactory::variableDescription ( const std::string &  desc)
pure virtual

Tells the factory the current variable's description.

Implemented in gum::FMDPFactory< GUM_SCALAR >.

◆ variableName()

virtual void gum::AbstractFMDPFactory::variableName ( const std::string &  name)
pure virtual

Tells the factory the current variable's name.

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

Implemented in gum::FMDPFactory< GUM_SCALAR >.

Member Data Documentation

◆ _verbose_

bool gum::AbstractFMDPFactory::_verbose_
private

Definition at line 280 of file IfmdpFactory.h.

Referenced by isVerbose(), resetVerbose(), and setVerbose().


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