org.processmining.framework.models.heuristics
Class HeuristicsNet

java.lang.Object
  extended by org.processmining.framework.models.heuristics.HeuristicsNet
All Implemented Interfaces:
java.lang.Comparable, DotFileWriter
Direct Known Subclasses:
DependencyHeuristicsNet

public class HeuristicsNet
extends java.lang.Object
implements java.lang.Comparable, DotFileWriter

Title: Heuristics Net

Description:

Copyright: Copyright (c) 2004

Company: Eindhoven University of Technology (TU/e)

Version:
1.0
Author:
Ana Karla A. de Medeiros

Field Summary
static java.lang.String AND_SEPARATOR
           
static java.lang.String EMPTY_SET
           
static java.lang.String EVENT_SEPARATOR
           
static java.lang.String FIELD_SEPARATOR
           
static java.lang.String FIRST_NET_LABEL
           
static java.lang.String INPUT_SETS_HEADER
           
static java.lang.String OR_SEPARATOR
           
static java.lang.String OUTPUT_SETS_HEADER
           
static java.lang.String SECOND_NET_LABEL
           
static java.lang.String SETS_SEPARATOR
           
static java.lang.String WME_HEADER
           
static char WME_NAME_DELIMITER
           
 
Constructor Summary
HeuristicsNet(LogEvents events)
          This method builds a net without duplicate tasks.
HeuristicsNet(LogEvents events, int[] duplicatesMapping, HNSubSet[] reverseDuplicatesMapping)
          This method builds a net that may contain duplicate tasks.
 
Method Summary
static HNSubSet[] buildReverseDuplicatesMapping(int[] duplicatesMapping)
          Builds a reverse mapping to an array of duplicates mapping.
protected  java.lang.Object clone()
          Deep cloning!
 int compareTo(java.lang.Object o)
           
 HeuristicsNet copyNet()
          Deep copy from the net.
 java.lang.String diffForSets(HeuristicsNet netToCompare)
           
 void disconnectArcsUsedBelowThreshold(double threshold)
           
 void disconnectUnusedElements()
          This method builds a phenotype that disconnect the tasks and arcs that are not used during the parsing of an event log.
 boolean equals(java.lang.Object anObject)
          This method compares the input and output sets of two individuals.
 HNSubSet getAllElementsInputSet(int index)
          Returns the union set of all int in the subset of the input set at " index".
 HNSubSet getAllElementsOutputSet(int index)
          Returns the union set of all int in the subset of the output set at " index".
 cern.colt.matrix.DoubleMatrix2D getArcUsage()
           
 int[] getDuplicatesActualFiring()
           
 int[] getDuplicatesMapping()
           
static int[] getElements(HNSet set)
           
 int getEndTask()
           
 double getFitness()
           
 ModelGraphPanel getGrappaVisualization()
           
 ModelGraphPanel getGrappaVisualizationWithSplitJoinSemantics()
           
 HNSet getInputSet(int index)
           
 HNSet[] getInputSets()
           
 HNSet getInputSetsWithElement(int index, int element)
          Retrieves subsets from an INPUT set of "index".
 HNSubSet getInputSetWithElement(int index, int element)
          Retrieves a subset from an INPUT set of "index".
 LogEvents getLogEvents()
           
 int getNumberInputSet(int index)
           
 int getNumberOutputSet(int index)
           
 HNSet getOutputSet(int index)
           
 HNSet[] getOutputSets()
           
 HNSet getOutputSetsWithElement(int index, int element)
          Retrieves subsets from an OUTPUT set of "index".
 HNSubSet getOutputSetWithElement(int index, int element)
          Retrieves a subset from an OUTPUT set of "index".
 HNSubSet[] getReverseDuplicatesMapping()
           
 int getStartTask()
           
 int hashCode()
           
 void increaseArcUsage(int element, HNSubSet usedInputElements, int amount)
           
 void increaseElementActualFiring(int element, int amount)
          Add 'amount' to the counter of the number of times that a duplicate actually fired.
 void resetArcUsage()
          The arcUsage variable keeps track of how often the arcs are actually used during the parsing of a log by this individual.
 void resetDuplicatesActualFiring()
          The duplicatesActualFiring variable keeps track of the duplicate tasks that are actually fired during the parsing of a log.
 void resetFitness()
           
 boolean setArcUsage(cern.colt.matrix.DoubleMatrix2D newArcUsage)
           
 boolean setDuplicatesActualFiring(int[] newDuplicatesActualFiring)
           
 void setEndTask(int task)
           
 void setFitness(double d)
           
 boolean setInputSet(int index, HNSet sets)
           
 void setLogEvents(LogEvents newEvents)
          This method changes the LogEvents associated to the HeuristicsNet.
 boolean setOutputSet(int index, HNSet sets)
           
 void setStartTask(int task)
           
 int size()
           
 void toFile(java.io.OutputStream output)
           
