30 #ifndef GUM_FMDP_FACTORY_H 31 #define GUM_FMDP_FACTORY_H 36 #include <agrum/tools/core/sequence.h> 38 #include <agrum/tools/variables/labelizedVariable.h> 40 #include <agrum/FMDP/IfmdpFactory.h> 41 #include <agrum/FMDP/fmdp.h> 70 template <
typename GUM_SCALAR >
151 void addAction(
const std::string& action);
166 void addTransition(
const std::string& var,
const MultiDimAdressable* transition);
186 void addCost(
const MultiDimAdressable* cost);
211 void addReward(
const MultiDimAdressable* reward);
251 void addArc(NodeId from, NodeId to, Idx modality);
316 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 323 #include <agrum/FMDP/fmdpFactory_tpl.h> void addReward()
Tells the factory to add a reward table to the current fmdp. This reward table will be extracted from...
void _finalizeFunctionGraph_()
Insert every variables in the function graph.
void endTransitionDeclaration()
Tells the factory that we're out of a transition declaration.
FMDPfactory_state state() const
Returns the current state of the factory.
void endActionDeclaration()
Tells the factory that we're out of an action declaration.
A factory class to ease Factored Markov Decision Process construction.
void _initializeFunctionGraph_()
Insert every variables in the function graph.
void _resetParts_()
Reset the different parts used to constructed the FMDP.
void addTransition(const std::string &var)
Tells the factory to add a transition table to the current fmdp. This transition table will be extrac...
void addCost(const MultiDimAdressable *cost)
Tells the factory to add a cost table to the current fmdp.
FMDPFactory< GUM_SCALAR > & operator=(const FMDPFactory< GUM_SCALAR > &source)
Copy operator is illegal, use only copy constructor.
void addAction(const std::string &action)
Tells the factory to add an action to the current fmdp.
INLINE void emplace(Args &&... args)
void startDiscountDeclaration()
Tells the factory that we're in a cost declaration.
void startActionDeclaration()
Tells the factory that we're in an action declaration.
void addDiscount(float discount)
Tells the factory to add a cost table to the current fmdp.
void startVariableDeclaration()
Tells the factory that we're in a variable declaration.
void _checkModalityInBag_(const std::string &mod)
Used in VARIABLE mode Checks if in stringBag there is no other modality with the same name...
void endCostDeclaration()
Tells the factory that we're out of a cost declaration.
void addArc(NodeId from, NodeId to, Idx modality)
Insert in diagram a non terminal node.
HashTable< std::string, const DiscreteVariable *> _varNameMap_
Mapping between a declared variable's name and itself.
MultiDimFunctionGraph< GUM_SCALAR > * _FunctionGraph_
The FunctionGraph we're building at a given time.
void setRoot(NodeId rootId)
add an arc in diagram
const DiscreteVariable * variable(const std::string &name) const
Returns a constant reference on a variable given it's name.
void addModality(const std::string &name)
Adds a modality to the current variable.
FMDP< GUM_SCALAR > * fmdp() const
Returns the Factored Markov Decision Process created by this factory.
void addReward(const MultiDimAdressable *reward)
Tells the factory to add a reward table to the current fmdp.
FMDP< GUM_SCALAR > * _fmdp_
The constructed FMDP.
void endDiscountDeclaration()
Tells the factory that we're out of a cost declaration.
~FMDPFactory()
Destructor.
std::vector< FMDPfactory_state > _states_
State stack.
void addTransition(const std::string &var, const MultiDimAdressable *transition)
Tells the factory to add a transition table to the current fmdp.
void _illegalStateError_(const std::string &s)
Raise an OperationNotAllowed with the message "Illegal state.".
void addCost()
Tells the factory to add a cost table to the current fmdp. This cost table will be extracted from inc...
std::vector< const MultiDimImplementation< GUM_SCALAR > *> _ddBag_
Just to keep track of multidim between two start/end calls.
bool _foo_flag_
Depending on the context this flag is used for some VERY important reasons.
void endRewardDeclaration()
Tells the factory that we're out of a cost declaration.
bool _bar_flag_
Depending on the context this flag is used for some VERY important reasons.
void endVariableDeclaration()
Tells the factory that we're out of a variable declaration.
NodeId addInternalNode(std::string name_of_var)
Insert in diagram a non terminal node.
void startCostDeclaration()
Tells the factory that we're in a cost declaration.
NodeId addTerminalNode(float value)
Insert in diagram a terminal node.
void variableName(const std::string &name)
Tells the factory the current variable's name.
std::vector< std::string > _stringBag_
Just to keep track of strings between two start/end calls.
void variableDescription(const std::string &desc)
Tells the factory the current variable's description.
void setOperationModeOn(std::string operationType)
Tells the factory that we're in a reward declaration mode where the global reward diagram is an opera...
void startRewardDeclaration()
Tells the factory that we're in a reward declaration.
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.
void startTransitionDeclaration()
Tells the factory that we're in a transition declaration.