aGrUM  0.16.0
IfmdpFactory.h
Go to the documentation of this file.
1 
30 #ifndef GUM_ABSTRACT_FMDP_FACTORY_H
31 #define GUM_ABSTRACT_FMDP_FACTORY_H
32 
33 #include <string>
34 #include <vector>
35 
38 
39 #include <agrum/FMDP/fmdp.h>
40 
41 
42 namespace gum {
43 
53  enum class FMDPfactory_state : char {
54  NONE,
55  VARIABLE,
56  ACTION,
57  TRANSITION,
58  COST,
59  REWARD,
60  DISCOUNT
61  };
62 
87  public:
88  // ==========================================================================
90  // ==========================================================================
92 
93  //~ /**
94  //~ * @brief Copy constructor.
95  //~ * The copy will have an exact copy of the constructed Factored markov
96  // Decision Process in source.
97  //~ * @warning You can only copy a factory if its current state is NONE or
98  //~ * NETWORK.
99  //~ * @throw OperationNotAllowed Raised if the state of source is not NONE
100  // or
101  //~ * NETWORK.
102  //~ */
103  //~ FMDPFactory ( const FMDPFactory<GUM_SCALAR>& source );
104 
114  virtual ~AbstractFMDPFactory(){};
115 
117  // ==========================================================================
119  // ==========================================================================
121 
123  virtual FMDPfactory_state state() const = 0;
124 
127  virtual const DiscreteVariable* variable(const std::string& name) const = 0;
128 
130  // ==========================================================================
132  // ==========================================================================
134 
136  virtual void startVariableDeclaration() = 0;
137 
141  virtual void variableName(const std::string& name) = 0;
142 
144  virtual void variableDescription(const std::string& desc) = 0;
145 
147  virtual void addModality(const std::string& name) = 0;
148 
152  virtual void endVariableDeclaration() = 0;
153 
155  // ==========================================================================
157  // ==========================================================================
159 
161  virtual void startActionDeclaration() = 0;
162 
164  virtual void addAction(const std::string& action) = 0;
165 
167  virtual void endActionDeclaration() = 0;
168 
170  // ==========================================================================
172  // ==========================================================================
174 
176  virtual void startTransitionDeclaration() = 0;
177 
179  virtual void addTransition(const std::string& var,
180  const MultiDimAdressable* transition) = 0;
181 
185  virtual void addTransition(const std::string& var) = 0;
186 
188  virtual void endTransitionDeclaration() = 0;
189 
191  // ==========================================================================
193  // ==========================================================================
195 
197  virtual void startCostDeclaration() = 0;
198 
200  virtual void addCost(const MultiDimAdressable* cost) = 0;
201 
204  virtual void addCost() = 0;
205 
207  virtual void endCostDeclaration() = 0;
208 
210  // ==========================================================================
212  // ==========================================================================
214 
216  virtual void startRewardDeclaration() = 0;
217 
221  virtual void setOperationModeOn(std::string operationType) = 0;
222 
224  virtual void addReward(const MultiDimAdressable* reward) = 0;
225 
228  virtual void addReward() = 0;
229 
231  virtual void endRewardDeclaration() = 0;
232 
234  // ==========================================================================
236  // ==========================================================================
238 
240  virtual void startDiscountDeclaration() = 0;
241 
243  virtual void addDiscount(float discount) = 0;
244 
246  virtual void endDiscountDeclaration() = 0;
247 
249  // ==========================================================================
251  // ==========================================================================
253 
255  virtual NodeId addInternalNode(std::string name_of_var) = 0;
256 
258  virtual NodeId addTerminalNode(float value) = 0;
259 
261  virtual void addArc(NodeId from, NodeId to, Idx modality) = 0;
262 
264  virtual void setRoot(NodeId rootId) = 0;
265 
267 
272  void setVerbose() { __verbose = true; }
273 
274  void resetVerbose() { __verbose = false; }
275 
276  bool isVerbose() { return __verbose; }
278 
279  private:
280  bool __verbose;
281  };
282 } /* namespace gum */
283 
284 
285 #endif // GUM_ABSTRACT_FMDP_FACTORY_H
virtual ~AbstractFMDPFactory()
Destructor.
Definition: IfmdpFactory.h:114
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
FMDPfactory_state
The enumeration of states in which the factory can be in.
Definition: IfmdpFactory.h:53
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Abstract base class for all multi dimensionnal addressable.
A factory class to ease Factored Markov Decision Process construction.
Definition: IfmdpFactory.h:86
Size Idx
Type for indexes.
Definition: types.h:53
Size NodeId
Type for node ids.
Definition: graphElements.h:98
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.