aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
scheduleCliqueStoreMultiDim.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 scheduling inferences to store tables into cliques
24  *
25  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
26  */
27 
28 #ifndef GUM_SCHEDULE_CLIQUE_STORE_MULTI_DIM_H
29 #define GUM_SCHEDULE_CLIQUE_STORE_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/graphs/graphElements.h>
39 #include <agrum/tools/multidim/implementations/multiDimImplementation.h>
40 
41 namespace gum {
42 
43  template < typename GUM_SCALAR >
44 
46  public:
47  // ############################################################################
48  /// @name Constructors / Destructors
49  // ############################################################################
50  /// @{
51 
52  /// default constructor
54  const ScheduleMultiDim< GUM_SCALAR >& table,
56  NodeId clique);
57 
58  /// copy constructor
60 
61  /// virtual copy constructor: creates a clone of the operation
62  virtual ScheduleCliqueStoreMultiDim< GUM_SCALAR >* newFactory() const;
63 
64  /// destructor
65  virtual ~ScheduleCliqueStoreMultiDim();
66 
67  /// @}
68 
69  // ############################################################################
70  /// @name Operators
71  // ############################################################################
72  /// @{
73 
74  /// copy operator
75  ScheduleCliqueStoreMultiDim< GUM_SCALAR >&
76  operator=(const ScheduleCliqueStoreMultiDim< GUM_SCALAR >&);
77 
78  /// operator ==
79  /** Two operations are identical if and only if they have the same
80  * arguments and their types are identical (combine, project, etc) */
81  bool operator==(const ScheduleOperation< GUM_SCALAR >&) const;
82 
83  /// operator !=
84  /** Two operations are identical if and only if they have the same
85  * arguments and their types are identical (combine, project, etc) */
86  bool operator!=(const ScheduleOperation< GUM_SCALAR >&) const;
87 
88  /// @}
89 
90  // ############################################################################
91  /// @name Accessors/Modifiers
92  // ############################################################################
93  /// @{
94 
95  /// executes the operation
96  void execute();
97 
98  /** @brief returns an estimation of the number of elementary operations
99  * needed to perform the ScheduleOperation */
100  float nbOperations() const;
101 
102  /// returns the memory consumption used during the operation
103  /** Actually, this function does not return a precise account of the memory
104  * used by the ScheduleOperation but a rough estimate based on the sizes
105  * of the tables involved in the operation.
106  * @return a pair of memory consumption: the first one is the maximum
107  * amount of memory used during the operation and the second one is the
108  * amount of memory still used at the end of the function ( the memory used
109  * by
110  * the resulting table ) */
111  std::pair< long, long > memoryUsage() const;
112 
113  /// returns the set of multidims passed in argument to the operation
114  const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >& multiDimArgs() const;
115 
116  /// returns the set of multidims that should be the result of the operation
117  const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >& multiDimResults() const;
118 
119  /// displays the content of the operation
120  std::string toString() const;
121 
122  /// @}
123 
124  private:
125  // the table to store into the clique
127 
128  // a mapping assigning to each clique a set of tables
130 
131  // the clique into which the table will be stored
133 
134  /// the set of ScheduleMultidims passed in arguments
136  };
137 
138 } /* namespace gum */
139 
140 // always include the template implementation
141 #include <agrum/tools/graphicalModels/inference/scheduler/scheduleCliqueStoreMultiDim_tpl.h>
142 
143 #endif /* GUM_SCHEDULE_CLIQUE_STORE_MULTI_DIM_H */
ScheduleMultiDim< GUM_SCALAR > _table_
bool operator!=(const ScheduleOperation< GUM_SCALAR > &) const
operator !=
ScheduleCliqueStoreMultiDim(const ScheduleMultiDim< GUM_SCALAR > &table, NodeProperty< Set< const MultiDimImplementation< GUM_SCALAR > * > > &clique_tables, NodeId clique)
default constructor
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
bool operator==(const ScheduleOperation< GUM_SCALAR > &) const
operator ==
std::pair< long, long > memoryUsage() const
returns the memory consumption used during the operation
void execute()
executes the operation
virtual ~ScheduleCliqueStoreMultiDim()
destructor
NodeProperty< Set< const MultiDimImplementation< GUM_SCALAR > *> > * _tableSet_
float nbOperations() const
returns an estimation of the number of elementary operations needed to perform the ScheduleOperation ...
const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimArgs() const
returns the set of multidims passed in argument to the operation
virtual ScheduleCliqueStoreMultiDim< GUM_SCALAR > * newFactory() const
virtual copy constructor: creates a clone of the operation
ScheduleCliqueStoreMultiDim< GUM_SCALAR > & operator=(const ScheduleCliqueStoreMultiDim< GUM_SCALAR > &)
copy operator
const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimResults() const
returns the set of multidims that should be the result of the operation
ScheduleCliqueStoreMultiDim(const ScheduleCliqueStoreMultiDim< GUM_SCALAR > &)
copy constructor
std::string toString() const
displays the content of the operation
Sequence< const ScheduleMultiDim< GUM_SCALAR > *> * _args_
the set of ScheduleMultidims passed in arguments