aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
IGraphChangesGenerator4UndiGraph.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 /** @file
23  * @brief The base class for all GraphChangesGenerators for undirected
24  *structures
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 #ifndef GUM_LEARNING_IGRAPH_CHANGES_GENERATOR_4_UNDIGRAPH_H
29 #define GUM_LEARNING_IGRAPH_CHANGES_GENERATOR_4_UNDIGRAPH_H
30 
31 #include <agrum/agrum.h>
32 #include <agrum/tools/core/set.h>
33 #include <agrum/tools/graphs/undiGraph.h>
34 #include <agrum/BN/learning/structureUtils/graphChange.h>
35 
36 namespace gum {
37 
38  namespace learning {
39 
41  public:
42  /// the iterator for parsing the list of possible graph change operators
43  using iterator = typename Set< GraphChange >::const_iterator;
44 
45  /// the const iterator for parsing the list of graph change operators
47 
48  // ##########################################################################
49  /// @name Iterators
50  // ##########################################################################
51  /// @{
52 
53  /// returns an (unsafe) iterator on the beginning of the list of operators
54  virtual iterator begin() const = 0;
55 
56  /// returns an (unsafe) iterator on the end of the list of operators
57  virtual const iterator& end() const = 0;
58 
59  /// @}
60 
61  // ##########################################################################
62  /// @name Accessors / Modifiers
63  // ##########################################################################
64  /// @{
65 
66  /// sets a new graph from which the operator will compute possible changes
67  virtual void setGraph(const UndiGraph& graph) = 0;
68 
69  /// notify the operator set of a change applied to the graph
70  virtual void modifyGraph(const EdgeAddition& change) = 0;
71 
72  /// notify the operator set of a change applied to the graph
73  virtual void modifyGraph(const EdgeDeletion& change) = 0;
74 
75  /// notify the operator set of a change applied to the graph
76  virtual void modifyGraph(const GraphChange& change) = 0;
77 
78  /// empty the set of possible change operators that can be applied
79  virtual void clearChanges() noexcept = 0;
80 
81  /// notifies the generator that we have parsed all its legal changes
82  virtual void notifyGetCompleted() = 0;
83 
84  /// @}
85  };
86 
87  } /* namespace learning */
88 
89 } /* namespace gum */
90 
91 #endif /* GUM_LEARNING_IGRAPH_CHANGES_GENERATOR_4_UNDIGRAPH_H */
virtual void setGraph(const UndiGraph &graph)=0
sets a new graph from which the operator will compute possible changes
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
virtual void notifyGetCompleted()=0
notifies the generator that we have parsed all its legal changes
virtual void clearChanges() noexcept=0
empty the set of possible change operators that can be applied
virtual void modifyGraph(const GraphChange &change)=0
notify the operator set of a change applied to the graph
virtual iterator begin() const =0
returns an (unsafe) iterator on the beginning of the list of operators
virtual const iterator & end() const =0
returns an (unsafe) iterator on the end of the list of operators
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)