org.processmining.analysis.performance
Class ExtendedActivity

java.lang.Object
  extended by org.processmining.analysis.performance.ExtendedActivity

public class ExtendedActivity
extends java.lang.Object

This class is used to represent activities and to enhance these activities with performance related information, such as the waiting time, execution time, sojourn time and the like.

Version:
1.0
Author:
Peter T.G. Hornix (p.t.g.hornix@student.tue.nl)

Constructor Summary
ExtendedActivity(java.lang.String aName)
          Creates and initializes a new ExtendedActivity-object.
 
Method Summary
 void calculateMetrics(java.util.ArrayList piList, int fitOption, java.util.HashSet failedInstances)
          Calculates waiting time, execution time and sojourn time of the activity for each measurement, if possible, and places these times in waitStatistics, executionStatistics and sojournStatistics respectively.
 void checkWhichMetricsToUse()
          Checks whether normal time measurements can be used (sojourn time, waiting time, execution).
 void exportToFile(java.util.ArrayList piList, java.io.File file, long divider, java.lang.String sort, int fitOption)
          Exports all time measurements (waiting, execution, sojourn time) taken in process instances in piList and corresponding to this activity to (a comma-seperated text) file.
 double getArrivalRate()
          Returns the arrival rate
 double[] getAvgExecutionTimes(double fastestPercentage, double slowestPercentage)
          Returns the average of fast, slow and normal speed execution times in form of an array of type double.
 double[] getAvgSojournTimes(double fastestPercentage, double slowestPercentage)
          Returns the average of fast, slow and normal speed sojourn times in form of an array of type double.
 double[] getAvgWaitTimes(double fastestPercentage, double slowestPercentage)
          Returns the average of fast, slow and normal speed waiting times in form of an array of type double.
 boolean getBoundExecutionUsed()
           
 boolean getBoundSojournUsed()
           
 boolean getBoundWaitingUsed()
           
 long getFrequencyExecution()
          Returns the number of execution time measurements present for this activity
 long getFrequencySojourn()
          Returns the number of sojourn time measurements present for this activity
 long getFrequencyWait()
          Returns the number of waiting time measurements present for this activity
 double getMaxExecutionTime()
          Returns the maximum execution time of this activity.
 double getMaxSojournTime()
          Returns the maximum sojourn time of this activity.
 double getMaxWaitTime()
          Returns the maximum waiting time of this activity.
 double getMeanExecutionTime()
          Returns the mean execution time of this activity.
 double getMeanSojournTime()
          Returns the mean sojourn time of this activity.
 double getMeanWaitTime()
          Returns the mean waiting time of this activity.
 double getMinExecutionTime()
          Returns the minimum execution time of this activity.
 double getMinSojournTime()
          Returns the minimum sojourn time of this activity.
 double getMinWaitTime()
          Returns the minimum waiting time of this activity.
 java.lang.String getName()
          Returns the name of the activity
 int[] getSizes(double fastestPercentage, double slowestPercentage, int length)
          Returns an array containing the number of measurements that are considered to be fast (place 0 in array), the number of measurements that are considered to be slow (place 1 in array) and the number of measurements that are of 'normal' speed (place 2 in array).
 double getStdevExecutionTime()
          Returns the standard deviation in execution time of this activity.
 double getStdevSojournTime()
          Returns the standard deviation in sojourn time of this activity.
 double getStdevWaitTime()
          Returns the standard deviation in waiting time of this activity.
 void measure(java.lang.String piName, java.util.Date timestamp, java.util.Date transEnabled, java.lang.String type, java.lang.String transitionFailed, boolean failedBefore)
          Adds a new measurement or adjusts the last measurement in ArrayList measurements.
 void setDiscardBoundFinal()
           
 void setFinalTimeLast(java.lang.String piName, java.util.Date timeStamp, boolean failedBeforeEnd, boolean failedEnd)
          Sets the end date of the last measurement to timeStamp if timeStamp occured before the end date of the last measurement or the end date is currently null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtendedActivity

public ExtendedActivity(java.lang.String aName)
Creates and initializes a new ExtendedActivity-object.

Parameters:
aName - String: name of the activity
Method Detail

measure

public void measure(java.lang.String piName,
                    java.util.Date timestamp,
                    java.util.Date transEnabled,
                    java.lang.String type,
                    java.lang.String transitionFailed,
                    boolean failedBefore)
Adds a new measurement or adjusts the last measurement in ArrayList measurements. Called when a transition corresponding to the activitity fires.

Parameters:
piName - String: process instance ID in which the measurement was taken
timestamp - Date: measured timestamp
transEnabled - Date: timestamp at which the transition that calls this method was enabled
type - String: event type that occurred
transitionFailed - String: contains the event-type of the transition if it did not fire regularly
failedBefore - boolean: true in case a transition in the trace with name piName failed, before this method was called

setFinalTimeLast

public void setFinalTimeLast(java.lang.String piName,
                             java.util.Date timeStamp,
                             boolean failedBeforeEnd,
                             boolean failedEnd)
Sets the end date of the last measurement to timeStamp if timeStamp occured before the end date of the last measurement or the end date is currently null. If the transition after the last transition corresponding to the activity failed, then "end" is added to failedTransitions of the last measurement. Furthermore, if a transition in the trace piName failed execution before the transition after the last transition executed, then "end" is added to failedBeforeTransitions of the last measurement.

