aGrUM  0.14.2
IfmdpFactory.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 #ifndef GUM_ABSTRACT_FMDP_FACTORY_H
28 #define GUM_ABSTRACT_FMDP_FACTORY_H
29 
30 #include <string>
31 #include <vector>
32 
35 
36 #include <agrum/FMDP/fmdp.h>
37 
38 
39 namespace gum {
40 
50  enum class FMDPfactory_state : char {
51  NONE,
52  VARIABLE,
53  ACTION,
54  TRANSITION,
55  COST,
56  REWARD,
57  DISCOUNT
58  };
59 
84  public:
85  // ==========================================================================
87  // ==========================================================================
89 
90  //~ /**
91  //~ * @brief Copy constructor.
92  //~ * The copy will have an exact copy of the constructed Factored markov
93  // Decision Process in source.
94  //~ * @warning You can only copy a factory if its current state is NONE or
95  //~ * NETWORK.
96  //~ * @throw OperationNotAllowed Raised if the state of source is not NONE
97  // or
98  //~ * NETWORK.
99  //~ */
100  //~ FMDPFactory ( const FMDPFactory<GUM_SCALAR>& source );
101 
111  virtual ~AbstractFMDPFactory(){};
112 
114  // ==========================================================================
116  // ==========================================================================
118 
120  virtual FMDPfactory_state state() const = 0;
121 
124  virtual const DiscreteVariable* variable(const std::string& name) const = 0;
125 
127  // ==========================================================================
129  // ==========================================================================
131 
133  virtual void startVariableDeclaration() = 0;
134 
138  virtual void variableName(const std::string& name) = 0;
139 
141  virtual void variableDescription(const std::string& desc) = 0;
142 
144  virtual void addModality(const std::string& name) = 0;
145 
149  virtual void endVariableDeclaration() = 0;
150 
152  // ==========================================================================
154  // ==========================================================================
156 
158  virtual void startActionDeclaration() = 0;
159 
161  virtual void addAction(const std::string& action) = 0;
162 
164  virtual void endActionDeclaration() = 0;
165 
167  // ==========================================================================
169  // ==========================================================================
171 
173  virtual void startTransitionDeclaration() = 0;
174 
176  virtual void addTransition(const std::string& var,
177  const MultiDimAdressable* transition) = 0;
178 
182  virtual void addTransition(const std::string& var) = 0;
183 
185  virtual void endTransitionDeclaration() = 0;
186 
188  // ==========================================================================
190  // ==========================================================================
192 
194  virtual void startCostDeclaration() = 0;
195 
197  virtual void addCost(const MultiDimAdressable* cost) = 0;
198 
201  virtual void addCost() = 0;
202 
204  virtual void endCostDeclaration() = 0;
205 
207  // ==========================================================================
209  // ==========================================================================
211 
213  virtual void startRewardDeclaration() = 0;
214 
218  virtual void setOperationModeOn(std::string operationType) = 0;
219 
221  virtual void addReward(const MultiDimAdressable* reward) = 0;
222 
225  virtual void addReward() = 0;
226 
228  virtual void endRewardDeclaration() = 0;
229 
231  // ==========================================================================
233  // ==========================================================================
235 
237  virtual void startDiscountDeclaration() = 0;
238 
240  virtual void addDiscount(float discount) = 0;
241 
243  virtual void endDiscountDeclaration() = 0;
244 
246  // ==========================================================================
248  // ==========================================================================
250 
252  virtual NodeId addInternalNode(std::string name_of_var) = 0;
253 
255  virtual NodeId addTerminalNode(float value) = 0;
256 
258  virtual void addArc(NodeId from, NodeId to, Idx modality) = 0;
259 
261  virtual void setRoot(NodeId rootId) = 0;
262 
264 
269  void setVerbose() { __verbose = true; }
270 
271  void resetVerbose() { __verbose = false; }
272 
273  bool isVerbose() { return __verbose; }
275 
276  private:
277  bool __verbose;
278  };
279 } /* namespace gum */
280 
281 
282 #endif // GUM_ABSTRACT_FMDP_FACTORY_H
virtual ~AbstractFMDPFactory()
Destructor.
Definition: IfmdpFactory.h:111
Base class for discrete random variable.
FMDPfactory_state
The enumeration of states in which the factory can be in.
Definition: IfmdpFactory.h:50
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Class for implementation of factored markov decision process.
Abstract base class for all multi dimensionnal addressable.
A factory class to ease Factored Markov Decision Process construction.
Definition: IfmdpFactory.h:83
Size Idx
Type for indexes.
Definition: types.h:50
Size NodeId
Type for node ids.
Definition: graphElements.h:97
some utils for topology : NodeId, Edge, Arc and consorts ...