29 #ifndef DOXYGEN_SHOULD_SKIP_THIS 36 template <
typename STRUCT_CONSTRAINT >
39 _constraint(&constraint) {
44 template <
typename STRUCT_CONSTRAINT >
54 template <
typename STRUCT_CONSTRAINT >
65 template <
typename STRUCT_CONSTRAINT >
72 template <
typename STRUCT_CONSTRAINT >
73 GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT >&
75 const GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT >& from) {
86 template <
typename STRUCT_CONSTRAINT >
87 GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT >&
89 operator=(GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT >&& from) {
91 _graph = std::move(from._graph);
100 template <
typename STRUCT_CONSTRAINT >
105 std::vector< Set< GraphChange > > legal_changes;
106 # pragma omp parallel num_threads(int(__max_threads_number)) 114 legal_changes.resize(num_threads);
120 for (
const auto node1 :
_graph) {
121 if (i == this_thread) {
122 for (
const auto node2 : _graph) {
123 if (node1 != node2) {
125 ArcAddition arc_add(node1, node2);
127 legal_changes[this_thread].insert(std::move(arc_add));
131 ArcDeletion arc_del(node1, node2);
133 legal_changes[this_thread].insert(std::move(arc_del));
137 ArcReversal arc_rev(node1, node2);
139 legal_changes[this_thread].insert(std::move(arc_rev));
151 for (
const auto& changes : legal_changes) {
152 for (
const auto& change : changes) {
159 template <
typename STRUCT_CONSTRAINT >
161 const DiGraph& graph) {
170 template <
typename STRUCT_CONSTRAINT >
177 template <
typename STRUCT_CONSTRAINT >
184 template <
typename STRUCT_CONSTRAINT >
192 template <
typename STRUCT_CONSTRAINT >
194 const ArcAddition& change) {}
197 template <
typename STRUCT_CONSTRAINT >
199 const ArcDeletion& change) {}
202 template <
typename STRUCT_CONSTRAINT >
204 const ArcReversal& change) {}
207 template <
typename STRUCT_CONSTRAINT >
209 const GraphChange& change) {}
212 template <
typename STRUCT_CONSTRAINT >
219 template <
typename STRUCT_CONSTRAINT >
223 # if defined(_OPENMP) && !defined(GUM_DEBUG_MODE) 232 template <
typename STRUCT_CONSTRAINT >
233 INLINE STRUCT_CONSTRAINT&
unsigned int getNumberOfRunningThreads()
Get the current number of running threads.
unsigned int getThreadNumber()
Get the calling thread id.
Size __max_threads_number
the max number of threads authorized
void modifyGraph(const ArcAddition &change)
notify the generator of a change applied to the graph
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
void setMaxNbThreads(Size nb) noexcept
sets the maximum number of threads used to compute the set of changes
void setGraph(const DiGraph &graph)
sets a new graph from which the generator will compute possible changes
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const iterator & end() const
returns an (unsafe) iterator on the end of the list of operators
iterator begin() const
returns an (unsafe) iterator on the beginning of the list of operators
DiGraph _graph
the graph on which we generate operators
Set< GraphChange > _legal_changes
the current set of graph changes
virtual ~GraphChangesGenerator4DiGraph()
destructor
typename Set< GraphChange >::const_iterator iterator
the iterator for parsing the list of possible graph change operators
STRUCT_CONSTRAINT & constraint() const noexcept
returns the constraint that is used by the generator
GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT > & operator=(const GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT > &from)
copy operator
GraphChangesGenerator4DiGraph(STRUCT_CONSTRAINT &constraint)
default constructor
void clearChanges() noexcept
empty the set of possible change operators that can be applied
STRUCT_CONSTRAINT * _constraint
the structural constraint used to restrict the changes
void _createChanges()
create the set of legal and illegal changes from a given graph
void notifyGetCompleted()
notifies the generator that we have parsed all its legal changes
std::size_t Size
In aGrUM, hashed values are unsigned long int.