aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
IBayesNetFactory.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
48#ifndef GUM_INTERFACE_BAYESNET_FACTORY_H
49#define GUM_INTERFACE_BAYESNET_FACTORY_H
50
51#include <string>
52#include <vector>
53
57
58namespace gum {
69 public:
88
90 // just to make some compilers happy
91 virtual ~IBayesNetFactory() {};
92
97 void setVerbose() { _verbose_ = true; };
98
99 void resetVerbose() { _verbose_ = false; };
100
101 bool isVerbose() { return _verbose_; };
102
106
109 virtual const DiscreteVariable& varInBN(NodeId id) = 0;
110 virtual factory_state state() const = 0;
111 virtual NodeId variableId(const std::string& name) const = 0;
112 virtual Size cptDomainSize(NodeId n) const = 0;
113
114 virtual void startNetworkDeclaration() = 0;
115 virtual void addNetworkProperty(const std::string& propName, const std::string& propValue) = 0;
116 virtual void endNetworkDeclaration() = 0;
117 virtual void startVariableDeclaration() = 0;
118 virtual void variableName(const std::string& name) = 0;
119 virtual void variableDescription(const std::string& desc) = 0;
120 virtual void variableType(const VarType& type) = 0;
121 virtual void addModality(const std::string& name) = 0;
122 virtual void addMin(const long& min) = 0;
123 virtual void addMax(const long& max) = 0;
126 virtual void startParentsDeclaration(const std::string& var) = 0;
127 virtual void addParent(const std::string& var) = 0;
128 virtual void endParentsDeclaration() = 0;
129 virtual void startRawProbabilityDeclaration(const std::string& var) = 0;
130 virtual void rawConditionalTable(const std::vector< std::string >& variables,
131 const std::vector< float >& rawTable)
132 = 0;
133 virtual void rawConditionalTable(const std::vector< float >& rawTable) = 0;
135 virtual void startFactorizedProbabilityDeclaration(const std::string& var) = 0;
136 virtual void startFactorizedEntry() = 0;
137 virtual void endFactorizedEntry() = 0;
138 virtual void setParentModality(const std::string& parent, const std::string& modality) = 0;
139 virtual void setVariableValuesUnchecked(const std::vector< float >& values) = 0;
140 virtual void setVariableValues(const std::vector< float >& values) = 0;
142 virtual void setVariable(const DiscreteVariable& var) = 0;
143 virtual void
144 setVariableCPT(const std::string& varName, MultiDimAdressable* table, bool redefineParents)
145 = 0;
147
148 private:
150 };
151} /* namespace gum */
152
153#endif // GUM_ASBTRACT_BAYESNET_FACTORY_H
Base class for discrete random variable.
virtual void startFactorizedEntry()=0
Please.
virtual void variableType(const VarType &type)=0
Please.
virtual void setVariableCPTImplementation(MultiDimAdressable *impl)=0
Please.
virtual Size cptDomainSize(NodeId n) const =0
Please.
virtual void setVariableValuesUnchecked(const std::vector< float > &values)=0
Please.
virtual void endParentsDeclaration()=0
Please.
virtual void rawConditionalTable(const std::vector< float > &rawTable)=0
Please.
virtual void endNetworkDeclaration()=0
Please.
virtual void startVariableDeclaration()=0
Please.
virtual void rawConditionalTable(const std::vector< std::string > &variables, const std::vector< float > &rawTable)=0
Please.
virtual void startParentsDeclaration(const std::string &var)=0
Please.
virtual void setVariableCPT(const std::string &varName, MultiDimAdressable *table, bool redefineParents)=0
Please.
virtual void variableName(const std::string &name)=0
Please.
virtual void setVariable(const DiscreteVariable &var)=0
Please.
virtual NodeId endVariableDeclaration()=0
Please.
virtual void endFactorizedProbabilityDeclaration()=0
Please.
virtual void addModality(const std::string &name)=0
Please.
virtual void setParentModality(const std::string &parent, const std::string &modality)=0
Please.
virtual void endFactorizedEntry()=0
Please.
virtual void endRawProbabilityDeclaration()=0
Please.
virtual void startFactorizedProbabilityDeclaration(const std::string &var)=0
Please.
virtual const DiscreteVariable & varInBN(NodeId id)=0
Please.
virtual void startNetworkDeclaration()=0
Please.
virtual void addNetworkProperty(const std::string &propName, const std::string &propValue)=0
Please.
virtual factory_state state() const =0
Please.
virtual void setVariableValues(const std::vector< float > &values)=0
Please.
virtual void variableDescription(const std::string &desc)=0
Please.
virtual void startRawProbabilityDeclaration(const std::string &var)=0
Please.
virtual void addMin(const long &min)=0
Please.
virtual void addParent(const std::string &var)=0
Please.
factory_state
The enumeration of states in which the factory can be in.
virtual NodeId variableId(const std::string &name) const =0
Please.
virtual void addMax(const long &max)=0
Please.
Abstract base class for all multi dimensionnal addressable.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Size NodeId
Type for node ids.
Base class for labelized discrete random variables.
Headers for the abstract base class for all multi dimensionnal containers.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
VarType
Definition variable.h:60
Header of class VariableNodeMap.