Parameters:
piName - String: Name of process instance
timeStamp - Date: Date to which the end date of the last measurement is compared and possibly set (if before the current end date)
failedBeforeEnd - boolean: true if the trace piName failed before this method was called
failedEnd - boolean: true if the transition after the last transition corresponding to this activity failed execution

setDiscardBoundFinal

public void setDiscardBoundFinal()

calculateMetrics

public void calculateMetrics(java.util.ArrayList piList,
                             int fitOption,
                             java.util.HashSet failedInstances)
Calculates waiting time, execution time and sojourn time of the activity for each measurement, if possible, and places these times in waitStatistics, executionStatistics and sojournStatistics respectively. In case information is incomplete (i.e. not schedule-start-complete present) then upper bound for these time-metrics are derived, if possible and placed in upperBoundWaitStatistics, upperBoundExecutionStatistics and upperBoundSojournStatistics (e.g. when the log only contains complete events, then it may be possible to derive an upper bound for the sojourn time

Parameters:
piList - ArrayList: Names of the process instances that are considered
fitOption - int: selected fitness/conformance option (calculation of activity metrics is dependent on how we deal with non-conformance)
failedInstances - HashSet: set of traces that executed executed unsuccessfully or terminated unproperly

exportToFile

public void exportToFile(java.util.ArrayList piList,
                         java.io.File file,
                         long divider,
                         java.lang.String sort,
                         int fitOption)
                  throws java.io.IOException
Exports all time measurements (waiting, execution, sojourn time) taken in process instances in piList and corresponding to this activity to (a comma-seperated text) file.

Parameters:
piList - ArrayList
file - File
divider - long
sort - String
fitOption - int
Throws:
java.io.IOException

checkWhichMetricsToUse

public void checkWhichMetricsToUse()
Checks whether normal time measurements can be used (sojourn time, waiting time, execution). If not, upper bounds of these time measurements are used instead (if possible).


getName

public java.lang.String getName()
Returns the name of the activity

Returns:
String

getMeanWaitTime

public double getMeanWaitTime()
Returns the mean waiting time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getMinWaitTime

public double getMinWaitTime()
Returns the minimum waiting time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getMaxWaitTime

public double getMaxWaitTime()
Returns the maximum waiting time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getStdevWaitTime

public double getStdevWaitTime()
Returns the standard deviation in waiting time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getFrequencyWait

public long getFrequencyWait()
Returns the number of waiting time measurements present for this activity

Returns:
long

getAvgWaitTimes

public double[] getAvgWaitTimes(double fastestPercentage,
                                double slowestPercentage)
Returns the average of fast, slow and normal speed waiting times in form of an array of type double. Where: [0..2]: fast-slow-normal

Parameters:
fastestPercentage - double: percentage of 'fast' times
slowestPercentage - double: percentage of 'slow' times
Returns:
double[]

getMeanExecutionTime

public double getMeanExecutionTime()
Returns the mean execution time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getMinExecutionTime

public double getMinExecutionTime()
Returns the minimum execution time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getMaxExecutionTime

public double getMaxExecutionTime()
Returns the maximum execution time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getStdevExecutionTime

public double getStdevExecutionTime()
Returns the standard deviation in execution time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getFrequencyExecution

public long getFrequencyExecution()
Returns the number of execution time measurements present for this activity

Returns:
long

getAvgExecutionTimes

public double[] getAvgExecutionTimes(double fastestPercentage,
                                     double slowestPercentage)
Returns the average of fast, slow and normal speed execution times in form of an array of type double. Where: [0..2]: fast-slow-normal

Parameters:
fastestPercentage - double: percentage of 'fast' times
slowestPercentage - double: percentage of 'slow' times
Returns:
double[]

getMeanSojournTime

public double getMeanSojournTime()
Returns the mean sojourn time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getMinSojournTime

public double getMinSojournTime()
Returns the minimum sojourn time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getMaxSojournTime

public double getMaxSojournTime()
Returns the maximum sojourn time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getStdevSojournTime

public double getStdevSojournTime()
Returns the standard deviation in sojourn time of this activity. Note that the method calculateTimes should be called before this method.

Returns:
double

getFrequencySojourn

public long getFrequencySojourn()
Returns the number of sojourn time measurements present for this activity

Returns:
long

getAvgSojournTimes

public double[] getAvgSojournTimes(double fastestPercentage,
                                   double slowestPercentage)
Returns the average of fast, slow and normal speed sojourn times in form of an array of type double. Where: [0..2]: fast-slow-normal

Parameters:
fastestPercentage - double: percentage of 'fast' times
slowestPercentage - double: percentage of 'slow' times
Returns:
double[]

getArrivalRate

public double getArrivalRate()
Returns the arrival rate

Returns:
double

getSizes

public int[] getSizes(double fastestPercentage,
                      double slowestPercentage,
                      int length)
Returns an array containing the number of measurements that are considered to be fast (place 0 in array), the number of measurements that are considered to be slow (place 1 in array) and the number of measurements that are of 'normal' speed (place 2 in array). Based on fastestPercentage, slowestPercentage and the given length.

Parameters:
fastestPercentage - double
slowestPercentage - double
length - int
Returns:
int[]

getBoundSojournUsed

public boolean getBoundSojournUsed()

getBoundWaitingUsed

public boolean getBoundWaitingUsed()

getBoundExecutionUsed

public boolean getBoundExecutionUsed()