UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
TotalPOCEnumerator.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 TOTALPOCENUMERATOR_H_
21 #define TOTALPOCENUMERATOR_H_
22 
23 #include "../graphs/AnonRule.h"
24 #include "../graphs/Hypergraph.h"
25 #include "StdMatchFinder.h"
26 #include "IDClosureEnumerator.h"
27 #include "IDtoIDEnumerator.h"
28 
29 namespace uncover {
30  namespace rule_engine {
31 
39 
40  public:
41 
52  bool injective);
53 
61 
65  virtual ~TotalPOCEnumerator();
66 
71  void reset();
72 
78  bool ended() const;
79 
86 
92 
98 
103  graphs::Mapping const& getCurrentCoMatch() const;
104 
105  private:
106 
113  void initEdgeTemplates();
114 
121  void initVertexTemplates();
122 
129  void initTemplatesInj();
130 
139  void generateNonMergedPOC();
140 
145  void computePOC();
146 
151  void computePOCInj();
152 
157  void computePOCInjRule();
158 
164  bool chooseNextMatch();
165 
173  bool incEnums(vector<IDClosureEnumerator>& enums);
174 
182  bool incEnums(vector<IDtoIDEnumerator>& enums);
183 
187  void deleteTemporaryFields();
188 
193 
198 
202  const bool injective;
203 
207  const bool injectiveRule;
208 
213 
218  shared_ptr<vector<graphs::Mapping>> matchList;
219 
224 
229 
231  // fields used to enumerate all POCs of one applicable match //
233 
238  vector<IDClosureEnumerator>* edgeEnums;
239 
244  vector<IDClosureEnumerator>* vertexEnums;
245 
250 
255 
262 
268 
274 
279  vector<IDtoIDEnumerator>* vertexEnumsInj;
280 
281  };
282 
283  } /* namespace rule_engine */
284 } /* namespace uncover */
285 
286 #endif /* TOTALPOCENUMERATOR_H_ */
StdMatchFinder provides a simple algorithm which takes two arbitrary graphs and calculates all matchi...
Definition: StdMatchFinder.h:38
graphs::Mapping const & getCurrentCoMatch() const
Returns a reference to the co-match currently used for the computation of POCs.
Definition: TotalPOCEnumerator.cpp:157
void computePOC()
Computes the current pushout complement from the temporary values computed to far.
Definition: TotalPOCEnumerator.cpp:497
graphs::Hypergraph * templateGraphOr
A copy of an initially non-merged POC.
Definition: TotalPOCEnumerator.h:249
void generateNonMergedPOC()
Generates an initial POC without any mergings.
Definition: TotalPOCEnumerator.cpp:577
vector< IDClosureEnumerator > * edgeEnums
A list of enumerators for enumerating all possible equivalences on edges.
Definition: TotalPOCEnumerator.h:238
void reset()
Resets this enumerator to its initial values.
Definition: TotalPOCEnumerator.cpp:166
graphs::Mapping_sp currMapp
The last computed match from the left side to the last computed POC.
Definition: TotalPOCEnumerator.h:228
const bool injectiveRule
Stores if the rule is injective.
Definition: TotalPOCEnumerator.h:207
graphs::Mapping_sp getMapping() const
Returns the last computed Mapping (from L to the POC).
Definition: TotalPOCEnumerator.cpp:569
This enumerator computes all pushout complements for all co-matches from a total (given) rule to a gi...
Definition: TotalPOCEnumerator.h:38
virtual ~TotalPOCEnumerator()
Destroys this instance of the TotalPOCEnumerator.
Definition: TotalPOCEnumerator.cpp:143
TotalPOCEnumerator & operator++()
Computes the next pushout complement.
Definition: TotalPOCEnumerator.cpp:212
This is the data structure representing a morphism mapping from a graph to another graph...
Definition: Mapping.h:36
graphs::Hypergraph_csp graph
The graph to be matched to.
Definition: TotalPOCEnumerator.h:197
vector< IDClosureEnumerator > * vertexEnums
A list of enumerators for enumerating all possible equivalences on vertices.
Definition: TotalPOCEnumerator.h:244
vector< IDtoIDEnumerator > * vertexEnumsInj
A list of enumerators for enumerating possibilities to attach edges to split vertices.
Definition: TotalPOCEnumerator.h:279
shared_ptr< vector< graphs::Mapping > > matchList
A list of all co-matches computed.
Definition: TotalPOCEnumerator.h:218
void initEdgeTemplates()
Generates enumerators for the equivalences on edges and computes an initial, non-merged POC...
Definition: TotalPOCEnumerator.cpp:278
void computePOCInjRule()
Computes the current pushout complement without use of any temporary computed values.
Definition: TotalPOCEnumerator.cpp:693
graphs::Hypergraph_sp currGraph
The last computed POC graph.
Definition: TotalPOCEnumerator.h:223
void initTemplatesInj()
Generates enumerators for attaching edges in all possible ways to split vertices in the POC and gener...
Definition: TotalPOCEnumerator.cpp:436
A Hypergraph represents a graph with a unique identifier.
Definition: Hypergraph.h:35
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
void initVertexTemplates()
First performs merging of vertices and edges according to the current equivalence on the edges...
Definition: TotalPOCEnumerator.cpp:324
graphs::Mapping * templateMappME
The mapping from L to templateGraphME.
Definition: TotalPOCEnumerator.h:267
bool ended() const
Returns true if there are no more POCs to compute.
Definition: TotalPOCEnumerator.cpp:197
graphs::Mapping * templateMappOr
The mapping from L to templateGraphOr.
Definition: TotalPOCEnumerator.h:254
graphs::Hypergraph * templateGraphME
A copy of the POC after performing the mergings of edges (including implied mergings on vertices...
Definition: TotalPOCEnumerator.h:261
graphs::Mapping * mappPOCtoGraph
The mapping from templateGraphOr to the matched graph.
Definition: TotalPOCEnumerator.h:273
bool incEnums(vector< IDClosureEnumerator > &enums)
Increments the given collection of enumerators such that the next POC can be generated from it...
Definition: TotalPOCEnumerator.cpp:525
void deleteTemporaryFields()
Deletes all temporary fields used in the POC computation (freeing their memory).
Definition: TotalPOCEnumerator.cpp:636
shared_ptr< const AnonRule > AnonRule_csp
Alias for a shared pointer to a constant AnonRule.
Definition: AnonRule.h:229
void computePOCInj()
Computes the current pushout complement from the temporary values computed to far.
Definition: TotalPOCEnumerator.cpp:484
graphs::AnonRule_csp rule
The rule which should be applied backwards.
Definition: TotalPOCEnumerator.h:192
StdMatchFinder * matcher
Stores a matcher used to compute matchings from the right side to the given graph.
Definition: TotalPOCEnumerator.h:212
bool chooseNextMatch()
Searches for the next match where pushout complements exist.
Definition: TotalPOCEnumerator.cpp:201
graphs::Hypergraph_sp getGraph() const
Returns the last computed pushout complement graph.
Definition: TotalPOCEnumerator.cpp:573
TotalPOCEnumerator(graphs::AnonRule_csp rule, graphs::Hypergraph_csp graph, bool injective)
Initializes a new TotalPOCEnumerator with the given graph and rule as parameters. ...
Definition: TotalPOCEnumerator.cpp:83
const bool injective
Stores if the POCs should be injective.
Definition: TotalPOCEnumerator.h:202
shared_ptr< Hypergraph > Hypergraph_sp
Alias for a shared pointer to a Hypergraph.
Definition: Hypergraph.h:85