aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
scheduleOperator.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
47#ifndef GUM_SCHEDULE_OPERATOR_H
48#define GUM_SCHEDULE_OPERATOR_H
49
50#include <memory>
51#include <string>
52#include <utility>
53
54#include <agrum/agrum.h>
55
57
58namespace gum {
59
60
62
77
85 public:
86 // ############################################################################
88 // ############################################################################
90
92
102 const bool imply_deletion,
103 const bool are_results_persistent);
104
106 virtual ScheduleOperator* clone() const = 0;
107
109
112
114
115
116 // ############################################################################
118 // ############################################################################
120
122
125 virtual bool operator==(const ScheduleOperator&) const;
126
128
131 virtual bool operator!=(const ScheduleOperator&) const;
132
134
135
136 // ############################################################################
138 // ############################################################################
140
147 virtual bool hasSameArguments(const ScheduleOperator&) const = 0;
148
151 virtual bool hasSimilarArguments(const ScheduleOperator&) const = 0;
152
154 virtual bool isSameOperator(const ScheduleOperator&) const;
155
158
160 bool implyDeletion() const;
161
163 virtual void execute() = 0;
164
166 virtual bool isExecuted() const = 0;
167
169
171 virtual void undo() = 0;
172
174
180 virtual void updateArgs(const Sequence< const IScheduleMultiDim* >& new_args) = 0;
181
183 virtual const Sequence< const IScheduleMultiDim* >& args() const = 0;
184
186
193
195
198 void makeResultsPersistent(const bool is_persistent);
199
202
205 virtual double nbOperations() const = 0;
206
208
215 virtual std::pair< double, double > memoryUsage() const = 0;
216
218 virtual std::string toString() const = 0;
219
221
222 protected:
225
228
230
233
235
238
239
240 private:
243
247
250 };
251
252} /* namespace gum */
253
254#ifndef GUM_NO_INLINE
256#endif /* GUM_NO_INLINE */
257
258#endif /* GUM_SCHEDULE_OPERATOR_H */
The Table-agnostic base class of scheduleMultiDim.
virtual bool isSameOperator(const ScheduleOperator &) const
checks whether two ScheduleOperator perform the same operator
ScheduleOperatorType type() const
returns the type of the operator
bool hasPersistentResults() const
shows whether the operator has persistent results
ScheduleOperator & operator=(const ScheduleOperator &from)
copy operator
ScheduleOperator & operator=(ScheduleOperator &&from)
move operator
bool _imply_deletion_
indicates whether the operator will delete some of the ScheduleMultiDim passed as its arguments
virtual bool isExecuted() const =0
indicates whether the operator has been executed
virtual bool hasSameArguments(const ScheduleOperator &) const =0
checks whether two ScheduleOperator have similar parameters (same variables and same content)
virtual std::pair< double, double > memoryUsage() const =0
returns the memory consumption used by the operator
virtual double nbOperations() const =0
returns an estimation of the number of elementary operations needed to perform the ScheduleOperator
ScheduleOperator(const ScheduleOperator &from)
copy constructor
ScheduleOperatorType _op_type_
the name of the operator to perform
virtual ~ScheduleOperator()
destructor
bool _result_persistent_
is the result persistent
void makeResultsPersistent(const bool is_persistent)
makes the results of the operator persistent or not
virtual std::string toString() const =0
displays the content of the operator
virtual bool operator!=(const ScheduleOperator &) const
operator !=
virtual void updateArgs(const Sequence< const IScheduleMultiDim * > &new_args)=0
modifies the arguments of the operator
virtual const Sequence< const IScheduleMultiDim * > & args() const =0
returns the sequence of arguments passed to the operator
virtual ScheduleOperator * clone() const =0
virtual copy constructor
virtual const Sequence< const IScheduleMultiDim * > & results() const =0
returns the sequence of ScheduleMultidim output by the operator
ScheduleOperator(const ScheduleOperatorType type, const bool imply_deletion, const bool are_results_persistent)
default constructor
virtual void execute()=0
really executes the operator
bool implyDeletion() const
indicates whether the operator deletes some of its arguments
virtual bool hasSimilarArguments(const ScheduleOperator &) const =0
checks whether two ScheduleOperator have similar parameters (same variables)
virtual bool operator==(const ScheduleOperator &) const
operator ==
virtual void undo()=0
undo a previous execution, if any
ScheduleOperator(ScheduleOperator &&from)
move constructor
The generic class for storing (ordered) sequences of objects.
Definition sequence.h:972
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
ScheduleOperatorType
the currently supported types of "low-level" operators
@ STORE_MULTIDIM
store a multidimensional table outside of the scheduler
@ PROJECT_MULTIDIM
project a ScheduleMultiDim over a subset of its variables
@ DELETE_MULTIDIM
remove from memory a multidimensional table stored in a ScheduleMultiDim
@ COMBINE_MULTIDIM
combine 2 ScheduleMultiDims
the base class for "low-level" operators used to schedule inferences