Class RPSTHelper


  • public class RPSTHelper
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      RPSTHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.processmining.models.graphbased.directed.petrinet.elements.Place addPlace​(org.processmining.models.graphbased.directed.petrinet.Petrinet net, java.lang.String label, java.util.Collection<org.processmining.models.graphbased.directed.petrinet.PetrinetNode> predecessors, java.util.Collection<org.processmining.models.graphbased.directed.petrinet.PetrinetNode> successors)
      Adds a new place with the given label to the Petri net and creates arcs from the predecessors to the new place and from the place to all successors.
      static void addSingleEdgeFragment​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode parent, edu.uci.ics.jung.graph.DirectedGraph<org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode,​java.lang.String> tree, org.processmining.models.graphbased.directed.petrinet.elements.Arc edge)  
      static java.util.Date copy_timestamp​(java.util.Date timestamp)  
      static java.lang.String createNodeName​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode node, org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPST rpst)
      Creates a name for the given fragment.
      static org.processmining.plugins.petrinet.replayresult.PNRepResult executeAlignments​(org.deckfour.xes.model.XLog log, org.processmining.models.graphbased.directed.petrinet.PetrinetGraph net, org.processmining.models.semantics.petrinet.Marking initialMarking, org.processmining.models.semantics.petrinet.Marking finalMarking)
      Manually calculates the alignment between the given log and model.
      static org.apache.commons.lang3.tuple.Triple<org.processmining.models.graphbased.directed.petrinet.Petrinet,​org.processmining.models.semantics.petrinet.Marking,​org.processmining.models.semantics.petrinet.Marking> fragmentToNetWithMarking​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode node)
      Creates fragment net for the given SESE-fragment, which contains all arcs from the fragment and adds an initial/ final place if the entry/ exit node of the fragments is not a place.
      static int fragTokenAdded​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode frag, org.processmining.models.graphbased.directed.petrinet.Petrinet net, org.processmining.models.graphbased.directed.petrinet.elements.Transition trans)
      Calculates the number of the that would be added to the given fragment when executing the given transition inside the given Petri net.
      static int fragTokenConsumed​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode frag, org.processmining.models.graphbased.directed.petrinet.Petrinet net, org.processmining.models.graphbased.directed.petrinet.elements.Transition trans)
      Calculates the number of the that would be consumed from the given fragment when executing the given transition inside the given Petri net.
      static int fragTokenDifference​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode frag, org.processmining.models.graphbased.directed.petrinet.Petrinet net, org.processmining.models.graphbased.directed.petrinet.elements.Transition trans)
      Calculates the change in the number of tokens inside the given fragment when executing the given transition, i.e.
      static org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPST generateRPST​(org.processmining.framework.plugin.PluginContext context, org.processmining.models.graphbased.directed.petrinet.Petrinet net, boolean ignore_long_term, org.deckfour.xes.model.XLog log1, org.processmining.plugins.petrinet.replayresult.PNRepResult alignments1, org.deckfour.xes.model.XLog log2, org.processmining.plugins.petrinet.replayresult.PNRepResult alignments2)
      Generates an RPST for the given Petri net using the GenerateRPSTFromPetriNetPlugin from the acceptingpetrinetdecomposer package.
      static java.util.Date get_event_timestamp​(org.deckfour.xes.model.XEvent event)  
      static java.util.Map<org.processmining.models.graphbased.directed.petrinet.elements.Place,​java.time.Duration> getAverageSojournTimes​(org.processmining.models.graphbased.directed.petrinet.Petrinet net, org.deckfour.xes.model.XLog log1, org.processmining.plugins.petrinet.replayresult.PNRepResult alignments1, org.deckfour.xes.model.XLog log2, org.processmining.plugins.petrinet.replayresult.PNRepResult alignments2)  
      static org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode getParent​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode node, org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPST rpst)
      Return the parent of the given fragment in the given RPST.
      static java.util.Set<org.processmining.models.graphbased.directed.petrinet.PetrinetNode> getPredecessors​(org.processmining.models.graphbased.directed.petrinet.Petrinet net, org.processmining.models.graphbased.directed.petrinet.PetrinetNode node)
      Returns the set of nodes that have an arc to the given node inside the given Petri net.
      static java.util.Set<org.processmining.models.graphbased.directed.petrinet.PetrinetNode> getSuccessors​(org.processmining.models.graphbased.directed.petrinet.Petrinet net, org.processmining.models.graphbased.directed.petrinet.PetrinetNode node)
      Returns the set of nodes to which the given node has an arc inside the given Petri net.
      static boolean isFinalPlaceInFragment​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode fragment, org.processmining.models.graphbased.directed.petrinet.Petrinet net)
      Returns true if the final place of the Petri net is inside the fragment.
      static boolean isInitialPlaceInFragment​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode fragment, org.processmining.models.graphbased.directed.petrinet.Petrinet net)
      Returns true if the inital place of the Petri net is inside the fragment.
      static double shortestPathThroughModelLength​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode fragment)
      Calculates the shortest path through the fragment net for the given SESE-fragment
      static double shortestPathThroughModelLength​(org.processmining.models.graphbased.directed.petrinet.Petrinet net, org.processmining.models.semantics.petrinet.Marking initial_marking, org.processmining.models.semantics.petrinet.Marking final_marking)
      Calculates the shortest path through the given Petri net
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RPSTHelper

        public RPSTHelper()
    • Method Detail

      • getParent

        public static org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode getParent​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode node,
                                                                                                           org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPST rpst)
        Return the parent of the given fragment in the given RPST. Returns null if the node is the root.
        Parameters:
        node - Node whose parent should be returned.
        rpst - RPST containing the node.
        Returns:
        Parent fragment of node or null if node is the root.
      • createNodeName

        public static java.lang.String createNodeName​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode node,
                                                      org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPST rpst)
        Creates a name for the given fragment. If it is a inner node, it receives the name of the node object. If it is a leaf, the name is the name is of the form "[entry-node]->[exit-node]".
        Parameters:
        node - Fragment for which the name should be generated.
        rpst - RPST the node belongs to. Used to check if the node is a leaf or an inner node.
        Returns:
        String name of the node.
      • fragmentToNetWithMarking

        public static org.apache.commons.lang3.tuple.Triple<org.processmining.models.graphbased.directed.petrinet.Petrinet,​org.processmining.models.semantics.petrinet.Marking,​org.processmining.models.semantics.petrinet.Marking> fragmentToNetWithMarking​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode node)
        Creates fragment net for the given SESE-fragment, which contains all arcs from the fragment and adds an initial/ final place if the entry/ exit node of the fragments is not a place.
        Parameters:
        node - SESE-fragment.
        Returns:
        Triple of a Petri net, an initial marking and a final marking.
      • shortestPathThroughModelLength

        public static double shortestPathThroughModelLength​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode fragment)
        Calculates the shortest path through the fragment net for the given SESE-fragment
        Parameters:
        fragment - SESE-fragment.
        Returns:
        double value of the alignment cost of an empty trace on the fragment net.
      • shortestPathThroughModelLength

        public static double shortestPathThroughModelLength​(org.processmining.models.graphbased.directed.petrinet.Petrinet net,
                                                            org.processmining.models.semantics.petrinet.Marking initial_marking,
                                                            org.processmining.models.semantics.petrinet.Marking final_marking)
        Calculates the shortest path through the given Petri net
        Parameters:
        net - Petri net.
        initial_marking - Initial marking of the given Petri net.
        final_marking - Final marking of the given Petri net.
        Returns:
        double value of the alignment cost of an empty trace on the Petri net.
      • executeAlignments

        public static org.processmining.plugins.petrinet.replayresult.PNRepResult executeAlignments​(org.deckfour.xes.model.XLog log,
                                                                                                    org.processmining.models.graphbased.directed.petrinet.PetrinetGraph net,
                                                                                                    org.processmining.models.semantics.petrinet.Marking initialMarking,
                                                                                                    org.processmining.models.semantics.petrinet.Marking finalMarking)
                                                                                             throws nl.tue.astar.AStarException
        Manually calculates the alignment between the given log and model.
        Parameters:
        log - Event log that should be aligned.
        net - Petri net the log should be aligned with.
        initialMarking - Initial marking of the Petri net.
        finalMarking - Final marking of the Petri net.
        Returns:
        PNRepResult containing the resulting alignment for every trace in the log.
        Throws:
        nl.tue.astar.AStarException
      • getPredecessors

        public static java.util.Set<org.processmining.models.graphbased.directed.petrinet.PetrinetNode> getPredecessors​(org.processmining.models.graphbased.directed.petrinet.Petrinet net,
                                                                                                                        org.processmining.models.graphbased.directed.petrinet.PetrinetNode node)
        Returns the set of nodes that have an arc to the given node inside the given Petri net.
        Parameters:
        net - Petri net that contains the node.
        node - Node for which predecessors should be searched.
        Returns:
        Set of predecessors of the given node.
      • getSuccessors

        public static java.util.Set<org.processmining.models.graphbased.directed.petrinet.PetrinetNode> getSuccessors​(org.processmining.models.graphbased.directed.petrinet.Petrinet net,
                                                                                                                      org.processmining.models.graphbased.directed.petrinet.PetrinetNode node)
        Returns the set of nodes to which the given node has an arc inside the given Petri net.
        Parameters:
        net - Petri net that contains the node.
        node - Node for which successors should be searched.
        Returns:
        Set of successors of the given node.
      • fragTokenAdded

        public static int fragTokenAdded​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode frag,
                                         org.processmining.models.graphbased.directed.petrinet.Petrinet net,
                                         org.processmining.models.graphbased.directed.petrinet.elements.Transition trans)
        Calculates the number of the that would be added to the given fragment when executing the given transition inside the given Petri net. Does not consider the tokens the transition might consume from the fragment.
        Parameters:
        frag - Fragment of net.
        net - Petri net containing the fragment and the transition.
        trans - Transition for which the number of tokens should be calculated.
        Returns:
        int value of the number of tokens.
      • fragTokenConsumed

        public static int fragTokenConsumed​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode frag,
                                            org.processmining.models.graphbased.directed.petrinet.Petrinet net,
                                            org.processmining.models.graphbased.directed.petrinet.elements.Transition trans)
        Calculates the number of the that would be consumed from the given fragment when executing the given transition inside the given Petri net. Does not consider the tokens the transition might add to the fragment.
        Parameters:
        frag - Fragment of net.
        net - Petri net containing the fragment and the transition.
        trans - Transition for which the number of tokens should be calculated.
        Returns:
        int value of the number of tokens.
      • fragTokenDifference

        public static int fragTokenDifference​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode frag,
                                              org.processmining.models.graphbased.directed.petrinet.Petrinet net,
                                              org.processmining.models.graphbased.directed.petrinet.elements.Transition trans)
        Calculates the change in the number of tokens inside the given fragment when executing the given transition, i.e. the differences of the number of tokens added to the fragment by the transition and the number of tokens the transition consumes from the fragment.
        Parameters:
        frag - Fragment of net.
        net - Petri net containing the fragment and the transition.
        trans - Transition for which the number of tokens should be calculated.
        Returns:
        int value of the number of tokens.
      • isInitialPlaceInFragment

        public static boolean isInitialPlaceInFragment​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode fragment,
                                                       org.processmining.models.graphbased.directed.petrinet.Petrinet net)
        Returns true if the inital place of the Petri net is inside the fragment.
        Parameters:
        fragment - Considered fragment.
        net - Considered Petri net.
        Returns:
        True if initial place is in fragment, else false.
      • isFinalPlaceInFragment

        public static boolean isFinalPlaceInFragment​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode fragment,
                                                     org.processmining.models.graphbased.directed.petrinet.Petrinet net)
        Returns true if the final place of the Petri net is inside the fragment.
        Parameters:
        fragment - Considered fragment.
        net - Considered Petri net.
        Returns:
        True if final place is in fragment, else false.
      • generateRPST

        public static org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPST generateRPST​(org.processmining.framework.plugin.PluginContext context,
                                                                                                          org.processmining.models.graphbased.directed.petrinet.Petrinet net,
                                                                                                          boolean ignore_long_term,
                                                                                                          org.deckfour.xes.model.XLog log1,
                                                                                                          org.processmining.plugins.petrinet.replayresult.PNRepResult alignments1,
                                                                                                          org.deckfour.xes.model.XLog log2,
                                                                                                          org.processmining.plugins.petrinet.replayresult.PNRepResult alignments2)
        Generates an RPST for the given Petri net using the GenerateRPSTFromPetriNetPlugin from the acceptingpetrinetdecomposer package.
        Parameters:
        context - Plugin context
        net - Petri net for which the RPST is created
        ignore_long_term - if true, long-term dependencies are filtered out when creating the RPST
        log1 - Event log used to calculate sojourn times of places, to determine places for removal. CANNOT BE NULL!
        alignments1 - Alignments used to calculate sojourn times of places, to determine places for removal. CANNOT BE NULL!
        log2 - Second event log used to calculate sojourn times of places, to determine places for removal. Can be null!
        alignments2 - Second alignments used to calculate sojourn times of places, to determine places for removal. Can be null!
        Returns:
        RPST of the given Petri net
      • addSingleEdgeFragment

        public static void addSingleEdgeFragment​(org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode parent,
                                                 edu.uci.ics.jung.graph.DirectedGraph<org.processmining.acceptingpetrinetdecomposer.models.rpst.PetriNetRPSTNode,​java.lang.String> tree,
                                                 org.processmining.models.graphbased.directed.petrinet.elements.Arc edge)
      • addPlace

        public static org.processmining.models.graphbased.directed.petrinet.elements.Place addPlace​(org.processmining.models.graphbased.directed.petrinet.Petrinet net,
                                                                                                    java.lang.String label,
                                                                                                    java.util.Collection<org.processmining.models.graphbased.directed.petrinet.PetrinetNode> predecessors,
                                                                                                    java.util.Collection<org.processmining.models.graphbased.directed.petrinet.PetrinetNode> successors)
        Adds a new place with the given label to the Petri net and creates arcs from the predecessors to the new place and from the place to all successors.
        Parameters:
        net - Petri net to which the place should be added.
        label - Label of the new place.
        predecessors - Collection of predecessors of the new place.
        successors - Collection of successors of the new place.
        Returns:
        Pointer to the created place.
      • copy_timestamp

        public static java.util.Date copy_timestamp​(java.util.Date timestamp)
      • get_event_timestamp

        public static java.util.Date get_event_timestamp​(org.deckfour.xes.model.XEvent event)
      • getAverageSojournTimes

        public static java.util.Map<org.processmining.models.graphbased.directed.petrinet.elements.Place,​java.time.Duration> getAverageSojournTimes​(org.processmining.models.graphbased.directed.petrinet.Petrinet net,
                                                                                                                                                          org.deckfour.xes.model.XLog log1,
                                                                                                                                                          org.processmining.plugins.petrinet.replayresult.PNRepResult alignments1,
                                                                                                                                                          org.deckfour.xes.model.XLog log2,
                                                                                                                                                          org.processmining.plugins.petrinet.replayresult.PNRepResult alignments2)
        Parameters:
        net -
        log1 -
        alignments1 -
        log2 -
        alignments2 -
        Returns:
        Might return null, if no place if no synchronous moves occur