aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
schedule_inl.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2026 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-2026 *
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#pragma once
42
43
45#ifndef DOXYGEN_SHOULD_SKIP_THIS
46
48
49namespace gum {
50
53
55 INLINE Schedule* Schedule::clone() const { return new Schedule(*this); }
56
58 INLINE Idx Schedule::versionNumber() const { return _version_number_; }
59
61 INLINE const DAG& Schedule::internalDag() const { return _dag_; }
62
64 INLINE const ScheduleOperator& Schedule::operation(const NodeId node_id) const {
65 return *(_node2op_.second(node_id));
66 }
67
69 INLINE NodeId Schedule::nodeId(const ScheduleOperator& op) const {
70 return _node2op_.first(const_cast< ScheduleOperator* >(&op));
71 }
72
74
76 INLINE const IScheduleMultiDim* Schedule::scheduleMultiDim(const NodeId id) const {
77 return _multidim2id_.first(id);
78 }
79
81 INLINE bool Schedule::existsScheduleMultiDim(const NodeId id) const {
82 return _multidim2id_.existsSecond(id);
83 }
84
86 INLINE NodeId Schedule::scheduleMultiDimId(const IScheduleMultiDim* multidim) const {
87 return _multidim2id_.second(multidim);
88 }
89
91 INLINE const ScheduleOperator*
93 return _multidim_location_[multidim].first;
94 }
95
97 INLINE const ScheduleOperator* Schedule::scheduleMultiDimCreator(const NodeId id) const {
98 return scheduleMultiDimCreator(_multidim2id_.first(id));
99 }
100
101} /* namespace gum */
102
103#endif /* DOXYGEN_SHOULD_SKIP_THIS */
Base class for dag.
Definition DAG.h:121
The Table-agnostic base class of scheduleMultiDim.
the base class for "low-level" operators used to schedule inferences
Class containing a schedule of operations to perform on multidims.
Definition schedule.h:79
static std::atomic< Idx > _overall_version_number_
Definition schedule.h:443
const ScheduleOperator & operation(const NodeId id) const
returns the scheduleOperation corresponding to an id in the DAG
Idx versionNumber() const
returns the version number of the schedule
const DAG & internalDag() const
returns a DAG indicating in which order the operations can be performed
Schedule(const Size nb_ops=256)
default constructor (construct an empty sequence)
NodeId nodeId(const ScheduleOperator &) const
returns the id of the node corresponding to a given ScheduleOperator
Bijection< const IScheduleMultiDim *, Idx > _multidim2id_
a bijection between pointers to IScheduleMultiDim and their Ids
Definition schedule.h:399
Idx _version_number_
a number that identifies the current version of the schedule
Definition schedule.h:423
const IScheduleMultiDim * scheduleMultiDim(const NodeId id) const
returns the ScheduleMultiDim corresponding to a given id
bool existsScheduleMultiDim(const NodeId id) const
indicates whether the schedule contains a given ScheduleMultiDim
static Idx _newVersionNumber_()
returns a new distinct version for each schedule
NodeId scheduleMultiDimId(const IScheduleMultiDim *multidim) const
returns the id of a given IScheduleMultiDim
Bijection< NodeId, ScheduleOperator * > _node2op_
a mapping between the ids of the operations and their pointer
Definition schedule.h:381
virtual Schedule * clone() const
virtual copy constructor
const ScheduleOperator * scheduleMultiDimCreator(const NodeId id) const
returns the operation, if any, that created a given scheduleMultiDim
DAG _dag_
the DAG of the operations to perform
Definition schedule.h:375
HashTable< const IScheduleMultiDim *, std::pair< ScheduleOperator *, Idx > > _multidim_location_
a structure to indicate precisely where a ScheduleMultiDim comes from
Definition schedule.h:396
Size Idx
Type for indexes.
Definition types.h:79
Size NodeId
Type for node ids.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Class containing a schedule of operations to perform on multidims.