aGrUM  0.13.2
IBayesNetFactory.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  ***************************************************************************/
26 #ifndef GUM_INTERFACE_BAYESNET_FACTORY_H
27 #define GUM_INTERFACE_BAYESNET_FACTORY_H
28 
29 #include <string>
30 #include <vector>
31 
35 
36 namespace gum {
47  public:
57  enum class factory_state : char {
58  NONE,
59  NETWORK,
60  VARIABLE,
61  PARENTS,
62  RAW_CPT,
63  FACT_CPT,
65  };
66 
68  // just to make some compilers happy
69  virtual ~IBayesNetFactory(){};
70 
75  void setVerbose() { __verbose = true; };
76 
77  void resetVerbose() { __verbose = false; };
78 
79  bool isVerbose() { return __verbose; };
80 
85  virtual const DiscreteVariable& varInBN(NodeId id) = 0;
88  virtual factory_state state() const = 0;
89  virtual NodeId variableId(const std::string& name) const = 0;
90  virtual Size cptDomainSize(NodeId n) const = 0;
91 
92  virtual void startNetworkDeclaration() = 0;
93  virtual void addNetworkProperty(const std::string& propName,
94  const std::string& propValue) = 0;
95  virtual void endNetworkDeclaration() = 0;
96  virtual void startVariableDeclaration() = 0;
97  virtual void variableName(const std::string& name) = 0;
98  virtual void variableDescription(const std::string& desc) = 0;
99  virtual void addModality(const std::string& name) = 0;
100  virtual void setVariableCPTImplementation(MultiDimAdressable* impl) = 0;
101  virtual NodeId endVariableDeclaration() = 0;
102  virtual void startParentsDeclaration(const std::string& var) = 0;
103  virtual void addParent(const std::string& var) = 0;
104  virtual void endParentsDeclaration() = 0;
105  virtual void startRawProbabilityDeclaration(const std::string& var) = 0;
106  virtual void rawConditionalTable(const std::vector< std::string >& variables,
107  const std::vector< float >& rawTable) = 0;
108  virtual void rawConditionalTable(const std::vector< float >& rawTable) = 0;
109  virtual void endRawProbabilityDeclaration() = 0;
110  virtual void startFactorizedProbabilityDeclaration(const std::string& var) = 0;
111  virtual void startFactorizedEntry() = 0;
112  virtual void endFactorizedEntry() = 0;
113  virtual void setParentModality(const std::string& parent,
114  const std::string& modality) = 0;
115  virtual void
116  setVariableValuesUnchecked(const std::vector< float >& values) = 0;
117  virtual void setVariableValues(const std::vector< float >& values) = 0;
118  virtual void endFactorizedProbabilityDeclaration() = 0;
119  virtual void setVariable(const DiscreteVariable& var) = 0;
120  virtual void setVariableCPT(const std::string& varName,
121  MultiDimAdressable* table,
122  bool redefineParents) = 0;
124 
125  private:
126  bool __verbose;
127  };
128 } /* namespace gum */
129 
130 #endif // GUM_ASBTRACT_BAYESNET_FACTORY_H
virtual void addNetworkProperty(const std::string &propName, const std::string &propValue)=0
Please.
virtual void variableName(const std::string &name)=0
Please.
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
unsigned int NodeId
Type for node ids.
Definition: graphElements.h:97
IBayesNetFactory is the non-template interface for BayesNetFactory : many ways to build a BN do not d...
virtual void startNetworkDeclaration()=0
Please.
virtual void endNetworkDeclaration()=0
Please.
virtual void endFactorizedEntry()=0
Please.
Base class for discrete random variable.
virtual void setVariableCPT(const std::string &varName, MultiDimAdressable *table, bool redefineParents)=0
Please.
virtual void setVariableValuesUnchecked(const std::vector< float > &values)=0
Please.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Header of class VariableNodeMap.
virtual void startParentsDeclaration(const std::string &var)=0
Please.
virtual void endParentsDeclaration()=0
Please.
factory_state
The enumeration of states in which the factory can be in.
virtual void addModality(const std::string &name)=0
Please.
virtual NodeId variableId(const std::string &name) const =0
Please.
virtual void setVariableValues(const std::vector< float > &values)=0
Please.
virtual void variableDescription(const std::string &desc)=0
Please.
virtual void startFactorizedProbabilityDeclaration(const std::string &var)=0
Please.
Abstract base class for all multi dimensionnal addressable.
virtual void endRawProbabilityDeclaration()=0
Please.
virtual void endFactorizedProbabilityDeclaration()=0
Please.
virtual Size cptDomainSize(NodeId n) const =0
Please.
virtual void setParentModality(const std::string &parent, const std::string &modality)=0
Please.
virtual const DiscreteVariable & varInBN(NodeId id)=0
Please.
virtual void rawConditionalTable(const std::vector< std::string > &variables, const std::vector< float > &rawTable)=0
Please.
virtual void startVariableDeclaration()=0
Please.
virtual NodeId endVariableDeclaration()=0
Please.
virtual void setVariableCPTImplementation(MultiDimAdressable *impl)=0
Please.
virtual void addParent(const std::string &var)=0
Please.
virtual factory_state state() const =0
Please.
virtual void startFactorizedEntry()=0
Please.
virtual void setVariable(const DiscreteVariable &var)=0
Please.
Base class for labelized discrete random variables.
virtual void startRawProbabilityDeclaration(const std::string &var)=0
Please.
Headers for the abstract base class for all multi dimensionnal containers.