UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
PartialPOCEnumerator.h
1 /***************************************************************************
2  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
18  ***************************************************************************/
19 
20 #ifndef PARTIALPOCENUMERATOR_H_
21 #define PARTIALPOCENUMERATOR_H_
22 
23 #include "../graphs/AnonRule.h"
24 #include "TotalPOCEnumerator.h"
25 
26 namespace uncover {
27  namespace rule_engine {
28 
41 
42  public:
43 
58  bool inj,
59  shared_ptr<vector<graphs::AnonRule_csp>> orRules);
60 
67 
71  virtual ~PartialPOCEnumerator();
72 
78  bool ended() const;
79 
92  void reset(graphs::AnonRule_csp rule,
94  bool inj,
95  shared_ptr<vector<graphs::AnonRule_csp>> orRules);
96 
103 
108  graphs::Mapping const& getCurrentCoMatch() const;
109 
116 
122 
123  private:
124 
130  void genTemplates();
131 
137  void computeCurrent();
138 
143  void mergeNodes();
144 
149  void prepEdgeMergings();
150 
155  void mergeEdges();
156 
162  bool incEdgeMergings();
163 
176  bool getNext();
177 
183  inline bool cfWrtOriginalRule() const;
184 
189 
193  shared_ptr<vector<graphs::AnonRule_csp>> originalRules;
194 
198  bool injective;
199 
205 
210 
216 
218  // Fields used as temporary storage and basis for creating the current graph and mapping
220 
225 
230 
235 
239  vector<IDType>* mergableEdges;
240 
245  vector<basic_types::IDPartitionEnumerator>* edgeMergings;
246 
251 
252  };
253 
254  } /* namespace rule_engine */
255 } /* namespace uncover */
256 
257 #endif /* PNIPOCENUMERATOR_H_ */
bool getNext()
Implements the core functionality of the increment operator in the following way: ...
Definition: PartialPOCEnumerator.cpp:415
graphs::Hypergraph_sp getGraph() const
Returns the last computed pushout complement.
Definition: PartialPOCEnumerator.cpp:470
graphs::Mapping_sp templateMapp
Will contain the mapping from the left side to the template graph.
Definition: PartialPOCEnumerator.h:229
basic_types::IDPartitionEnumerator * vertexMergings
Stores an IDPartitionEnumerator to enumerate all possible node mergings.
Definition: PartialPOCEnumerator.h:234
TotalPOCEnumerator * totalPOCs
Stores a TotalPOCEnumerator for computing pushout complement for the total part of the rule...
Definition: PartialPOCEnumerator.h:204
void computeCurrent()
Generates the current graph and mapping from the template graph and mapping.
Definition: PartialPOCEnumerator.cpp:205
vector< basic_types::IDPartitionEnumerator > * edgeMergings
Stores a sequence of IDPartitionEnumerators for enumerating all possible mergings of parallel edges...
Definition: PartialPOCEnumerator.h:245
This enumerator computes all pushout complements for all co-matches from a total (given) rule to a gi...
Definition: TotalPOCEnumerator.h:38
graphs::Hypergraph_sp templateGraph
Will contain the total poc with added nodes and edges.
Definition: PartialPOCEnumerator.h:224
This is the data structure representing a morphism mapping from a graph to another graph...
Definition: Mapping.h:36
bool ended() const
Returns true, if the enumerator has ended.
Definition: PartialPOCEnumerator.cpp:146
bool cfWrtOriginalRule() const
Checks whether there exists an original rule (from which the current rule was generated) such that th...
Definition: PartialPOCEnumerator.cpp:483
PartialPOCEnumerator & operator++()
Computes the next element in the enumeration.
Definition: PartialPOCEnumerator.cpp:397
void mergeNodes()
Sets the current graph and mapping to a copy of the template graph and mapping.
Definition: PartialPOCEnumerator.cpp:223
The PartialPOCEnumerator computes a subset of all pushout complement of a partial rule and a total ma...
Definition: PartialPOCEnumerator.h:40
Provides a possibility to enumerate all partitions on a given set of IDs.
Definition: IDPartitionEnumerator.h:66
graphs::Mapping_sp getMapping() const
Returns the last computed match from the left hand-side to the (last computed) pushout complement...
Definition: PartialPOCEnumerator.cpp:466
bool incEdgeMergings()
Increments the edgeMergings vector to return the next merging on parallel edges.
Definition: PartialPOCEnumerator.cpp:374
shared_ptr< const Hypergraph > Hypergraph_csp
Alias for a shared pointer to a constant Hypergraph.
Definition: Hypergraph.h:90
shared_ptr< Mapping > Mapping_sp
Alias for a shared pointer to a Mapping object.
Definition: Mapping.h:238
virtual ~PartialPOCEnumerator()
Destroys this PartialPOCEnumerator.
Definition: PartialPOCEnumerator.cpp:139
void mergeEdges()
Merges the edges of the current graph (adjusting also the mapping) according to the content of edgeMe...
Definition: PartialPOCEnumerator.cpp:297
void prepEdgeMergings()
Calls mergeNodes() to merge vertices and then initializes edgeMergings to enumerate all possible merg...
Definition: PartialPOCEnumerator.cpp:253
bool nodesAlreadyMerged
Stores whether the nodes need to be merged or not when computing the current graph.
Definition: PartialPOCEnumerator.h:250
shared_ptr< const AnonRule > AnonRule_csp
Alias for a shared pointer to a constant AnonRule.
Definition: AnonRule.h:229
graphs::Mapping const & getCurrentCoMatch() const
Returns the co-match currently used for the backwards application of the rule.
Definition: PartialPOCEnumerator.cpp:474
void reset(graphs::AnonRule_csp rule, graphs::Hypergraph_csp graph, bool inj, shared_ptr< vector< graphs::AnonRule_csp >> orRules)
Reinitializes the enumerator with the given rule and graph.
Definition: PartialPOCEnumerator.cpp:330
PartialPOCEnumerator(graphs::AnonRule_csp rule, graphs::Hypergraph_csp graph, bool inj, shared_ptr< vector< graphs::AnonRule_csp >> orRules)
Generates a new PartialPOCEnumerator with the given rule and graph.
Definition: PartialPOCEnumerator.cpp:92
graphs::Mapping_sp currentMapp
Stores the last computed mapping from the left hand-side to the (partial) pushout complement...
Definition: PartialPOCEnumerator.h:215
graphs::Hypergraph_sp currentGraph
Stores the last computed (partial) pushout complement.
Definition: PartialPOCEnumerator.h:209
shared_ptr< vector< graphs::AnonRule_csp > > originalRules
Stores the collection of original rules.
Definition: PartialPOCEnumerator.h:193
vector< IDType > * mergableEdges
Stores the subset of edges which can (potentially) be merged.
Definition: PartialPOCEnumerator.h:239
void genTemplates()
Uses the current graph and mapping returned by the TotalPOCEnumerator and initializes the template fi...
Definition: PartialPOCEnumerator.cpp:150
graphs::AnonRule_csp partialRule
Stores the partial part of the rule.
Definition: PartialPOCEnumerator.h:188
bool injective
Stores whether injective or conflict-free matches should be used.
Definition: PartialPOCEnumerator.h:198
shared_ptr< Hypergraph > Hypergraph_sp
Alias for a shared pointer to a Hypergraph.
Definition: Hypergraph.h:85