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

Private Attributes

bool _verbose_

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

Constructor & Destructor Documentation

◆ ~AbstractFMDPFactory()

virtual gum::AbstractFMDPFactory::~AbstractFMDPFactory ( )
virtualdefault

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.

Member Function Documentation

◆ addAction()

virtual void gum::AbstractFMDPFactory::addAction ( std::string_view action)
pure virtual

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ addArc()

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

Insert in diagram an arc.

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ addCost() [1/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_ELEMENT >.

◆ addCost() [2/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_ELEMENT >.

◆ 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_ELEMENT >.

◆ addInternalNode()

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

Insert in diagram a non terminal node.

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ addModality()

virtual void gum::AbstractFMDPFactory::addModality ( std::string_view name)
pure virtual

Adds a modality to the current variable.

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ addReward() [1/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_ELEMENT >.

◆ addReward() [2/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_ELEMENT >.

◆ addTerminalNode()

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

Insert in diagram a terminal node.

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ addTransition() [1/2]

virtual void gum::AbstractFMDPFactory::addTransition ( std::string_view 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_ELEMENT >.

◆ addTransition() [2/2]

virtual void gum::AbstractFMDPFactory::addTransition ( std::string_view var,
const MultiDimAdressable * transition )
pure virtual

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ endActionDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ endCostDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ endDiscountDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ endRewardDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ endTransitionDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ 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_ELEMENT >.

◆ isVerbose()

INLINE bool gum::AbstractFMDPFactory::isVerbose ( )

Definition at line 52 of file IfmdpFactory_inl.h.

52{ return _verbose_; }

References _verbose_.

◆ resetVerbose()

INLINE void gum::AbstractFMDPFactory::resetVerbose ( )

Definition at line 50 of file IfmdpFactory_inl.h.

50{ _verbose_ = false; }

References _verbose_.

Referenced by gum::FMDPFactory< GUM_ELEMENT >::FMDPFactory().

Here is the caller graph for this function:

◆ setOperationModeOn()

virtual void gum::AbstractFMDPFactory::setOperationModeOn ( std::string_view 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_ELEMENT >.

◆ setRoot()

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

Set the root of the diagram.

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ setVerbose()

INLINE void gum::AbstractFMDPFactory::setVerbose ( )

Definition at line 48 of file IfmdpFactory_inl.h.

48{ _verbose_ = true; }

References _verbose_.

◆ startActionDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ startCostDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ startDiscountDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ startRewardDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ startTransitionDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ startVariableDeclaration()

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

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

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ state()

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

Returns the current state of the factory.

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ variable()

virtual const DiscreteVariable * gum::AbstractFMDPFactory::variable ( std::string_view 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_ELEMENT >.

◆ variableDescription()

virtual void gum::AbstractFMDPFactory::variableDescription ( std::string_view desc)
pure virtual

Tells the factory the current variable's description.

Implemented in gum::FMDPFactory< GUM_ELEMENT >.

◆ variableName()

virtual void gum::AbstractFMDPFactory::variableName ( std::string_view 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_ELEMENT >.

Member Data Documentation

◆ _verbose_

bool gum::AbstractFMDPFactory::_verbose_
private

Definition at line 298 of file IfmdpFactory.h.

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


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