Class PrimeMinerAlgorithmSteps


  • public class PrimeMinerAlgorithmSteps
    extends java.lang.Object
    AlgorithmSteps contains all the calculations which are part of the steps of the prime miner. It contains on the first section the main steps of the prime miner in several methods. The middle part is filled with some helper functions, used by the main steps. Last but not least the setters and getters are on the end.
    Author:
    Robin Bergenthum, Raphael Meyer
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addStatesToPES​(PrimeEventStructure pes)
      iterates over all events and add states
      static java.lang.String arrayToString​(int[] array)
      Converts an array of ints into a String
      static java.util.ArrayList<Region> buildInitialRegions​(java.util.ArrayList<Region> switchingRegions, java.util.ArrayList<Region> excitationRegions)
      Builds a Set of regions from the sets of switching and excitation region and avoid the availability of double regions
      static org.processmining.models.graphbased.directed.petrinet.Petrinet buildPetriNet()  
      static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> calcConcurrentAlpha​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
      STEP 2: ALPHA: Use the concurrency oracle "alpha" to detect concurrent elements
      static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> calcConcurrentLaterThan​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
      STEP 2: LATER-THAN: Use the concurrency oracle "later-than" to detect concurrent elements
      static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> calcConcurrentLifecycle​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
      STEP 2: LIFECYCLE: Use the concurrency oracle "lifecycle" to detect concurrent elements
      static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> calcConcurrentNone​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
      STEP 2: (NONE) Determine a concurrency relationship without an oracle
      static java.util.ArrayList<java.util.ArrayList<java.lang.String>> calcLanguage​(org.deckfour.xes.model.XLog log)
      STEP 1: Calculate Language of an Event Log A language is based on words.
      static java.util.ArrayList<HasseDiagram> calcPartialLanguage​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language, java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> concurrent)
      STEP 3: Folding language with concurrency to a partial language
      static java.util.ArrayList<Region> calculateExcitationRegions​(PrimeEventStructure pes)
      calculates an excitation region
      static java.util.ArrayList<Region> calculateSwitchingRegions​(PrimeEventStructure pes)
      calculates an switching region
      static org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray createStatsForDialog​(org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray acceptingPetriNetArray, java.util.ArrayList<java.util.ArrayList<java.lang.String>> language, java.lang.Boolean isShowHasse)
      This creates some final statistic data of the originally third dialog
      static java.util.ArrayList<java.lang.String> detectOracles​(org.deckfour.xes.model.XLog log)
      Returns an ArrayList of Strings that contains all Oracles detected in the log.
      static org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray establishHasseDiagrams​(java.util.ArrayList<HasseDiagram> partialLanguage, int consideredHasses, boolean isShowHasse, org.processmining.framework.plugin.PluginContext context, org.processmining.acceptingpetrinet.models.impl.AcceptingPetriNetFactory acceptingPetriNetFactory, org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray acceptingPetriNetArray, org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray singleSolutionPetriNetArray)
      STEP 3: establish the hasse diagrams and calls the methods of STEP 4 and STEP 5 while running
      static void fire​(org.processmining.models.graphbased.directed.petrinet.elements.Transition transition, org.processmining.models.semantics.petrinet.Marking marking, org.processmining.models.graphbased.directed.petrinet.Petrinet petriNet)
      fire
      static java.util.ArrayList<Event> getAllEventsWithLabel​(PrimeEventStructure pes, java.lang.String label)
      Searches all events in a PrimeEventStructure with this label
      static java.util.ArrayList<java.lang.String> getAllLabels​(PrimeEventStructure pes)
      Collect all labels of a given PrimeEventStructure
      static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> getConcurrent()  
      static java.util.ArrayList<java.util.ArrayList<java.lang.String>> getLanguage()  
      static int[] getLanguageDistribution()  
      static int getLanguageSize()  
      static int getLogSize()  
      static int getLogSizeWithoutPrefixes()  
      static java.util.ArrayList<java.lang.String> getOracleChoice()  
      static java.util.ArrayList<HasseDiagram> getPartialLanguage()  
      static int[] getPartialLanguageDistribution()  
      static int getPartialLanguageSize()  
      static org.processmining.models.graphbased.directed.petrinet.elements.Transition getTransition​(org.processmining.models.graphbased.directed.petrinet.Petrinet petriNet, java.lang.String label)
      Searching a transition which is equal to a given label in a given petriNet
      static org.deckfour.xes.extension.std.XConceptExtension getXconcept()  
      static org.deckfour.xes.extension.std.XCostExtension getXcost()  
      static org.deckfour.xes.extension.std.XLifecycleExtension getXlifecycle()  
      static void initInstances()
      this initialize several instances from the XES standard
      static boolean isDebug()  
      static boolean isEnabled​(org.processmining.models.graphbased.directed.petrinet.elements.Transition transition, org.processmining.models.semantics.petrinet.Marking marking, org.processmining.models.graphbased.directed.petrinet.Petrinet petriNet)
      shows up, if a marking contains a place
      static boolean isEqual​(Region region1, Region region2)
      Checks if a region is equal to another one
      static boolean isSubset​(Region subsetRegion, Region supersetRegion)
      Checks if a region is a subset of another one
      static boolean noNextStateSelectedYet​(Event event, int coSet, Region region)
      checks if no nextState was selected in a region of the event in the coset
      static boolean noPreviousStateSelectedYet​(Event event, int coSet, Region region)
      checks if no previousState was selected in a region of the event in the coset
      static void setConcurrent​(java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> concurrent)  
      static void setDebug​(boolean debug)  
      static void setLanguage​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)  
      static void setLanguageDistribution​(int[] languageDistribution)  
      static void setLanguageSize​(int languageSize)  
      static void setLogSize​(int logSize)  
      static void setLogSizeWithoutPrefixes​(int logSizeWithoutPrefixes)  
      static void setOracleChoice​(java.util.ArrayList<java.lang.String> oracleChoice)  
      static void setPartialLanguage​(java.util.ArrayList<HasseDiagram> partialLanguage)  
      static void setPartialLanguageDistribution​(int[] partialLanguageDistribution)  
      static void setPartialLanguageSize​(int partialLanguageSize)  
      static void setXconcept​(org.deckfour.xes.extension.std.XConceptExtension xconcept)  
      static void setXcost​(org.deckfour.xes.extension.std.XCostExtension xcost)  
      static void setXlifecycle​(org.deckfour.xes.extension.std.XLifecycleExtension xlifecycle)  
      static org.processmining.models.graphbased.directed.petrinet.Petrinet synthesize​(org.processmining.framework.plugin.PluginContext context, PrimeEventStructure pes)
      STEP 5: Synthesize the workflow model
      static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> useConcurrencyOracle​(java.lang.String oracle, java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
      STEP 2: Base Method: Use the concurrency oracle to detect concurrent elements In this case selectedOracle can be (LaterThan,) Life cycle, Alpha or None.
      static java.lang.String write​(java.util.ArrayList<java.lang.String> manyStrings)
      This concatenate a string from an ArrayList of Strings
      • Methods inherited from class java.lang.Object

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

      • PrimeMinerAlgorithmSteps

        public PrimeMinerAlgorithmSteps()
    • Method Detail

      • detectOracles

        public static java.util.ArrayList<java.lang.String> detectOracles​(org.deckfour.xes.model.XLog log)
        Returns an ArrayList of Strings that contains all Oracles detected in the log. Supported Oracles are ("later-than",) "lifecycle", "alpha" and "none". First we pull out every trace from the log. For each trace the events are pulled out. With each event we are looking for informations that fit to an oracle. this method is similar to the check from the EVE Algorithm
        Parameters:
        log - the given log-File, imported from User in PROM-Tool
        Returns:
        a list of detected Oracles in the log
      • calcLanguage

        public static java.util.ArrayList<java.util.ArrayList<java.lang.String>> calcLanguage​(org.deckfour.xes.model.XLog log)
        STEP 1: Calculate Language of an Event Log A language is based on words. Each trace which is added to the language represents a word. A trace contains several events. These events contains a name (maybe a transition, cost informations)
        Parameters:
        log - the given log-File, imported from User in PROM-Tool
        Returns:
        calculated language from the given log with traces as words (composed of events) The language is an ArrayList which contains several ArrayLists of strings
      • useConcurrencyOracle

        public static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> useConcurrencyOracle​(java.lang.String oracle,
                                                                                                                           java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
        STEP 2: Base Method: Use the concurrency oracle to detect concurrent elements In this case selectedOracle can be (LaterThan,) Life cycle, Alpha or None. This method builds the starting point for the calculation of concurrent actions. Calls printConcurrentActions for output the concurrency relationships before return.
        Parameters:
        oracle - the selected oracle (by user or default)
        language - the calculated language from log with method calcLanguage(XLog log)
        Returns:
        elements with concurrency relationships
      • calcConcurrentLaterThan

        public static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> calcConcurrentLaterThan​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
        STEP 2: LATER-THAN: Use the concurrency oracle "later-than" to detect concurrent elements
        Parameters:
        language - the calculated language from log with method calcLanguage(XLog log)
        Returns:
        elements with concurrency relationships
      • calcConcurrentLifecycle

        public static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> calcConcurrentLifecycle​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
        STEP 2: LIFECYCLE: Use the concurrency oracle "lifecycle" to detect concurrent elements
        Parameters:
        language - the calculated language from log with method calcLanguage(XLog log)
        Returns:
        elements with concurrency relationships
      • calcConcurrentAlpha

        public static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> calcConcurrentAlpha​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
        STEP 2: ALPHA: Use the concurrency oracle "alpha" to detect concurrent elements
        Parameters:
        language - the calculated language from log with method calcLanguage(XLog log)
        Returns:
        elements with concurrency relationships
      • calcConcurrentNone

        public static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> calcConcurrentNone​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
        STEP 2: (NONE) Determine a concurrency relationship without an oracle
        Parameters:
        language - the calculated language from log with method calcLanguage(XLog log)
        Returns:
        elements with concurrency relationships
      • calcPartialLanguage

        public static java.util.ArrayList<HasseDiagram> calcPartialLanguage​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language,
                                                                            java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> concurrent)
        STEP 3: Folding language with concurrency to a partial language
        Parameters:
        language - the calculated language from log with method calcLanguage(XLog log)
        concurrent - the concurrent, calculated from previous steps like later-than, lifecycle, alpha
        Returns:
        the partial language
      • establishHasseDiagrams

        public static org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray establishHasseDiagrams​(java.util.ArrayList<HasseDiagram> partialLanguage,
                                                                                                               int consideredHasses,
                                                                                                               boolean isShowHasse,
                                                                                                               org.processmining.framework.plugin.PluginContext context,
                                                                                                               org.processmining.acceptingpetrinet.models.impl.AcceptingPetriNetFactory acceptingPetriNetFactory,
                                                                                                               org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray acceptingPetriNetArray,
                                                                                                               org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray singleSolutionPetriNetArray)
        STEP 3: establish the hasse diagrams and calls the methods of STEP 4 and STEP 5 while running
        Parameters:
        partialLanguage - the partial Language from the previous step of folding the language
        consideredHasses - the maximum amount hasse which should considered and also the max runs the algorithm should do
        isShowHasse - boolean value; true stands for: show me the hasses; false means: mine the petrinet
        context - the plugin context
        acceptingPetriNetFactory - the factory for acceptingpetrinets
        acceptingPetriNetArray - an acceptingpetrinet array
        singleSolutionPetriNetArray - if oneSolution is true, only one petry net will store in this array to return
        Returns:
        the workflow model as petrinet array
      • synthesize

        public static org.processmining.models.graphbased.directed.petrinet.Petrinet synthesize​(org.processmining.framework.plugin.PluginContext context,
                                                                                                PrimeEventStructure pes)
        STEP 5: Synthesize the workflow model
        Parameters:
        context - the PluginContext
        pes - a given PrimeEventStructure
        Returns:
        the workflow model as petrinet
      • write

        public static java.lang.String write​(java.util.ArrayList<java.lang.String> manyStrings)
        This concatenate a string from an ArrayList of Strings
        Parameters:
        manyStrings - some Strings to concatenate
        Returns:
        a concatenated string
      • isEqual

        public static boolean isEqual​(Region region1,
                                      Region region2)
        Checks if a region is equal to another one
        Parameters:
        region1 - first region
        region2 - second region
        Returns:
        whether two regions are equal
      • isSubset

        public static boolean isSubset​(Region subsetRegion,
                                       Region supersetRegion)
        Checks if a region is a subset of another one
        Parameters:
        subsetRegion - the suspected subset region
        supersetRegion - the super region
        Returns:
        whether a suspected subset region is a subset region
      • getAllLabels

        public static java.util.ArrayList<java.lang.String> getAllLabels​(PrimeEventStructure pes)
        Collect all labels of a given PrimeEventStructure
        Parameters:
        pes - the given PrimeEventStructure
        Returns:
        all labels of a given PrimeEventStructure
      • getAllEventsWithLabel

        public static java.util.ArrayList<Event> getAllEventsWithLabel​(PrimeEventStructure pes,
                                                                       java.lang.String label)
        Searches all events in a PrimeEventStructure with this label
        Parameters:
        pes - a given PrimeEventStructure
        label - a given label
        Returns:
        all events which are equal to the given label
      • getTransition

        public static org.processmining.models.graphbased.directed.petrinet.elements.Transition getTransition​(org.processmining.models.graphbased.directed.petrinet.Petrinet petriNet,
                                                                                                              java.lang.String label)
        Searching a transition which is equal to a given label in a given petriNet
        Parameters:
        petriNet - the given petriNet
        label - the given label
        Returns:
        a transition with a lebel equal to given label
      • arrayToString

        public static java.lang.String arrayToString​(int[] array)
        Converts an array of ints into a String
        Parameters:
        array - a given array with ints
        Returns:
        a concatenated string with elements of the array
      • buildPetriNet

        public static org.processmining.models.graphbased.directed.petrinet.Petrinet buildPetriNet()
        Returns:
        a built petriNet with label Test
      • calculateSwitchingRegions

        public static java.util.ArrayList<Region> calculateSwitchingRegions​(PrimeEventStructure pes)
        calculates an switching region
        Parameters:
        pes - a given PrimeEventStructure
        Returns:
        an switching region
      • calculateExcitationRegions

        public static java.util.ArrayList<Region> calculateExcitationRegions​(PrimeEventStructure pes)
        calculates an excitation region
        Parameters:
        pes - a given PrimeEventStructure
        Returns:
        an excitation region
      • buildInitialRegions

        public static java.util.ArrayList<Region> buildInitialRegions​(java.util.ArrayList<Region> switchingRegions,
                                                                      java.util.ArrayList<Region> excitationRegions)
        Builds a Set of regions from the sets of switching and excitation region and avoid the availability of double regions
        Parameters:
        switchingRegions - the switching regions
        excitationRegions - the excitation regions
        Returns:
        a set of regions
      • noNextStateSelectedYet

        public static boolean noNextStateSelectedYet​(Event event,
                                                     int coSet,
                                                     Region region)
        checks if no nextState was selected in a region of the event in the coset
        Parameters:
        event - an event
        coSet - the coset
        region - the region of the event
        Returns:
        whether nextState is selected
      • noPreviousStateSelectedYet

        public static boolean noPreviousStateSelectedYet​(Event event,
                                                         int coSet,
                                                         Region region)
        checks if no previousState was selected in a region of the event in the coset
        Parameters:
        event - an event
        coSet - the coset
        region - the region of the event
        Returns:
        whether previousState is selected
      • addStatesToPES

        public static void addStatesToPES​(PrimeEventStructure pes)
        iterates over all events and add states
        Parameters:
        pes - a PrimeEventStructure to iterate
      • createStatsForDialog

        public static org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray createStatsForDialog​(org.processmining.acceptingpetrinet.models.AcceptingPetriNetArray acceptingPetriNetArray,
                                                                                                             java.util.ArrayList<java.util.ArrayList<java.lang.String>> language,
                                                                                                             java.lang.Boolean isShowHasse)
        This creates some final statistic data of the originally third dialog
        Parameters:
        acceptingPetriNetArray - an acceptingPetriNetArray created by a factory
        language - the language given from previous methos
        isShowHasse - should the plugin show the hasse diagrams (true) or mine the petrinet (false)
        Returns:
        the accepting petrinet array
      • isEnabled

        public static boolean isEnabled​(org.processmining.models.graphbased.directed.petrinet.elements.Transition transition,
                                        org.processmining.models.semantics.petrinet.Marking marking,
                                        org.processmining.models.graphbased.directed.petrinet.Petrinet petriNet)
        shows up, if a marking contains a place
        Parameters:
        transition - a transition
        marking - a marking
        petriNet - a petriNet on which the arc should exists
        Returns:
        whether a marking is enabled
      • fire

        public static void fire​(org.processmining.models.graphbased.directed.petrinet.elements.Transition transition,
                                org.processmining.models.semantics.petrinet.Marking marking,
                                org.processmining.models.graphbased.directed.petrinet.Petrinet petriNet)
        fire
        Parameters:
        transition - a transition
        marking - the marking
        petriNet - the petriNet to interact with
      • initInstances

        public static void initInstances()
        this initialize several instances from the XES standard
      • getPartialLanguageDistribution

        public static int[] getPartialLanguageDistribution()
        Returns:
        the distribution of the partial language
      • setPartialLanguageDistribution

        public static void setPartialLanguageDistribution​(int[] partialLanguageDistribution)
        Parameters:
        partialLanguageDistribution - set the distribution of the partial language
      • getPartialLanguageSize

        public static int getPartialLanguageSize()
        Returns:
        the partial language size
      • setPartialLanguageSize

        public static void setPartialLanguageSize​(int partialLanguageSize)
        Parameters:
        partialLanguageSize - set the partial language size
      • getXconcept

        public static org.deckfour.xes.extension.std.XConceptExtension getXconcept()
        Returns:
        the XConceptExtension
      • setXconcept

        public static void setXconcept​(org.deckfour.xes.extension.std.XConceptExtension xconcept)
        Parameters:
        xconcept - set the XConceptExtension
      • getXlifecycle

        public static org.deckfour.xes.extension.std.XLifecycleExtension getXlifecycle()
        Returns:
        the XLifecycleExtension
      • setXlifecycle

        public static void setXlifecycle​(org.deckfour.xes.extension.std.XLifecycleExtension xlifecycle)
        Parameters:
        xlifecycle - set the XLifecycleExtension
      • getXcost

        public static org.deckfour.xes.extension.std.XCostExtension getXcost()
        Returns:
        the XCostExtension
      • setXcost

        public static void setXcost​(org.deckfour.xes.extension.std.XCostExtension xcost)
        Parameters:
        xcost - the XCostExtension
      • isDebug

        public static boolean isDebug()
        Returns:
        if debug is true or false
      • setDebug

        public static void setDebug​(boolean debug)
        Parameters:
        debug - set debug to true or false
      • getLogSize

        public static int getLogSize()
        Returns:
        the size of the log
      • setLogSize

        public static void setLogSize​(int logSize)
        Parameters:
        logSize - set size of the log
      • getLogSizeWithoutPrefixes

        public static int getLogSizeWithoutPrefixes()
        Returns:
        the log size adjusted, without prefix
      • setLogSizeWithoutPrefixes

        public static void setLogSizeWithoutPrefixes​(int logSizeWithoutPrefixes)
        Parameters:
        logSizeWithoutPrefixes - set the log size adjusted, without prefix
      • getLanguageSize

        public static int getLanguageSize()
        Returns:
        the language size
      • setLanguageSize

        public static void setLanguageSize​(int languageSize)
        Parameters:
        languageSize - set the language size
      • getLanguageDistribution

        public static int[] getLanguageDistribution()
        Returns:
        the distribution of the language
      • setLanguageDistribution

        public static void setLanguageDistribution​(int[] languageDistribution)
        Parameters:
        languageDistribution - set the distribution of the language
      • getOracleChoice

        public static java.util.ArrayList<java.lang.String> getOracleChoice()
        Returns:
        the selected oracle
      • setOracleChoice

        public static void setOracleChoice​(java.util.ArrayList<java.lang.String> oracleChoice)
        Parameters:
        oracleChoice - set the selected oracle
      • getConcurrent

        public static java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> getConcurrent()
        Returns:
        the concurrency which are detected by an oracle
      • setConcurrent

        public static void setConcurrent​(java.util.HashMap<java.lang.String,​java.util.ArrayList<java.lang.String>> concurrent)
        Parameters:
        concurrent - the concurrency which are detected by an oracle
      • getPartialLanguage

        public static java.util.ArrayList<HasseDiagram> getPartialLanguage()
        Returns:
        the partial language
      • setPartialLanguage

        public static void setPartialLanguage​(java.util.ArrayList<HasseDiagram> partialLanguage)
        Parameters:
        partialLanguage - set the partial language
      • getLanguage

        public static java.util.ArrayList<java.util.ArrayList<java.lang.String>> getLanguage()
        Returns:
        the language extracted from the log
      • setLanguage

        public static void setLanguage​(java.util.ArrayList<java.util.ArrayList<java.lang.String>> language)
        Parameters:
        language - set the language