UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PartialPOCEnumerator Class Reference

The PartialPOCEnumerator computes a subset of all pushout complement of a partial rule and a total match. More...

#include <PartialPOCEnumerator.h>

Collaboration diagram for PartialPOCEnumerator:
Collaboration graph
[legend]

Public Member Functions

 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. More...
 
 PartialPOCEnumerator (PartialPOCEnumerator &&oldEnum)
 Move constructor. More...
 
virtual ~PartialPOCEnumerator ()
 Destroys this PartialPOCEnumerator.
 
bool ended () const
 Returns true, if the enumerator has ended. More...
 
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. More...
 
PartialPOCEnumeratoroperator++ ()
 Computes the next element in the enumeration. More...
 
graphs::Mapping const & getCurrentCoMatch () const
 Returns the co-match currently used for the backwards application of the rule. More...
 
graphs::Mapping_sp getMapping () const
 Returns the last computed match from the left hand-side to the (last computed) pushout complement. More...
 
graphs::Hypergraph_sp getGraph () const
 Returns the last computed pushout complement. More...
 

Private Member Functions

void genTemplates ()
 Uses the current graph and mapping returned by the TotalPOCEnumerator and initializes the template fields with them. More...
 
void computeCurrent ()
 Generates the current graph and mapping from the template graph and mapping. More...
 
void mergeNodes ()
 Sets the current graph and mapping to a copy of the template graph and mapping. More...
 
void prepEdgeMergings ()
 Calls mergeNodes() to merge vertices and then initializes edgeMergings to enumerate all possible mergings of parallel edges.
 
void mergeEdges ()
 Merges the edges of the current graph (adjusting also the mapping) according to the content of edgeMergings.
 
bool incEdgeMergings ()
 Increments the edgeMergings vector to return the next merging on parallel edges. More...
 
bool getNext ()
 Implements the core functionality of the increment operator in the following way: More...
 
bool cfWrtOriginalRule () const
 Checks whether there exists an original rule (from which the current rule was generated) such that the current match is conflict-free wrt. More...
 

Private Attributes

graphs::AnonRule_csp partialRule
 Stores the partial part of the rule. More...
 
shared_ptr< vector
< graphs::AnonRule_csp > > 
originalRules
 Stores the collection of original rules. More...
 
bool injective
 Stores whether injective or conflict-free matches should be used.
 
TotalPOCEnumeratortotalPOCs
 Stores a TotalPOCEnumerator for computing pushout complement for the total part of the rule.
 
graphs::Hypergraph_sp currentGraph
 Stores the last computed (partial) pushout complement.
 
graphs::Mapping_sp currentMapp
 Stores the last computed mapping from the left hand-side to the (partial) pushout complement.
 
graphs::Hypergraph_sp templateGraph
 Will contain the total poc with added nodes and edges.
 
graphs::Mapping_sp templateMapp
 Will contain the mapping from the left side to the template graph.
 
basic_types::IDPartitionEnumeratorvertexMergings
 Stores an IDPartitionEnumerator to enumerate all possible node mergings.
 
vector< IDType > * mergableEdges
 Stores the subset of edges which can (potentially) be merged.
 
vector
< basic_types::IDPartitionEnumerator > * 
edgeMergings
 Stores a sequence of IDPartitionEnumerators for enumerating all possible mergings of parallel edges.
 
bool nodesAlreadyMerged
 Stores whether the nodes need to be merged or not when computing the current graph.
 

Detailed Description

The PartialPOCEnumerator computes a subset of all pushout complement of a partial rule and a total match.

This is done by first splitting the rule into a total and a partial part. First the pushout complement for the total part is computed by the TotalPOCEnumerator. The result is then modified to be the pushout complement of the original rule. These modifications only add elements to the pushout complement which have a preimage in the left rule side. Note that this enumerator does only compute a finite subset of all pushout complement, but not all, since there may be infinitely many. The computed set can be used to calculate a representative set wrt. some criteria.

See Also
TotalPOCEnumerator
Author
Jan Stückrath

