aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
scheduleSeparatorStoreMultiDim.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 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,
57  Arc separator);
58 
59  /// copy constructor
61 
62  /// virtual copy constructor: creates a clone of the operation
63  virtual ScheduleSeparatorStoreMultiDim< GUM_SCALAR >* newFactory() const;
64 
65  /// destructor
67 
68  /// @}
69 
70  // ############################################################################
71  /// @name Operators
72  // ############################################################################
73  /// @{
74 
75  /// copy operator
76  ScheduleSeparatorStoreMultiDim< GUM_SCALAR >&
77  operator=(const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >&);
78 
79  /// operator ==
80  /** Two operations are identical if and only if they have the same
81  * arguments and their types are identical (combine, project, etc) */
82  bool operator==(const ScheduleOperation< GUM_SCALAR >&) const;
83 
84  /// operator !=
85  /** Two operations are identical if and only if they have the same
86  * arguments and their types are identical (combine, project, etc) */
87  bool operator!=(const ScheduleOperation< GUM_SCALAR >&) const;
88 
89  /// @}
90 
91  // ############################################################################
92  /// @name Accessors/Modifiers
93  // ############################################################################
94  /// @{
95 
96  /// executes the operation
97  void execute();
98 
99  /** @brief returns an estimation of the number of elementary operations
100  * needed to perform the ScheduleOperation */
101  float nbOperations() const;
102 
103  /// returns the memory consumption used during the operation
104  /** Actually, this function does not return a precise account of the memory
105  * used by the ScheduleOperation but a rough estimate based on the sizes
106  * of the tables involved in the operation.
107  * @return a pair of memory consumption: the first one is the maximum
108  * amount of memory used during the operation and the second one is the
109  * amount of memory still used at the end of the function ( the memory used
110  * by
111  * the resulting table ) */
112  std::pair< long, long > memoryUsage() const;
113 
114  /// returns the set of multidims passed in argument to the operation
115  const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >& multiDimArgs() const;
116 
117  /// returns the set of multidims that should be the result of the operation
118  const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >& multiDimResults() const;
119 
120  /// displays the content of the operation
121  std::string toString() const;
122 
123  /// @}
124 
125  private:
126  // the table to store into the clique
128 
129  // a mapping assigning to each clique a set of tables
131 
132  // the separator into which the table will be stored
134 
135  /// the set of ScheduleMultidims passed in arguments
137  };
138 
139 } /* namespace gum */
140 
141 // always include the template implementation
142 #include <agrum/tools/graphicalModels/inference/scheduler/scheduleSeparatorStoreMultiDim_tpl.h>
143 
144 #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
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
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 ...
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
ArcProperty< Set< const MultiDimImplementation< GUM_SCALAR > *> > * _tableSet_
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
Sequence< const ScheduleMultiDim< GUM_SCALAR > *> * _args_
the set of ScheduleMultidims passed in arguments