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