public void AddEventualFollower(InductiveMinerGraphNode node)
 {
     if (!GetMyEventualNodes().Contains(node))
     {
         EventualFollowerList.Add(new InductiveMinerRow(this, node));
     }
 }
示例#2
0
        /// <summary>
        /// Recursive procedure to identify sequence cuts.
        /// </summary>
        /// <param name="graphNode">Analyzed node</param>
        /// <author>Krystian Zielonka, Bernd Nottbeck</author>
        private HashSet <InductiveMinerRow> SequenceCutHelper(InductiveMinerGraphNode graphNode)
        {
            HashSet <InductiveMinerRow> sequenceList = new HashSet <InductiveMinerRow>();

            if (!visitedNodes.Contains(graphNode))
            {
                visitedNodes.Add(graphNode);

                List <InductiveMinerRow> followerList = graphNode.FollowerList;

                foreach (InductiveMinerRow row in followerList)
                {
                    var query = from SearchRow in row.ToNode.EventualFollowerList
                                where SearchRow.ToNode == row.FromNode
                                select SearchRow;

                    InductiveMinerRow currentRow = query.FirstOrDefault();

                    if (currentRow == null && !graphNode.Name.Equals(startEvent) && !graphNode.Name.Equals(newStart))
                    {
                        sequenceList.Add(row);
                    }

                    sequenceList.UnionWith(SequenceCutHelper(row.ToNode));
                }
            }

            return(sequenceList);
        }
示例#3
0
        /// <summary>
        /// Executes the last cut in a loop
        /// </summary>
        /// <param name="LoopStart">Loop start node</param>
        /// <param name="currentNode">Analysed node</param>
        /// <returns>true if cut was made</returns>
        private bool executeLastCutInLoop(InductiveMinerGraphNode LoopStart, InductiveMinerGraphNode currentNode)
        {
            if (currentNode.FollowerList.Count > 0)
            {
                if (currentNode.GetMyDirectNodes().Contains(LoopStart))
                {
                    var query = from search in currentNode.FollowerList
                                where search.ToNode == LoopStart
                                select search;

                    InductiveMinerRow deleteRow = query.FirstOrDefault();
                    currentNode.FollowerList.Remove(deleteRow);

                    return(true);
                }
                else
                {
                    foreach (InductiveMinerRow row in currentNode.FollowerList)
                    {
                        if (executeLastCutInLoop(LoopStart, row.ToNode))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
 public void AddDirectFollower(InductiveMinerGraphNode node)
 {
     if (!GetMyDirectNodes().Contains(node))
     {
         FollowerList.Add(new InductiveMinerRow(this, node));
     }
 }
 public void AddEventualFollower(InductiveMinerGraphNode node)
 {
     if (!GetMyEventualNodes().Contains(node))
     {
         EventualFollowerList.Add(new InductiveMinerRow(this, node));
     }
 }
 public void AddDirectFollower(InductiveMinerGraphNode node)
 {
     if (!GetMyDirectNodes().Contains(node))
     {
         FollowerList.Add(new InductiveMinerRow(this, node));
     }
 }
        public InductiveMinerRow GetRowWithFollower(InductiveMinerGraphNode node)
        {
            var query = from row in FollowerList
                        where row.ToNode == node
                        select row;

            return(query.FirstOrDefault());
        }
示例#8
0
        /// <summary>
        /// Recursive procedure to identify loop cuts
        /// </summary>
        /// <param name="graphNode">Analyzed node</param>
        /// <author>Krystian Zielonka, Bernd Nottbeck</author>
        private bool CheckLoopCut(InductiveMinerGraphNode graphNode)
        {
            bool foundSth = false;

            if (!visitedLoopCheckNodes.Contains(graphNode))
            {
                visitedLoopCheckNodes.Add(graphNode);

                List <InductiveMinerRow> followerList = graphNode.FollowerList;

                foreach (InductiveMinerRow row in followerList)
                {
                    var query = from SearchRow in row.ToNode.EventualFollowerList
                                where SearchRow.ToNode == row.FromNode
                                select SearchRow;

                    InductiveMinerRow currentRow = query.FirstOrDefault();
                    bool and = false;
                    if (currentRow != null)
                    {
                        foreach (InductiveMinerGraphNode andCheckNode in currentRow.FromNode.GetMyDirectNodes())
                        {
                            if (andCheckNode.GetMyDirectNodes().Contains(currentRow.FromNode))
                            {
                                and = true;
                            }
                        }
                    }

                    if (currentRow != null && !and)
                    {
                        foundSth = true;

                        bool cutFound = executeLastCutInLoop(row.FromNode, row.ToNode);

                        if (cutFound)
                        {
                            executeFirstCutInLoop(row.FromNode, row.ToNode);

                            return(true);
                        }
                    }
                    if (foundSth)
                    {
                    }
                    else
                    {
                        if (CheckLoopCut(row.ToNode))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(foundSth);
        }
示例#9
0
        /// <summary>
        /// Test print method
        /// </summary>
        /// <param name="graphNode"></param>
        public void TestTheTree(InductiveMinerGraphNode graphNode)
        {
            if (!visitedNodes.Contains(graphNode))
            {
                visitedNodes.Add(graphNode);
                List <InductiveMinerRow> followerList = graphNode.FollowerList;

                foreach (InductiveMinerRow row in followerList)
                {
                    Console.WriteLine(row.FromNode.Name + " -> " + row.ToNode.Name);
                    TestTheTree(row.ToNode);
                }
            }
        }
 /// <summary>
 /// Constructor for a tree node´used duringt the cutting process.
 /// </summary>
 /// <param name="petriNet"></param>
 /// <param name="graphNode"></param>
 /// <param name="startEvent"></param>
 public InductiveMinerTreeNode(PetriNet petriNet, InductiveMinerGraphNode graphNode, Event startEvent)
 {
     GraphNode = graphNode;
     Operation = GraphNode.FollowerList.Count == 0 ? OperationsEnum.isLeaf : OperationsEnum.isUnkown;
     Event = GraphNode.Name;
     LeftLeaf = null;
     RightLeaf = null;
     this.startEvent = startEvent;
     visitedNodes = new HashSet<InductiveMinerGraphNode>();
     visitedLoopCheckNodes = new HashSet<InductiveMinerGraphNode>();
     this.petriNet = petriNet;
     newStart = new InductiveMinerGraphNode(new Event("NewStart"));
     DivideAndConquer();
 }
示例#11
0
 /// <summary>
 /// Constructor for a tree node´used duringt the cutting process.
 /// </summary>
 /// <param name="petriNet"></param>
 /// <param name="graphNode"></param>
 /// <param name="startEvent"></param>
 public InductiveMinerTreeNode(PetriNet petriNet, InductiveMinerGraphNode graphNode, Event startEvent)
 {
     GraphNode             = graphNode;
     Operation             = GraphNode.FollowerList.Count == 0 ? OperationsEnum.isLeaf : OperationsEnum.isUnkown;
     Event                 = GraphNode.Name;
     LeftLeaf              = null;
     RightLeaf             = null;
     this.startEvent       = startEvent;
     visitedNodes          = new HashSet <InductiveMinerGraphNode>();
     visitedLoopCheckNodes = new HashSet <InductiveMinerGraphNode>();
     this.petriNet         = petriNet;
     newStart              = new InductiveMinerGraphNode(new Event("NewStart"));
     DivideAndConquer();
 }
示例#12
0
        /// <summary>
        /// Identifies parallels in the graph
        /// </summary>
        /// <param name="graphNode">Analyzed node</param>
        /// <author>Krystian Zielonka, Thomas Meents, Bernd Nottbeck</author>
        private bool CheckAndCut(InductiveMinerGraphNode graphNode)
        {
            bool wasSplit = false;

            if (graphNode.FollowerList.Count > 1)
            {
                List <InductiveMinerRow> followerList = graphNode.FollowerList;
                List <InductiveMinerRow> deleteList   = new List <InductiveMinerRow>();

                foreach (InductiveMinerRow row in followerList)
                {
                    InductiveMinerRow currentRow = row.ToNode.FollowerList.FirstOrDefault();

                    if (currentRow.ToNode.GetMyDirectNodes().Contains(currentRow.FromNode))
                    {
                        deleteList.Add(currentRow);
                    }
                }

                wasSplit = deleteList.Any();

                if (wasSplit)
                {
                    foreach (InductiveMinerRow row in deleteList)
                    {
                        row.FromNode.DeleteFollower(row);
                    }

                    InductiveMinerRow lastRow = deleteList.Last();
                    newStart.AddDirectFollower(lastRow.FromNode);
                    newStart.AddEventualFollower(lastRow.FromNode);
                    graphNode.DeleteFollower(graphNode.GetRowWithFollower(lastRow.FromNode));

                    graphNode.ReBuildeEventualFollower(null);
                    graphNode.CleanUpHelperList(null);
                }
            }

            return(wasSplit);
        }
示例#13
0
        /// <summary>
        /// Executes the first cut for a loop
        /// </summary>
        /// <param name="LoopStart">Loop start</param>
        /// <param name="currentNode">current node</param>
        /// <returns>True if cut was made</returns>
        private bool executeFirstCutInLoop(InductiveMinerGraphNode LoopStart, InductiveMinerGraphNode currentNode)
        {
            Boolean bo = false;

            if (currentNode.WasCut)
            {
                foreach (InductiveMinerRow row in currentNode.FollowerList)
                {
                    if (row.ToNode.GetMyEventualNodes().Contains(LoopStart))
                    {
                        newStart.AddDirectFollower(row.ToNode);
                        foreach (InductiveMinerGraphNode eventuallyRow in row.ToNode.GetMyEventualNodes())
                        {
                            if (!newStart.GetMyEventualNodes().Contains(eventuallyRow))
                            {
                                newStart.EventualFollowerList.Add(new InductiveMinerRow(newStart, eventuallyRow));
                            }
                        }
                        currentNode.FollowerList.Remove(row);
                        return(true);
                    }
                }
                bo = true;
            }
            else
            {
                foreach (InductiveMinerRow row in currentNode.EventualFollowerList)
                {
                    if (row.ToNode.GetMyEventualNodes().Contains(LoopStart))
                    {
                        executeFirstCutInLoop(LoopStart, row.ToNode);
                    }
                }
            }
            return(bo);
        }
        /// <summary>
        /// Executes the first cut for a loop
        /// </summary>
        /// <param name="LoopStart">Loop start</param>
        /// <param name="currentNode">current node</param>
        /// <returns>True if cut was made</returns>
        private bool executeFirstCutInLoop(InductiveMinerGraphNode LoopStart, InductiveMinerGraphNode currentNode)
        {
            Boolean bo = false;
            if (currentNode.WasCut)
            {

                foreach (InductiveMinerRow row in currentNode.FollowerList)
                {
                    if (row.ToNode.GetMyEventualNodes().Contains(LoopStart))
                    {
                        newStart.AddDirectFollower(row.ToNode);
                        foreach (InductiveMinerGraphNode eventuallyRow in row.ToNode.GetMyEventualNodes())
                        {
                            if (!newStart.GetMyEventualNodes().Contains(eventuallyRow))
                            {
                                newStart.EventualFollowerList.Add(new InductiveMinerRow(newStart, eventuallyRow));
                            }
                        }
                        currentNode.FollowerList.Remove(row);
                        return true;
                    }
                }
                bo = true;
            }
            else
            {
                foreach (InductiveMinerRow row in currentNode.EventualFollowerList)
                {
                    if (row.ToNode.GetMyEventualNodes().Contains(LoopStart))
                    {
                        executeFirstCutInLoop(LoopStart, row.ToNode);
                    }
                }
            }
            return bo;
        }
        /// <summary>
        /// Test print method
        /// </summary>
        /// <param name="graphNode"></param>
        public void TestTheTree(InductiveMinerGraphNode graphNode)
        {
            if (!visitedNodes.Contains(graphNode))
            {
                visitedNodes.Add(graphNode);
                List<InductiveMinerRow> followerList = graphNode.FollowerList;

                foreach (InductiveMinerRow row in followerList)
                {
                    Console.WriteLine(row.FromNode.Name + " -> " + row.ToNode.Name);
                    TestTheTree(row.ToNode);
                }
            }
        }
        /// <summary>
        /// Identifies parallels in the graph
        /// </summary>
        /// <param name="graphNode">Analyzed node</param>
        /// <author>Krystian Zielonka, Thomas Meents, Bernd Nottbeck</author>
        private bool CheckAndCut(InductiveMinerGraphNode graphNode)
        {
            bool wasSplit = false;

            if (graphNode.FollowerList.Count > 1)
            {
                List<InductiveMinerRow> followerList = graphNode.FollowerList;
                List<InductiveMinerRow> deleteList = new List<InductiveMinerRow>();

                foreach (InductiveMinerRow row in followerList)
                {
                    InductiveMinerRow currentRow = row.ToNode.FollowerList.FirstOrDefault();

                    if (currentRow.ToNode.GetMyDirectNodes().Contains(currentRow.FromNode))
                    {
                        deleteList.Add(currentRow);
                    }
                }

                wasSplit = deleteList.Any();

                if (wasSplit)
                {
                    foreach (InductiveMinerRow row in deleteList)
                    {
                        row.FromNode.DeleteFollower(row);
                    }

                    InductiveMinerRow lastRow = deleteList.Last();
                    newStart.AddDirectFollower(lastRow.FromNode);
                    newStart.AddEventualFollower(lastRow.FromNode);
                    graphNode.DeleteFollower(graphNode.GetRowWithFollower(lastRow.FromNode));

                    graphNode.ReBuildeEventualFollower(null);
                    graphNode.CleanUpHelperList(null);
                }
            }

            return wasSplit;
        }
示例#17
0
        /// <summary>
        /// Recursive procedure to identify sequence cuts
        /// </summary>
        /// <param name="graphNode">Analyzed node</param>
        /// <author>Krystian Zielonka, Bernd Nottbeck</author>
        private bool CheckXorCut(InductiveMinerGraphNode graphNode)
        {
            List <InductiveMinerGraphNode> followerList = graphNode.GetMyDirectNodes();
            List <InductiveMinerRow>       deleteList   = new List <InductiveMinerRow>();

            bool bo       = false;
            bool foundone = false;
            bool goOn     = true;

            if (graphNode.FollowerList.Count > 1)
            {
                List <InductiveMinerRow> .Enumerator e = graphNode.FollowerList.GetEnumerator();
                e.MoveNext();

                do
                {
                    if (!e.Current.ToNode.FollowerContains(followerList))
                    {
                        if (foundone)
                        {
                            goOn = false;
                            deleteList.Add(e.Current);
                        }
                        foundone = true;
                    }

                    if (goOn)
                    {
                        goOn = e.MoveNext();
                    }
                } while (goOn);
                e.Dispose();

                foreach (InductiveMinerRow deleteRow in deleteList)
                {
                    newStart.AddDirectFollower(deleteRow.ToNode);

                    foreach (InductiveMinerRow row in deleteRow.ToNode.EventualFollowerList)
                    {
                        if (!newStart.GetMyEventualNodes().Contains(row.ToNode))
                        {
                            newStart.EventualFollowerList.Add(new InductiveMinerRow(newStart, row.ToNode));
                        }
                    }

                    graphNode.WasCut = true;
                    graphNode.DeleteFollower(deleteRow);


                    bo = true;
                }

                if (bo)
                {
                    newStart.ReBuildeEventualFollower(null);
                    newStart.CleanUpHelperList(null);


                    graphNode.ReBuildeEventualFollower(null);
                    graphNode.CleanUpHelperList(null);
                }
                return(bo);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// Recursive procedure to identify loop cuts
        /// </summary>
        /// <param name="graphNode">Analyzed node</param>
        /// <author>Krystian Zielonka, Bernd Nottbeck</author>
        private bool CheckLoopCut(InductiveMinerGraphNode graphNode)
        {
            bool foundSth = false;

            if (!visitedLoopCheckNodes.Contains(graphNode))
            {
                visitedLoopCheckNodes.Add(graphNode);

                List<InductiveMinerRow> followerList = graphNode.FollowerList;

                foreach (InductiveMinerRow row in followerList)
                {
                    var query = from SearchRow in row.ToNode.EventualFollowerList
                                where SearchRow.ToNode == row.FromNode
                                select SearchRow;

                    InductiveMinerRow currentRow = query.FirstOrDefault();
                    bool and = false;
                    if (currentRow != null)
                    {
                        foreach (InductiveMinerGraphNode andCheckNode in currentRow.FromNode.GetMyDirectNodes())
                        {
                            if (andCheckNode.GetMyDirectNodes().Contains(currentRow.FromNode)) and = true;
                        }

                    }

                    if (currentRow != null && !and)
                    {
                        foundSth = true;

                        bool cutFound = executeLastCutInLoop(row.FromNode, row.ToNode);

                        if (cutFound)
                        {
                            executeFirstCutInLoop(row.FromNode, row.ToNode);

                            return true;
                        }
                    }
                    if (foundSth) { }
                    else
                    {
                        if (CheckLoopCut(row.ToNode)) return true;
                    }
                }
            }

            return foundSth;
        }
        /// <summary>
        /// Recursive procedure to identify sequence cuts 
        /// </summary>
        /// <param name="graphNode">Analyzed node</param>
        /// <author>Krystian Zielonka, Bernd Nottbeck</author>
        private bool CheckXorCut(InductiveMinerGraphNode graphNode)
        {
            List<InductiveMinerGraphNode> followerList = graphNode.GetMyDirectNodes();
            List<InductiveMinerRow> deleteList = new List<InductiveMinerRow>();

            bool bo = false;
            bool foundone = false;
            bool goOn = true;
            if (graphNode.FollowerList.Count > 1)
            {
                List<InductiveMinerRow>.Enumerator e = graphNode.FollowerList.GetEnumerator();
                e.MoveNext();

                do
                {
                    if (!e.Current.ToNode.FollowerContains(followerList))
                    {
                        if (foundone)
                        {
                            goOn = false;
                            deleteList.Add(e.Current);
                        }
                        foundone = true;
                    }

                    if (goOn)
                    {
                        goOn = e.MoveNext();
                    }

                } while (goOn);
                e.Dispose();

                foreach (InductiveMinerRow deleteRow in deleteList)
                {
                    newStart.AddDirectFollower(deleteRow.ToNode);

                    foreach (InductiveMinerRow row in deleteRow.ToNode.EventualFollowerList)
                    {
                        if (!newStart.GetMyEventualNodes().Contains(row.ToNode))
                            newStart.EventualFollowerList.Add(new InductiveMinerRow(newStart, row.ToNode));

                    }

                    graphNode.WasCut = true;
                    graphNode.DeleteFollower(deleteRow);

                    bo = true;
                }

                if (bo)
                {
                    newStart.ReBuildeEventualFollower(null);
                    newStart.CleanUpHelperList(null);

                    graphNode.ReBuildeEventualFollower(null);
                    graphNode.CleanUpHelperList(null);
                }
                return bo;
            }
            else return false;
        }
        /// <summary>
        /// Recursive procedure to identify sequence cuts.
        /// </summary>
        /// <param name="graphNode">Analyzed node</param>
        /// <author>Krystian Zielonka, Bernd Nottbeck</author>
        private HashSet<InductiveMinerRow> SequenceCutHelper(InductiveMinerGraphNode graphNode)
        {
            HashSet<InductiveMinerRow> sequenceList = new HashSet<InductiveMinerRow>();

            if (!visitedNodes.Contains(graphNode))
            {
                visitedNodes.Add(graphNode);

                List<InductiveMinerRow> followerList = graphNode.FollowerList;

                foreach (InductiveMinerRow row in followerList)
                {
                    var query = from SearchRow in row.ToNode.EventualFollowerList
                                where SearchRow.ToNode == row.FromNode
                                select SearchRow;

                    InductiveMinerRow currentRow = query.FirstOrDefault();

                    if (currentRow == null && !graphNode.Name.Equals(startEvent) && !graphNode.Name.Equals(newStart))
                    {
                        sequenceList.Add(row);
                    }

                    sequenceList.UnionWith(SequenceCutHelper(row.ToNode));
                }
            }

            return sequenceList;
        }
        /// <summary>
        /// Executes the last cut in a loop
        /// </summary>
        /// <param name="LoopStart">Loop start node</param>
        /// <param name="currentNode">Analysed node</param>
        /// <returns>true if cut was made</returns>
        private bool executeLastCutInLoop(InductiveMinerGraphNode LoopStart, InductiveMinerGraphNode currentNode)
        {
            if (currentNode.FollowerList.Count > 0)
            {
                if (currentNode.GetMyDirectNodes().Contains(LoopStart))
                {
                    var query = from search in currentNode.FollowerList
                                where search.ToNode == LoopStart
                                select search;

                    InductiveMinerRow deleteRow = query.FirstOrDefault();
                    currentNode.FollowerList.Remove(deleteRow);

                    return true;
                }
                else
                {
                    foreach (InductiveMinerRow row in currentNode.FollowerList)
                    {
                        if (executeLastCutInLoop(LoopStart, row.ToNode))
                        {
                            return true;
                        }
                    }
                }
            }
            return false;
        }
        public InductiveMinerRow GetRowWithFollower(InductiveMinerGraphNode node)
        {
            var query = from row in FollowerList
                        where row.ToNode == node
                        select row;

            return query.FirstOrDefault();
        }