protected  java.lang.String toInputDotName(java.lang.String s)
           
protected  java.lang.String toOutputDotName(java.lang.String s)
           
 java.lang.String toString()
           
 java.lang.String toStringWithEvents()
           
 void writeToDot(java.io.Writer bw)
           
 void writeToDotWithoutSplitJoinSemantics(java.io.Writer bw)
           
 void writeToDotWithSplitJoinSemantics(java.io.Writer bw)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

WME_HEADER

public static final java.lang.String WME_HEADER
See Also:
Constant Field Values

WME_NAME_DELIMITER

public static final char WME_NAME_DELIMITER
See Also:
Constant Field Values

INPUT_SETS_HEADER

public static final java.lang.String INPUT_SETS_HEADER
See Also:
Constant Field Values

OUTPUT_SETS_HEADER

public static final java.lang.String OUTPUT_SETS_HEADER
See Also:
Constant Field Values

EVENT_SEPARATOR

public static final java.lang.String EVENT_SEPARATOR
See Also:
Constant Field Values

EMPTY_SET

public static final java.lang.String EMPTY_SET
See Also:
Constant Field Values

AND_SEPARATOR

public static final java.lang.String AND_SEPARATOR
See Also:
Constant Field Values

OR_SEPARATOR

public static final java.lang.String OR_SEPARATOR
See Also:
Constant Field Values

SETS_SEPARATOR

public static final java.lang.String SETS_SEPARATOR
See Also:
Constant Field Values

FIELD_SEPARATOR

public static final java.lang.String FIELD_SEPARATOR
See Also:
Constant Field Values

FIRST_NET_LABEL

public static java.lang.String FIRST_NET_LABEL

SECOND_NET_LABEL

public static java.lang.String SECOND_NET_LABEL
Constructor Detail

HeuristicsNet

public HeuristicsNet(LogEvents events)
This method builds a net without duplicate tasks.

Parameters:
event - LogEvents event log.

HeuristicsNet

public HeuristicsNet(LogEvents events,
                     int[] duplicatesMapping,
                     HNSubSet[] reverseDuplicatesMapping)
This method builds a net that may contain duplicate tasks.

Parameters:
event - LogEvents event log.
duplicatesMapping - int[] The mapping from the tasks in the net to the code in the event log.
reverseDuplicatesMapping - HNSubSet[] The mapping from the codes in the log to the tasks in the net.
Method Detail

resetDuplicatesActualFiring

public void resetDuplicatesActualFiring()
The duplicatesActualFiring variable keeps track of the duplicate tasks that are actually fired during the parsing of a log. The duplicates that do not fire are not shown to the end user.


resetArcUsage

public void resetArcUsage()
The arcUsage variable keeps track of how often the arcs are actually used during the parsing of a log by this individual.


getDuplicatesActualFiring

public int[] getDuplicatesActualFiring()

getArcUsage

public cern.colt.matrix.DoubleMatrix2D getArcUsage()

setDuplicatesActualFiring

public boolean setDuplicatesActualFiring(int[] newDuplicatesActualFiring)

setArcUsage

public boolean setArcUsage(cern.colt.matrix.DoubleMatrix2D newArcUsage)

diffForSets

public java.lang.String diffForSets(HeuristicsNet netToCompare)

increaseElementActualFiring

public void increaseElementActualFiring(int element,
                                        int amount)
Add 'amount' to the counter of the number of times that a duplicate actually fired.


increaseArcUsage

public void increaseArcUsage(int element,
                             HNSubSet usedInputElements,
                             int amount)

getDuplicatesMapping

public int[] getDuplicatesMapping()

getReverseDuplicatesMapping

public HNSubSet[] getReverseDuplicatesMapping()

getStartTask

public int getStartTask()

getEndTask

public int getEndTask()

setStartTask

public void setStartTask(int task)

setEndTask

public void setEndTask(int task)

size

public int size()

resetFitness

public void resetFitness()

setFitness

public void setFitness(double d)

getLogEvents

public LogEvents getLogEvents()

setLogEvents

public void setLogEvents(LogEvents newEvents)
This method changes the LogEvents associated to the HeuristicsNet.