Constructor & Destructor Documentation

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.

The rule may be any (partial) morphism. The matches can be set to either injective or conflict-free matches. A collection of original rules, i.e. rules from which the current rule could have been generated, can be given if inj=false. Computed pushout complements are then only kept if the match is conflict-free wrt. at least one of these rules.

Parameters
rulethe rule which will be applied backwards
graphthe graph to which the rule will be applied backwards
injset to true iff only injective matching should be used
orRulesa collection of all original rules; this parameter is ignored if inj=true, it is null or it is empty

Move constructor.

Creates a new PartialPOCEnumerator using the data of the given one. The given enumerator will be invalidated in the process and must be reset before being usable again.

Parameters
oldEnumthe enumerator from which the data will be copied

Member Function Documentation

bool cfWrtOriginalRule ( ) const
inlineprivate

Checks whether there exists an original rule (from which the current rule was generated) such that the current match is conflict-free wrt.

this rule.

Returns
true, iff at least one such original rule exists
void computeCurrent ( )
private

Generates the current graph and mapping from the template graph and mapping.

If matches may be non-injective, vertex and edge mergings are also performed according to the current values of vertexMergings and edgeMergings.

bool ended ( ) const

Returns true, if the enumerator has ended.

This is the case if the enumerator was incremented, but unable to compute any further elements to enumerate.

Returns
true, iff there are no more elements to enumerate
void genTemplates ( )
private

Uses the current graph and mapping returned by the TotalPOCEnumerator and initializes the template fields with them.

These include templateGraph, templateMapp and additionally vertexMergings, mergableEdges, edgeMergings if matches may be non-injective.

Mapping const & getCurrentCoMatch ( ) const

Returns the co-match currently used for the backwards application of the rule.

Returns
the co-match currently used for the backwards application of the rule
graphs::Hypergraph_sp getGraph ( ) const

Returns the last computed pushout complement.

If the enumerator has ended, null is returned.

Returns
the last computed pushout complement or null if the enumerator has ended
graphs::Mapping_sp getMapping ( ) const

Returns the last computed match from the left hand-side to the (last computed) pushout complement.

If the enumerator has ended, null is returned.

Returns
the last computed mapping or null if the enumerator has ended
bool getNext ( )
private

Implements the core functionality of the increment operator in the following way:

  1. If conflict-free matches are used, compute the next partial pushout complement from the current total pushout complement.
  2. If this is not possible or injective matches are used, compute the next total pushout complement. Construct the first partial pushout complement and return it (there is only one in the injective case).
  3. If there are no more total pushout complements, this enumerator ends
Returns
true, iff a pushout complement could computed, i.e. the enumerator did not end
bool incEdgeMergings ( )
private

Increments the edgeMergings vector to return the next merging on parallel edges.

Returns false if the increment was not possible, i.e. all possibilities where enumerated. false if all edge mergings where enumerated

void mergeNodes ( )
private

Sets the current graph and mapping to a copy of the template graph and mapping.

Then merges the vertices according to the current content of vertexMergings.

PartialPOCEnumerator & operator++ ( )

Computes the next element in the enumeration.

If the last element was already computed, this call is ignored.

Returns
a reference to this enumerator
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.

Any previous computations performed by this enumerator are discarded and the first element for its new content is enumerated. A collection of original rules, i.e. rules from which the current rule could have been generated, can be given if inj=false. Computed pushout complements are then only kept if the match is conflict-free wrt. at least one of these rules.

Parameters
rulethe rule which will be applied backwards
graphthe graph to which the rule will be applied backwards
injset to true iff only injective matching should be used
orRulesa collection of all original rules; this parameter is ignored if inj=true, it is null or it is empty

Member Data Documentation

shared_ptr<vector<graphs::AnonRule_csp> > originalRules
private

Stores the collection of original rules.

(only used for non-injective matches)

graphs::AnonRule_csp partialRule
private

Stores the partial part of the rule.

This morphism is injective, surjective, but partial.


The documentation for this class was generated from the following files: