aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
scheduleSeparatorStoreMultiDim.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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 an operator used by scheduled inferences to store tables into
24  *separators
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #ifndef GUM_SCHEDULE_SEPARATOR_STORE_MULTI_DIM_H
30 #define GUM_SCHEDULE_SEPARATOR_STORE_MULTI_DIM_H
31 
32 #include <string>
33 
34 #include <agrum/agrum.h>
35 
36 #include <agrum/tools/core/sequence.h>
37 #include <agrum/tools/graphicalModels/inference/scheduler/scheduleMultiDim.h>
38 #include <agrum/tools/graphicalModels/inference/scheduler/scheduleOperation.h>
39 #include <agrum/tools/graphs/graphElements.h>
40 #include <agrum/tools/multidim/implementations/multiDimImplementation.h>
41 
42 namespace gum {
43 
44  template < typename GUM_SCALAR >
45 
47  public:
48  // ############################################################################
49  /// @name Constructors / Destructors
50  // ############################################################################
51  /// @{
52 
53  /// default constructor
55  const ScheduleMultiDim< GUM_SCALAR >& table,
58  Arc separator);
59 
60  /// copy constructor
62  const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >&);
63 
64  /// virtual copy constructor: creates a clone of the operation
65  virtual ScheduleSeparatorStoreMultiDim< GUM_SCALAR >* newFactory() const;
66 
67  /// destructor
69 
70  /// @}
71 
72  // ############################################################################
73  /// @name Operators
74  // ############################################################################
75  /// @{
76 
77  /// copy operator
78  ScheduleSeparatorStoreMultiDim< GUM_SCALAR >&
79  operator=(const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >&);
80 
81  /// operator ==
82  /** Two operations are identical if and only if they have the same
83  * arguments and their types are identical (combine, project, etc) */
84  bool operator==(const ScheduleOperation< GUM_SCALAR >&) const;
85 
86  /// operator !=
87  /** Two operations are identical if and only if they have the same
88  * arguments and their types are identical (combine, project, etc) */
89  bool operator!=(const ScheduleOperation< GUM_SCALAR >&) const;
90 
91  /// @}
92 
93  // ############################################################################
94  /// @name Accessors/Modifiers
95  // ############################################################################
96  /// @{
97 
98  /// executes the operation
99  void execute();
100 
101  /** @brief returns an estimation of the number of elementary operations
102  * needed to perform the ScheduleOperation */
103  float nbOperations() const;
104 
105  /// returns the memory consumption used during the operation
106  /** Actually, this function does not return a precise account of the memory
107  * used by the ScheduleOperation but a rough estimate based on the sizes
108  * of the tables involved in the operation.
109  * @return a pair of memory consumption: the first one is the maximum
110  * amount of memory used during the operation and the second one is the
111  * amount of memory still used at the end of the function ( the memory used
112  * by
113  * the resulting table ) */
114  std::pair< long, long > memoryUsage() const;
115 
116  /// returns the set of multidims passed in argument to the operation
117  const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >& multiDimArgs() const;
118 
119  /// returns the set of multidims that should be the result of the operation
120  const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >&
121  multiDimResults() const;
122 
123  /// displays the content of the operation
124  std::string toString() const;
125 
126  /// @}
127 
128  private:
129  // the table to store into the clique
131 
132  // a mapping assigning to each clique a set of tables
134 
135  // the separator into which the table will be stored
137 
138  /// the set of ScheduleMultidims passed in arguments
140  };
141 
142 } /* namespace gum */
143 
144 // always include the template implementation
145 #include <agrum/tools/graphicalModels/inference/scheduler/scheduleSeparatorStoreMultiDim_tpl.h>
146 
147 #endif /* GUM_SCHEDULE_SEPARATOR_STORE_MULTI_DIM_H */
virtual ScheduleSeparatorStoreMultiDim< GUM_SCALAR > * newFactory() const
virtual copy constructor: creates a clone of the operation
const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimResults() const
returns the set of multidims that should be the result of the operation
ScheduleSeparatorStoreMultiDim(const ScheduleSeparatorStoreMultiDim< GUM_SCALAR > &)
copy constructor
ArcProperty< Set< const MultiDimImplementation< GUM_SCALAR > *> > * tableSet__
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
std::pair< long, long > memoryUsage() const
returns the memory consumption used during the operation
float nbOperations() const
returns an estimation of the number of elementary operations needed to perform the ScheduleOperation ...
Sequence< const ScheduleMultiDim< GUM_SCALAR > *> * args__
the set of ScheduleMultidims passed in arguments
virtual ~ScheduleSeparatorStoreMultiDim()
destructor
bool operator!=(const ScheduleOperation< GUM_SCALAR > &) const
operator !=
bool operator==(const ScheduleOperation< GUM_SCALAR > &) const
operator ==
const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimArgs() const
returns the set of multidims passed in argument to the operation
void execute()
executes the operation
ScheduleSeparatorStoreMultiDim< GUM_SCALAR > & operator=(const ScheduleSeparatorStoreMultiDim< GUM_SCALAR > &)
copy operator
std::string toString() const
displays the content of the operation
ScheduleSeparatorStoreMultiDim(const ScheduleMultiDim< GUM_SCALAR > &table, ArcProperty< Set< const MultiDimImplementation< GUM_SCALAR > * > > &separator_tables, Arc separator)
default constructor