Parameters:
events - LogEvents new events to be associated to this net.

buildReverseDuplicatesMapping

public static HNSubSet[] buildReverseDuplicatesMapping(int[] duplicatesMapping)
Builds a reverse mapping to an array of duplicates mapping.

Parameters:
duplicatesMapping - int[] the array of int that contains the duplicates mapping.
Returns:
HNSubSet[] the reverse duplicates mapping.

getFitness

public double getFitness()

setInputSet

public boolean setInputSet(int index,
                           HNSet sets)

getInputSets

public HNSet[] getInputSets()

getOutputSets

public HNSet[] getOutputSets()

getInputSet

public HNSet getInputSet(int index)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringWithEvents

public java.lang.String toStringWithEvents()

toFile

public void toFile(java.io.OutputStream output)
            throws java.io.IOException
Throws:
java.io.IOException

setOutputSet

public boolean setOutputSet(int index,
                            HNSet sets)

getNumberOutputSet

public int getNumberOutputSet(int index)

getNumberInputSet

public int getNumberInputSet(int index)

getOutputSet

public HNSet getOutputSet(int index)

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

clone

protected java.lang.Object clone()
Deep cloning!

Overrides:
clone in class java.lang.Object

copyNet

public HeuristicsNet copyNet()
Deep copy from the net.


equals

public boolean equals(java.lang.Object anObject)
This method compares the input and output sets of two individuals.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getInputSetWithElement

public HNSubSet getInputSetWithElement(int index,
                                       int element)
Retrieves a subset from an INPUT set of "index". This subset contains "element".

Parameters:
index - workflow model element whose INPUT set must the searched.
element - element to find in the INPUT subsets.
Returns:
a TreeSet that contains 'element'. Otherwise, null.

getOutputSetWithElement

public HNSubSet getOutputSetWithElement(int index,
                                        int element)
Retrieves a subset from an OUTPUT set of "index". This subset contains "element".

Parameters:
index - workflow model element whose OUTPUT set must the searched.
element - element to find in the OUTPUT subsets.
Returns:
a TreeSet that contains 'element'. Otherwise, null.

getAllElementsInputSet

public HNSubSet getAllElementsInputSet(int index)
Returns the union set of all int in the subset of the input set at " index".


getAllElementsOutputSet

public HNSubSet getAllElementsOutputSet(int index)
Returns the union set of all int in the subset of the output set at " index".


getInputSetsWithElement

public HNSet getInputSetsWithElement(int index,
                                     int element)
Retrieves subsets from an INPUT set of "index". These subsets contain "element".

Parameters:
index - workflow model element whose INPUT set must the searched.
element - element to find in the INPUT subsets.
Returns:
a HashSet with the subsets that contain 'element'. Otherwise, null.

getOutputSetsWithElement

public HNSet getOutputSetsWithElement(int index,
                                      int element)
Retrieves subsets from an OUTPUT set of "index". These subsets contain "element".

Parameters:
index - workflow model element whose OUTPUT set must the searched.
element - element to find in the OUTPUT subsets.
Returns:
a HashSet with the subsets that contain 'element'. Otherwise, null.

getElements

public static final int[] getElements(HNSet set)

writeToDot

public void writeToDot(java.io.Writer bw)
                throws java.io.IOException
Specified by:
writeToDot in interface DotFileWriter
Throws:
java.io.IOException

writeToDotWithoutSplitJoinSemantics

public void writeToDotWithoutSplitJoinSemantics(java.io.Writer bw)
                                         throws java.io.IOException
Throws:
java.io.IOException

writeToDotWithSplitJoinSemantics

public void writeToDotWithSplitJoinSemantics(java.io.Writer bw)
                                      throws java.io.IOException
Throws:
java.io.IOException

toInputDotName

protected java.lang.String toInputDotName(java.lang.String s)

toOutputDotName

protected java.lang.String toOutputDotName(java.lang.String s)

disconnectArcsUsedBelowThreshold

public void disconnectArcsUsedBelowThreshold(double threshold)

disconnectUnusedElements

public void disconnectUnusedElements()
This method builds a phenotype that disconnect the tasks and arcs that are not used during the parsing of an event log.

NOTE: This method should be used with care because at the starting of a parsing, no elements (tasks) have been used.


getGrappaVisualization

public ModelGraphPanel getGrappaVisualization()

getGrappaVisualizationWithSplitJoinSemantics

public ModelGraphPanel getGrappaVisualizationWithSplitJoinSemantics()