aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
simpleCPTDisturber.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Source implementation of SimpleCPTDisturber.
25  * @author Pierre-Henri WUILLEMIN(@LIP6) and Ariele-Paolo MAESANO
26  *
27  */
28 
29 #ifndef GUM_SIMPLE_CPT_DISTURBER_H
30 #define GUM_SIMPLE_CPT_DISTURBER_H
31 
32 #include <cstdlib>
33 
34 #include <agrum/BN/generator/ICPTDisturber.h>
35 #include <agrum/agrum.h>
36 
37 namespace gum {
38 
39  /** @class SimpleCPTDisturber simpleCPTDisturber.h
40  * <agrum/BN/generator/simpleCPTDisturber.h>
41  * @brief Class for disturbing Conditional Probability Tables.
42  * @ingroup bn_generator
43  *
44  * This class implements a CPTGenerator CPT generation algorithm.
45  */
46  template < typename GUM_SCALAR >
48  public:
49  // ############################################################################
50  /// @name Constructors / Destructor
51  // ############################################################################
52  /// @{
53  /**
54  * Default constructor.
55  */
57 
58  /**
59  * Destructor.
60  */
62  /// @}
63 
64  // ############################################################################
65  /// @name CPT disturbing methods
66  // ############################################################################
67  /// @{
68  /**
69  * Disturb a CPT using GUM_SCALAR when removing parent varIdi.
70  * @param node The variable on the CPT owner.
71  * @param bayesNet the Bayesian network.
72  * @param src copy of the CPT before reduction.
73  * @param marg of the inference before reduction on the node varIdi.
74  */
75  void disturbReducCPT(NodeId node,
76  BayesNet< GUM_SCALAR >& bayesNet,
77  Potential< GUM_SCALAR >& src,
78  Potential< GUM_SCALAR >& marg) override;
79 
80  /**
81  * Disturb a CPT using GUM_SCALAR when inserting a new parent new_parent.
82  * @param node A reference on the CPT owner.
83  * @param bayesNet the Bayesian network.
84  * @param src copy of the CPT before augmentation.
85  * @param variation degree of variation from the initial probability.
86  */
87  void disturbAugmCPT(NodeId node,
88  BayesNet< GUM_SCALAR >& bayesNet,
89  Potential< GUM_SCALAR >& src,
90  GUM_SCALAR variation) override;
91  };
92 
93 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
94  extern template class SimpleCPTDisturber< double >;
95 #endif
96 
97 } /* namespace gum */
98 
99 #include <agrum/BN/generator/simpleCPTDisturber_tpl.h>
100 #endif // SIMPLECPTDISTURBER_H
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
<agrum/BN/generator/simpleCPTDisturber.h>
void disturbAugmCPT(NodeId node, BayesNet< GUM_SCALAR > &bayesNet, Potential< GUM_SCALAR > &src, GUM_SCALAR variation) override
Disturb a CPT using GUM_SCALAR when inserting a new parent new_parent.
SimpleCPTDisturber()
Default constructor.
~SimpleCPTDisturber() override
Destructor.
void disturbReducCPT(NodeId node, BayesNet< GUM_SCALAR > &bayesNet, Potential< GUM_SCALAR > &src, Potential< GUM_SCALAR > &marg) override
Disturb a CPT using GUM_SCALAR when removing parent varIdi.