aGrUM 3.1.1
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-2026 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-2026 *
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
58#include <string_view>
59
60namespace gum {
71 public:
90
92
93 // just to make some compilers happy
94 virtual ~IBayesNetFactory() = default;
95
100 void setVerbose();
101
102 void resetVerbose();
103
104 bool isVerbose();
105
109
112 virtual const DiscreteVariable& varInBN(NodeId id) = 0;
113 virtual factory_state state() const = 0;
114 virtual NodeId variableId(std::string_view name) const = 0;
115 virtual Size cptDomainSize(NodeId n) const = 0;
116
117 virtual void startNetworkDeclaration() = 0;
118 virtual void addNetworkProperty(std::string_view propName, std::string_view propValue) = 0;
119 virtual void endNetworkDeclaration() = 0;
120 virtual void startVariableDeclaration() = 0;
121 virtual void variableName(std::string_view name) = 0;
122 virtual void variableDescription(std::string_view desc) = 0;
123 virtual void variableType(const VarType& type) = 0;
124 virtual void addModality(std::string_view name) = 0;
125 virtual void addMin(const long& min) = 0;
126 virtual void addMax(const long& max) = 0;
129 virtual void startParentsDeclaration(std::string_view var) = 0;
130 virtual void addParent(std::string_view var) = 0;
131 virtual void endParentsDeclaration() = 0;
132 virtual void startRawProbabilityDeclaration(std::string_view var) = 0;
133 virtual void rawConditionalTable(const std::vector< std::string >& variables,
134 const std::vector< float >& rawTable) = 0;
135 virtual void rawConditionalTable(const std::vector< float >& rawTable) = 0;
137 virtual void startFactorizedProbabilityDeclaration(std::string_view var) = 0;
138 virtual void startFactorizedEntry() = 0;
139 virtual void endFactorizedEntry() = 0;
140 virtual void setParentModality(std::string_view parent, std::string_view modality) = 0;
141 virtual void setVariableValuesUnchecked(const std::vector< float >& values) = 0;
142 virtual void setVariableValues(const std::vector< float >& values) = 0;
144 virtual void setVariable(const DiscreteVariable& var) = 0;
145 virtual void setVariableCPT(std::string_view varName,
146 MultiDimAdressable* table,
147 bool redefineParents) = 0;
149
150 private:
152 };
153} /* namespace gum */
154
155#ifndef GUM_NO_INLINE
157#endif // GUM_NO_INLINE
158#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 variableDescription(std::string_view desc)=0
Please.
virtual void rawConditionalTable(const std::vector< float > &rawTable)=0
Please.
virtual void variableName(std::string_view name)=0
Please.
virtual void endNetworkDeclaration()=0
Please.
virtual void startVariableDeclaration()=0
Please.
virtual void addNetworkProperty(std::string_view propName, std::string_view propValue)=0
Please.
virtual void addParent(std::string_view var)=0
Please.
virtual void rawConditionalTable(const std::vector< std::string > &variables, const std::vector< float > &rawTable)=0
Please.
virtual void startRawProbabilityDeclaration(std::string_view var)=0
Please.
virtual void setVariable(const DiscreteVariable &var)=0
Please.
virtual NodeId endVariableDeclaration()=0
Please.
virtual void endFactorizedProbabilityDeclaration()=0
Please.
virtual void startFactorizedProbabilityDeclaration(std::string_view var)=0
Please.
virtual void startParentsDeclaration(std::string_view var)=0
Please.
virtual NodeId variableId(std::string_view name) const =0
Please.
virtual void endFactorizedEntry()=0
Please.
virtual void setVariableCPT(std::string_view varName, MultiDimAdressable *table, bool redefineParents)=0
Please.
virtual void endRawProbabilityDeclaration()=0
Please.
virtual const DiscreteVariable & varInBN(NodeId id)=0
Please.
virtual void addModality(std::string_view name)=0
Please.
virtual void startNetworkDeclaration()=0
Please.
virtual factory_state state() const =0
Please.
virtual void setVariableValues(const std::vector< float > &values)=0
Please.
virtual void addMin(const long &min)=0
Please.
factory_state
The enumeration of states in which the factory can be in.
virtual void addMax(const long &max)=0
Please.
virtual ~IBayesNetFactory()=default
virtual void setParentModality(std::string_view parent, std::string_view modality)=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:62
Header of class VariableNodeMap.