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