/// <summary>
        /// Finds the Transition with the given name and adds a loop to it. This also handles looping transitions right after multiple places (AND-join) or right before multiple places (AND-split)
        /// </summary>
        /// <param name="transitionName">The name of the transition the is looped</param>
        /// <param name="transition"></param>
        public void AddLoop(String transitionName = "", Transition transition = null)
        {
            Transition item = transition ?? FindTransition(transitionName);

            // if the activity is in the eventlog but NOT in the net
            if (item == null)
            {
                return;
            }

            Transition loop = AddTransition("(Loop)", isLoop: true);

            // before the Transition
            if (item.IncomingPlaces.Count == 1)
            {
                loop.AddOutgoingPlace(item.IncomingPlaces[0]);
            }
            else
            {
                Place      newPlace      = AddPlace();
                Transition newTransition = AddTransition();

                // redirect incoming connections
                newTransition.AddIncomingPlaces(item.IncomingPlaces);
                foreach (Place place in item.IncomingPlaces)
                {
                    place.OutgoingTransitions.Remove(item);
                }
                item.IncomingPlaces.Clear();
                // add new connections
                loop.AddOutgoingPlace(newPlace);
                newTransition.AddOutgoingPlace(newPlace);
                item.AddIncomingPlace(newPlace);
            }

            // after the Transition
            if (item.OutgoingPlaces.Count == 1)
            {
                loop.AddIncomingPlace(item.OutgoingPlaces[0]);
            }
            else
            {
                Place      newPlace      = AddPlace();
                Transition newTransition = AddTransition();

                // redirect outgoing connections
                newTransition.AddOutgoingPlaces(item.OutgoingPlaces);
                foreach (Place place in item.OutgoingPlaces)
                {
                    place.IncomingTransitions.Remove(item);
                }
                item.OutgoingPlaces.Clear();
                // add new connections
                item.AddOutgoingPlace(newPlace);
                loop.AddIncomingPlace(newPlace);
                newTransition.AddIncomingPlace(newPlace);
            }
        }
        /// <summary>
        /// Adds a place and connects the open transitions to it. Then puts the given transition behind that whole thing.
        /// </summary>
        /// <param name="startingTransition">The starting transition</param>
        /// <param name="petriNet">The current petri net</param>
        /// <param name="endingTransition">The ending transition, if it exists already. Otherwise a new one is created.</param>
        /// <returns>The empty transition after the place that combines to XOR.</returns>
        /// <author>Jannik Arndt</author>
        public List<Transition> EndXOR(List<Transition> startingTransition, PetriNet petriNet, Transition endingTransition = null)
        {
            if (endingTransition == null)
                endingTransition = petriNet.AddTransition();

            if (_openParallelismCount.Count > 0)
                _openParallelismCount.Pop();

            var newPlace = petriNet.AddPlace();
            foreach (var transition in startingTransition)
                transition.AddOutgoingPlace(newPlace);
            endingTransition.AddIncomingPlace(newPlace);
            return new List<Transition> { endingTransition };
        }
        /// <summary>
        /// Recursively moves threw the tree and generates the IMPetrinet
        /// </summary>
        /// <param name="node">actual node</param>
        /// <param name="relayedPlace">Place that the process operator get</param>
        /// <param name="relayedOutgoingPlace">optional place that will be overwrite the outgoingplace</param>
        /// <param name="relayedIncomingPlace">optional place that will be overwrite the incomingplace</param>
        /// <author>Thomas Meents, Bernd Nottbeck</author>
        private Place TraverseTreePetrinet(InductiveMinerTreeNode node, Place relayedPlace, Place relayedOutgoingPlace = null, Place relayedIncomingPlace = null)
        {
            if (node.Operation.Equals(OperationsEnum.isLeaf))
            {
                return DrawLeafPetrinet(node, relayedPlace, overwriteIncomingPlace: relayedIncomingPlace, overwriteOutgoingPlace: relayedOutgoingPlace);
            }

            if (node.Operation.Equals(OperationsEnum.isSequence))
            {
                if (node.LeftLeaf != null)
                {
                    Place temp = TraverseTreePetrinet(node.LeftLeaf, relayedPlace);
                    if (node.RightLeaf != null)
                        temp = TraverseTreePetrinet(node.RightLeaf, temp);
                    return temp;
                }
            }
            else if (node.Operation.Equals(OperationsEnum.isXOR))
            {
                if (node.LeftLeaf != null)
                {
                    Place tempXORExitPlace = TraverseTreePetrinet(node.LeftLeaf, relayedPlace);

                    if (node.RightLeaf == null)
                        return null;

                    Place newPlace = TraverseTreePetrinet(node.RightLeaf, tempXORExitPlace, relayedIncomingPlace: relayedPlace, relayedOutgoingPlace: tempXORExitPlace);

                        if (tempXORExitPlace != null)
                        return tempXORExitPlace;
                    return newPlace;
                }
            }
            else if (node.Operation.Equals(OperationsEnum.isLoop))
            {
                Place tempLoopEntrancePlace = relayedPlace;

                if (node.LeftLeaf != null)
                {
                    Place temp = TraverseTreePetrinet(node.LeftLeaf, relayedPlace);

                    Place tempLoopExitPlace = temp;

                    if (node.RightLeaf != null)
                    {
                        //prevents a Nullpointer-Exception if the first Place is a Loop.
                        if (tempLoopEntrancePlace != IMPetriNet.Places[0])
                        {
                            temp = TraverseTreePetrinet(node.RightLeaf, temp);
                            IMPetriNet.AddTransition("Loop", incomingPlace: temp, outgoingPlace: tempLoopEntrancePlace,
                                isLoop: true);
                        }
                        else
                        {
                            temp = TraverseTreePetrinet(node.RightLeaf, temp, relayedOutgoingPlace: tempLoopEntrancePlace);
                            if (tempLoopExitPlace != null)
                                temp = tempLoopExitPlace;
                        }
                    }
                    return temp;
                }
            }
            else if (node.Operation.Equals(OperationsEnum.isParallel))
            {
                Transition ANDSplit = new Transition("AND-Split");
                ANDSplit.AddIncomingPlace(relayedPlace);
                IMPetriNet.Transitions.Add(ANDSplit);

                Place NewPlaceLeft = new Place();
                Place NewPlaceRight = new Place();

                IMPetriNet.Places.Add(NewPlaceLeft);
                IMPetriNet.Places.Add(NewPlaceRight);

                ANDSplit.AddOutgoingPlace(NewPlaceLeft);
                ANDSplit.AddOutgoingPlace(NewPlaceRight);

                Transition ANDJoin = new Transition("AND-Join");
                Place AndJoinOutgoingPlace = new Place();
                ANDJoin.AddOutgoingPlace(AndJoinOutgoingPlace);
                IMPetriNet.Places.Add(AndJoinOutgoingPlace);
                IMPetriNet.Transitions.Add(ANDJoin);

                if (node.LeftLeaf != null)
                {
                    Place temp = TraverseTreePetrinet(node.LeftLeaf, relayedPlace, relayedIncomingPlace: NewPlaceLeft);
                    ANDJoin.AddIncomingPlace(temp);

                    if (node.RightLeaf != null)
                    {
                        temp = TraverseTreePetrinet(node.RightLeaf, NewPlaceRight);
                        ANDJoin.AddIncomingPlace(temp);
                    }
                    return AndJoinOutgoingPlace;
                }
            }
            else
            {
                throw new Exception("Something in the process tree is wrong.");
            }

            return relayedPlace;
        }
        /// <summary>
        /// Draws the transition with the incoming and outgoing places.
        /// </summary>
        /// <param name="node">Node that will be drawn</param>
        /// <param name="relayed">Relayed place. It will be the incoming place of the transition</param>
        /// <param name="overwriteOutgoingPlace">optional place that will be overwrite the outgoingplace</param>
        /// <param name="overwriteIncomingPlace">optional place that will be overwrite the Incomingplace</param>
        /// <returns>Outgoing Place of the drawn Transition</returns>
        /// <author>Thomas Meents</author>
        private Place DrawLeafPetrinet(InductiveMinerTreeNode node, Place relayed, Place overwriteOutgoingPlace = null, Place overwriteIncomingPlace = null)
        {
            if (!node.Operation.Equals(OperationsEnum.isLeaf))
                throw new Exception("Only leafs can be drawn.");

            Place outgoing = new Place();
            IMPetriNet.Places.Add(outgoing);

            if (overwriteIncomingPlace != null)
                relayed = overwriteIncomingPlace;

            Transition transition = new Transition(node.Event.Name) { IsDrawn = false };
            transition.AddIncomingPlace(relayed);
            transition.AddOutgoingPlace(outgoing);
            if (overwriteOutgoingPlace != null)
            {
                transition.OutgoingPlaces.Remove(outgoing);
                transition.OutgoingPlaces.Add(overwriteOutgoingPlace);
            }
            IMPetriNet.Transitions.Add(transition);

            return outgoing;
        }
        public void CompareEventLogAndPetriNetTest1()
        {
            //
            //EventLog
            //
            //create Case1
            Case ca1 = new Case();
            ca1.CreateEvent("A");
            ca1.CreateEvent("C");
            ca1.CreateEvent("D");
            ca1.CreateEvent("E");
            ca1.CreateEvent("H");

            //create Case2
            Case ca2 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("B");
            ca2.CreateEvent("D");
            ca2.CreateEvent("E");
            ca2.CreateEvent("G");

            //create Case3
            Case ca3 = new Case();
            ca3.CreateEvent("A");
            ca3.CreateEvent("D");
            ca3.CreateEvent("C");
            ca3.CreateEvent("E");
            ca3.CreateEvent("H");

            //create Case4
            Case ca4 = new Case();
            ca4.CreateEvent("A");
            ca4.CreateEvent("B");
            ca4.CreateEvent("D");
            ca4.CreateEvent("E");
            ca4.CreateEvent("H");

            //create Case5
            Case ca5 = new Case();
            ca5.CreateEvent("A");
            ca5.CreateEvent("C");
            ca5.CreateEvent("D");
            ca5.CreateEvent("E");
            ca5.CreateEvent("G");

            //create Case6
            Case ca6 = new Case();
            ca6.CreateEvent("A");
            ca6.CreateEvent("D");
            ca6.CreateEvent("C");
            ca6.CreateEvent("E");
            ca6.CreateEvent("G");

            //create Case7
            Case ca7 = new Case();
            ca7.CreateEvent("A");
            ca7.CreateEvent("D");
            ca7.CreateEvent("B");
            ca7.CreateEvent("E");
            ca7.CreateEvent("H");

            //create Case8
            Case ca8 = new Case();
            ca8.CreateEvent("A");
            ca8.CreateEvent("C");
            ca8.CreateEvent("D");
            ca8.CreateEvent("E");
            ca8.CreateEvent("F");
            ca8.CreateEvent("D");
            ca8.CreateEvent("B");
            ca8.CreateEvent("E");
            ca8.CreateEvent("H");

            //create Case9
            Case ca9 = new Case();
            ca9.CreateEvent("A");
            ca9.CreateEvent("D");
            ca9.CreateEvent("B");
            ca9.CreateEvent("E");
            ca9.CreateEvent("G");

            //create Case10
            Case ca10 = new Case();
            ca10.CreateEvent("A");
            ca10.CreateEvent("C");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("F");
            ca10.CreateEvent("B");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("H");

            //create Case11
            Case ca11 = new Case();
            ca11.CreateEvent("A");
            ca11.CreateEvent("C");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("F");
            ca11.CreateEvent("B");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("G");

            //create Case12
            Case ca12 = new Case();
            ca12.CreateEvent("A");
            ca12.CreateEvent("C");
            ca12.CreateEvent("D");
            ca12.CreateEvent("E");
            ca12.CreateEvent("F");
            ca12.CreateEvent("D");
            ca12.CreateEvent("B");
            ca12.CreateEvent("E");
            ca12.CreateEvent("G");

            //create Case13
            Case ca13 = new Case();
            ca13.CreateEvent("A");
            ca13.CreateEvent("D");
            ca13.CreateEvent("C");
            ca13.CreateEvent("E");
            ca13.CreateEvent("F");
            ca13.CreateEvent("C");
            ca13.CreateEvent("D");
            ca13.CreateEvent("E");
            ca13.CreateEvent("H");

            //create Case14
            Case ca14 = new Case();
            ca14.CreateEvent("A");
            ca14.CreateEvent("D");
            ca14.CreateEvent("C");
            ca14.CreateEvent("E");
            ca14.CreateEvent("F");
            ca14.CreateEvent("D");
            ca14.CreateEvent("B");
            ca14.CreateEvent("E");
            ca14.CreateEvent("H");

            //create Case15
            Case ca15 = new Case();
            ca15.CreateEvent("A");
            ca15.CreateEvent("D");
            ca15.CreateEvent("C");
            ca15.CreateEvent("E");
            ca15.CreateEvent("F");
            ca15.CreateEvent("B");
            ca15.CreateEvent("D");
            ca15.CreateEvent("E");
            ca15.CreateEvent("G");

            //create Case16
            Case ca16 = new Case();
            ca16.CreateEvent("A");
            ca16.CreateEvent("C");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("B");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("D");
            ca16.CreateEvent("B");
            ca16.CreateEvent("E");
            ca16.CreateEvent("G");

            //create Case17
            Case ca17 = new Case();
            ca17.CreateEvent("A");
            ca17.CreateEvent("D");
            ca17.CreateEvent("C");
            ca17.CreateEvent("E");
            ca17.CreateEvent("F");
            ca17.CreateEvent("D");
            ca17.CreateEvent("B");
            ca17.CreateEvent("E");
            ca17.CreateEvent("G");

            //create Case18
            Case ca18 = new Case();
            ca18.CreateEvent("A");
            ca18.CreateEvent("D");
            ca18.CreateEvent("C");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("G");

            //create Case19
            Case ca19 = new Case();
            ca19.CreateEvent("A");
            ca19.CreateEvent("D");
            ca19.CreateEvent("C");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("D");
            ca19.CreateEvent("B");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("B");
            ca19.CreateEvent("D");
            ca19.CreateEvent("E");
            ca19.CreateEvent("H");

            //create Case20
            Case ca20 = new Case();
            ca20.CreateEvent("A");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("B");
            ca20.CreateEvent("D");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("G");

            //create Case21
            Case ca21 = new Case();
            ca21.CreateEvent("A");
            ca21.CreateEvent("D");
            ca21.CreateEvent("C");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("C");
            ca21.CreateEvent("D");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("G");

            //create Event Log
            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca1);
            eventLog.Cases.Add(ca2);
            eventLog.Cases.Add(ca3);
            eventLog.Cases.Add(ca4);
            eventLog.Cases.Add(ca5);
            eventLog.Cases.Add(ca6);
            eventLog.Cases.Add(ca7);
            eventLog.Cases.Add(ca8);
            eventLog.Cases.Add(ca9);
            eventLog.Cases.Add(ca10);
            eventLog.Cases.Add(ca11);
            eventLog.Cases.Add(ca12);
            eventLog.Cases.Add(ca13);
            eventLog.Cases.Add(ca14);
            eventLog.Cases.Add(ca15);
            eventLog.Cases.Add(ca16);
            eventLog.Cases.Add(ca17);
            eventLog.Cases.Add(ca18);
            eventLog.Cases.Add(ca19);
            eventLog.Cases.Add(ca20);
            eventLog.Cases.Add(ca21);

            //
            //PetriNet
            //
            PetriNet petriNet = new PetriNet("Petri-Net Name");

            Place pStart = new Place("Place Start", 0);
            Place pC1 = new Place("c1", 0);
            Place pC2 = new Place("c2", 0);
            Place pC3 = new Place("c3", 0);
            Place pC4 = new Place("c4", 0);
            Place pC5 = new Place("c5", 0);
            Place pEnd = new Place("Place End", 0);

            Transition tA = new Transition("A");
            Transition tB = new Transition("B");
            Transition tC = new Transition("C");
            Transition tD = new Transition("D");
            Transition tE = new Transition("E");
            Transition tF = new Transition("F");
            Transition tG = new Transition("G");
            Transition tH = new Transition("H");

            tG.AddOutgoingPlace(pEnd);
            tG.AddIncomingPlace(pC5);

            tH.AddOutgoingPlace(pEnd);
            tH.AddIncomingPlace(pC5);

            tE.AddIncomingPlace(pC3);
            tE.AddIncomingPlace(pC4);
            tE.AddOutgoingPlace(pC5);

            pC3.AppendIncomingTransition(tB);
            pC3.AppendIncomingTransition(tC);
            pC3.AppendOutgoingTransition(tE);

            pC4.AppendIncomingTransition(tD);
            pC4.AppendOutgoingTransition(tE);

            tB.AddIncomingPlace(pC1);
            tB.AddOutgoingPlace(pC3);

            tC.AddIncomingPlace(pC1);
            tC.AddOutgoingPlace(pC3);

            tD.AddIncomingPlace(pC2);
            tD.AddOutgoingPlace(pC4);

            pC1.AppendIncomingTransition(tA);
            pC1.AppendOutgoingTransition(tB);
            pC1.AppendOutgoingTransition(tC);

            pC2.AppendIncomingTransition(tA);
            pC2.AppendOutgoingTransition(tD);

            tF.AddIncomingPlace(pC5);
            tF.AddOutgoingPlace(pC1);
            tF.AddOutgoingPlace(pC2);

            //
            tA.AddIncomingPlace(pStart);
            tA.AddOutgoingPlace(pC1);
            tA.AddOutgoingPlace(pC2);

            pStart.AppendOutgoingTransition(tA);

            pEnd.AppendIncomingTransition(tG);
            pEnd.AppendIncomingTransition(tH);

            ////
            petriNet.Transitions.Add(tA);
            petriNet.Transitions.Add(tB);
            petriNet.Transitions.Add(tC);
            petriNet.Transitions.Add(tD);
            petriNet.Transitions.Add(tE);
            petriNet.Transitions.Add(tF);
            petriNet.Transitions.Add(tG);
            petriNet.Transitions.Add(tH);

            ////
            petriNet.Places.Add(pStart);
            petriNet.Places.Add(pC1);
            petriNet.Places.Add(pC2);
            petriNet.Places.Add(pC3);
            petriNet.Places.Add(pC4);
            petriNet.Places.Add(pC5);
            petriNet.Places.Add(pEnd);

            ComparingFootprint footprintEventLog = ComparingFootprintAlgorithm.CreateFootprint(eventLog);
            ComparingFootprint footprintPetriNet = ComparingFootprintAlgorithm.CreateFootprint(petriNet);

            ComparingFootprintResultMatrix footprintResultMatrix = new ComparingFootprintResultMatrix(footprintEventLog, footprintPetriNet);

            if (footprintResultMatrix.HeaderWithEventNames.Count != 8)
            {
                Assert.Fail("");
            }

            int y = 0;
            foreach (String headerNameY in footprintResultMatrix.HeaderWithEventNames)
            {
                int x = 0;
                foreach (String headerNameX in footprintResultMatrix.HeaderWithEventNames)
                {
                    ResultCellType resultCellType = footprintResultMatrix.ResultMatrix[y, x];
                    Console.WriteLine("Test headerNameY: " + headerNameY + ", headerNameX: " + headerNameX + " [" + y + "," + x + "].CellType:" + resultCellType);

                    if (!resultCellType.Equals(ResultCellType.NoDifferences))
                    {
                        Assert.Fail("Test headerNameY: " + headerNameY + ", headerNameX: " + headerNameX + " [" + y + "," + x + "].CellType:" + resultCellType);
                    }

                    x++;
                }
                y++;
            }

            //Arrange (Create Footprints)
            ComparingFootprint footPrintEventlog = ComparingFootprintAlgorithm.CreateFootprint(eventLog);
            ComparingFootprint footPrintPetrinet = ComparingFootprintAlgorithm.CreateFootprint(petriNet);
            ComparingFootprintResultMatrix resultFootprint = new ComparingFootprintResultMatrix(footPrintEventlog, footPrintPetrinet);

            // Act (Calculate Fitness)
            double fitnessComparingFootprint = ComparingFootprintAlgorithm.CalculateFitness(resultFootprint.GetNumberOfDifferences(), resultFootprint.GetNumberOfOpportunities());

            if (fitnessComparingFootprint != 1.0)
            {
                // Assert
                Assert.Fail("Fitness not correct! (" + fitnessComparingFootprint + ")");
            }
        }
        public void CheckCorrectFitnessBetweenEventLogAndPetrinetTest1()
        {
            //
            //EventLog
            //
            //create Case1
            Case ca1 = new Case();
            ca1.CreateEvent("A");
            ca1.CreateEvent("C");
            ca1.CreateEvent("D");
            ca1.CreateEvent("E");
            ca1.CreateEvent("H");

            //create Case2
            Case ca2 = new Case();
            ca2.CreateEvent("A");
            ca2.CreateEvent("B");
            ca2.CreateEvent("D");
            ca2.CreateEvent("E");
            ca2.CreateEvent("G");

            //create Case3
            Case ca3 = new Case();
            ca3.CreateEvent("A");
            ca3.CreateEvent("D");
            ca3.CreateEvent("C");
            ca3.CreateEvent("E");
            ca3.CreateEvent("H");

            //create Case4
            Case ca4 = new Case();
            ca4.CreateEvent("A");
            ca4.CreateEvent("B");
            ca4.CreateEvent("D");
            ca4.CreateEvent("E");
            ca4.CreateEvent("H");

            //create Case5
            Case ca5 = new Case();
            ca5.CreateEvent("A");
            ca5.CreateEvent("C");
            ca5.CreateEvent("D");
            ca5.CreateEvent("E");
            ca5.CreateEvent("G");

            //create Case6
            Case ca6 = new Case();
            ca6.CreateEvent("A");
            ca6.CreateEvent("D");
            ca6.CreateEvent("C");
            ca6.CreateEvent("E");
            ca6.CreateEvent("G");

            //create Case7
            Case ca7 = new Case();
            ca7.CreateEvent("A");
            ca7.CreateEvent("D");
            ca7.CreateEvent("B");
            ca7.CreateEvent("E");
            ca7.CreateEvent("H");

            //create Case8
            Case ca8 = new Case();
            ca8.CreateEvent("A");
            ca8.CreateEvent("C");
            ca8.CreateEvent("D");
            ca8.CreateEvent("E");
            ca8.CreateEvent("F");
            ca8.CreateEvent("D");
            ca8.CreateEvent("B");
            ca8.CreateEvent("E");
            ca8.CreateEvent("H");

            //create Case9
            Case ca9 = new Case();
            ca9.CreateEvent("A");
            ca9.CreateEvent("D");
            ca9.CreateEvent("B");
            ca9.CreateEvent("E");
            ca9.CreateEvent("G");

            //create Case10
            Case ca10 = new Case();
            ca10.CreateEvent("A");
            ca10.CreateEvent("C");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("F");
            ca10.CreateEvent("B");
            ca10.CreateEvent("D");
            ca10.CreateEvent("E");
            ca10.CreateEvent("H");

            //create Case11
            Case ca11 = new Case();
            ca11.CreateEvent("A");
            ca11.CreateEvent("C");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("F");
            ca11.CreateEvent("B");
            ca11.CreateEvent("D");
            ca11.CreateEvent("E");
            ca11.CreateEvent("G");

            //create Case12
            Case ca12 = new Case();
            ca12.CreateEvent("A");
            ca12.CreateEvent("C");
            ca12.CreateEvent("D");
            ca12.CreateEvent("E");
            ca12.CreateEvent("F");
            ca12.CreateEvent("D");
            ca12.CreateEvent("B");
            ca12.CreateEvent("E");
            ca12.CreateEvent("G");

            //create Case13
            Case ca13 = new Case();
            ca13.CreateEvent("A");
            ca13.CreateEvent("D");
            ca13.CreateEvent("C");
            ca13.CreateEvent("E");
            ca13.CreateEvent("F");
            ca13.CreateEvent("C");
            ca13.CreateEvent("D");
            ca13.CreateEvent("E");
            ca13.CreateEvent("H");

            //create Case14
            Case ca14 = new Case();
            ca14.CreateEvent("A");
            ca14.CreateEvent("D");
            ca14.CreateEvent("C");
            ca14.CreateEvent("E");
            ca14.CreateEvent("F");
            ca14.CreateEvent("D");
            ca14.CreateEvent("B");
            ca14.CreateEvent("E");
            ca14.CreateEvent("H");

            //create Case15
            Case ca15 = new Case();
            ca15.CreateEvent("A");
            ca15.CreateEvent("D");
            ca15.CreateEvent("C");
            ca15.CreateEvent("E");
            ca15.CreateEvent("F");
            ca15.CreateEvent("B");
            ca15.CreateEvent("D");
            ca15.CreateEvent("E");
            ca15.CreateEvent("G");

            //create Case16
            Case ca16 = new Case();
            ca16.CreateEvent("A");
            ca16.CreateEvent("C");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("B");
            ca16.CreateEvent("D");
            ca16.CreateEvent("E");
            ca16.CreateEvent("F");
            ca16.CreateEvent("D");
            ca16.CreateEvent("B");
            ca16.CreateEvent("E");
            ca16.CreateEvent("G");

            //create Case17
            Case ca17 = new Case();
            ca17.CreateEvent("A");
            ca17.CreateEvent("D");
            ca17.CreateEvent("C");
            ca17.CreateEvent("E");
            ca17.CreateEvent("F");
            ca17.CreateEvent("D");
            ca17.CreateEvent("B");
            ca17.CreateEvent("E");
            ca17.CreateEvent("G");

            //create Case18
            Case ca18 = new Case();
            ca18.CreateEvent("A");
            ca18.CreateEvent("D");
            ca18.CreateEvent("C");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("F");
            ca18.CreateEvent("B");
            ca18.CreateEvent("D");
            ca18.CreateEvent("E");
            ca18.CreateEvent("G");

            //create Case19
            Case ca19 = new Case();
            ca19.CreateEvent("A");
            ca19.CreateEvent("D");
            ca19.CreateEvent("C");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("D");
            ca19.CreateEvent("B");
            ca19.CreateEvent("E");
            ca19.CreateEvent("F");
            ca19.CreateEvent("B");
            ca19.CreateEvent("D");
            ca19.CreateEvent("E");
            ca19.CreateEvent("H");

            //create Case20
            Case ca20 = new Case();
            ca20.CreateEvent("A");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("B");
            ca20.CreateEvent("D");
            ca20.CreateEvent("E");
            ca20.CreateEvent("F");
            ca20.CreateEvent("D");
            ca20.CreateEvent("B");
            ca20.CreateEvent("E");
            ca20.CreateEvent("G");

            //create Case21
            Case ca21 = new Case();
            ca21.CreateEvent("A");
            ca21.CreateEvent("D");
            ca21.CreateEvent("C");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("C");
            ca21.CreateEvent("D");
            ca21.CreateEvent("E");
            ca21.CreateEvent("F");
            ca21.CreateEvent("D");
            ca21.CreateEvent("B");
            ca21.CreateEvent("E");
            ca21.CreateEvent("G");

            //create Event Log
            EventLog eventLog = new EventLog();
            eventLog.Cases.Add(ca1);
            eventLog.Cases.Add(ca2);
            eventLog.Cases.Add(ca3);
            eventLog.Cases.Add(ca4);
            eventLog.Cases.Add(ca5);
            eventLog.Cases.Add(ca6);
            eventLog.Cases.Add(ca7);
            eventLog.Cases.Add(ca8);
            eventLog.Cases.Add(ca9);
            eventLog.Cases.Add(ca10);
            eventLog.Cases.Add(ca11);
            eventLog.Cases.Add(ca12);
            eventLog.Cases.Add(ca13);
            eventLog.Cases.Add(ca14);
            eventLog.Cases.Add(ca15);
            eventLog.Cases.Add(ca16);
            eventLog.Cases.Add(ca17);
            eventLog.Cases.Add(ca18);
            eventLog.Cases.Add(ca19);
            eventLog.Cases.Add(ca20);
            eventLog.Cases.Add(ca21);

            //
            //PetriNet
            //
            PetriNet petriNet = new PetriNet("Petri-Net Name");

            Place pStart = new Place("Place Start", 0);
            Place pC1 = new Place("c1", 0);
            Place pC2 = new Place("c2", 0);
            Place pC3 = new Place("c3", 0);
            Place pC4 = new Place("c4", 0);
            Place pC5 = new Place("c5", 0);
            Place pEnd = new Place("Place End", 0);

            Transition tA = new Transition("A");
            Transition tB = new Transition("B");
            Transition tC = new Transition("C");
            Transition tD = new Transition("D");
            Transition tE = new Transition("E");
            Transition tF = new Transition("F");
            Transition tG = new Transition("G");
            Transition tH = new Transition("H");

            tG.AddOutgoingPlace(pEnd);
            tG.AddIncomingPlace(pC5);

            tH.AddOutgoingPlace(pEnd);
            tH.AddIncomingPlace(pC5);

            tE.AddIncomingPlace(pC3);
            tE.AddIncomingPlace(pC4);
            tE.AddOutgoingPlace(pC5);

            pC3.AppendIncomingTransition(tB);
            pC3.AppendIncomingTransition(tC);
            pC3.AppendOutgoingTransition(tE);

            pC4.AppendOutgoingTransition(tE);

            tB.AddIncomingPlace(pC1);
            tB.AddOutgoingPlace(pC3);

            tC.AddIncomingPlace(pC1);
            tC.AddOutgoingPlace(pC3);

            tD.AddIncomingPlace(pC2);
            tD.AddOutgoingPlace(pC4);

            pC1.AppendIncomingTransition(tA);
            pC1.AppendOutgoingTransition(tB);
            pC1.AppendOutgoingTransition(tC);

            pC2.AppendIncomingTransition(tA);
            pC2.AppendOutgoingTransition(tD);

            tF.AddIncomingPlace(pC5);
            tF.AddOutgoingPlace(pC1);
            tF.AddOutgoingPlace(pC2);

            //
            tA.AddIncomingPlace(pStart);
            tA.AddOutgoingPlace(pC1);
            tA.AddOutgoingPlace(pC2);

            pStart.AppendOutgoingTransition(tA);

            pEnd.AppendIncomingTransition(tG);
            pEnd.AppendIncomingTransition(tH);

            ////
            petriNet.Transitions.Add(tA);
            petriNet.Transitions.Add(tB);
            petriNet.Transitions.Add(tC);
            petriNet.Transitions.Add(tD);
            petriNet.Transitions.Add(tE);
            petriNet.Transitions.Add(tF);
            petriNet.Transitions.Add(tG);
            petriNet.Transitions.Add(tH);

            ////
            petriNet.Places.Add(pStart);
            petriNet.Places.Add(pC1);
            petriNet.Places.Add(pC2);
            petriNet.Places.Add(pC3);
            petriNet.Places.Add(pC4);
            petriNet.Places.Add(pC5);
            petriNet.Places.Add(pEnd);

            ComparingFootprintResultMatrix matrix = new ComparingFootprintResultMatrix(ComparingFootprintAlgorithm.CreateFootprint(eventLog), ComparingFootprintAlgorithm.CreateFootprint(petriNet));
            double fitness = ComparingFootprintAlgorithm.CalculateFitness(matrix.GetNumberOfDifferences(), matrix.GetNumberOfOpportunities());

            if (Math.Abs(fitness - 1.0) > 0.0001)
            {
                Assert.Fail("Fitness not correct! (" + fitness + ")");
            }
        }
        /// <summary>
        /// This method creates a complex petri net with five places and eight transitions.
        /// </summary>
        /// <autor>Andrej Albrecht, Markus Holznagel</autor>
        public static PetriNet PetriNetWithFivePlacesAndEightTransitions()
        {
            PetriNet petriNet = new PetriNet("Petri-Net Name");

            Place pStart = new Place("Place Start", 0);
            Place pC1 = new Place("c1", 0);
            Place pC2 = new Place("c2", 0);
            Place pC3 = new Place("c3", 0);
            Place pC4 = new Place("c4", 0);
            Place pC5 = new Place("c5", 0);
            Place pEnd = new Place("Place End", 0);

            Transition tA = new Transition("A");
            Transition tB = new Transition("B");
            Transition tC = new Transition("C");
            Transition tD = new Transition("D");
            Transition tE = new Transition("E");
            Transition tF = new Transition("F");
            Transition tG = new Transition("G");
            Transition tH = new Transition("H");

            tG.AddOutgoingPlace(pEnd);
            tG.AddIncomingPlace(pC5);

            tH.AddOutgoingPlace(pEnd);
            tH.AddIncomingPlace(pC5);

            tE.AddIncomingPlace(pC3);
            tE.AddIncomingPlace(pC4);
            tE.AddOutgoingPlace(pC5);

            pC3.AppendIncomingTransition(tB);
            pC3.AppendIncomingTransition(tC);
            pC3.AppendOutgoingTransition(tE);

            pC4.AppendOutgoingTransition(tE);

            tB.AddIncomingPlace(pC1);
            tB.AddOutgoingPlace(pC3);

            tC.AddIncomingPlace(pC1);
            tC.AddOutgoingPlace(pC3);

            tD.AddIncomingPlace(pC2);
            tD.AddOutgoingPlace(pC4);

            pC1.AppendIncomingTransition(tA);
            pC1.AppendOutgoingTransition(tB);
            pC1.AppendOutgoingTransition(tC);

            pC2.AppendIncomingTransition(tA);
            pC2.AppendOutgoingTransition(tD);

            tF.AddIncomingPlace(pC5);
            tF.AddOutgoingPlace(pC1);
            tF.AddOutgoingPlace(pC2);

            tA.AddIncomingPlace(pStart);
            tA.AddOutgoingPlace(pC1);
            tA.AddOutgoingPlace(pC2);

            pStart.AppendOutgoingTransition(tA);

            pEnd.AppendIncomingTransition(tG);
            pEnd.AppendIncomingTransition(tH);

            petriNet.Transitions.Add(tA);
            petriNet.Transitions.Add(tB);
            petriNet.Transitions.Add(tC);
            petriNet.Transitions.Add(tD);
            petriNet.Transitions.Add(tE);
            petriNet.Transitions.Add(tF);
            petriNet.Transitions.Add(tG);
            petriNet.Transitions.Add(tH);

            petriNet.Places.Add(pStart);
            petriNet.Places.Add(pC1);
            petriNet.Places.Add(pC2);
            petriNet.Places.Add(pC3);
            petriNet.Places.Add(pC4);
            petriNet.Places.Add(pC5);
            petriNet.Places.Add(pEnd);

            return petriNet;
        }
        /// <summary>
        /// This method creates a complex petri net with six places and five transitions.
        /// </summary>
        /// <autor>Andrej Albrecht, Markus Holznagel</autor>
        public static PetriNet PetriNetWithSixPlacesAndFiveTransitions()
        {
            PetriNet petriNet = new PetriNet("Petri-Net Name");

            Place pStart = new Place("Place Start", 0);
            Place p1 = new Place("c1", 0);
            Place p2 = new Place("c2", 0);
            Place p3 = new Place("c3", 0);
            Place p4 = new Place("c4", 0);
            Place pEnd = new Place("Place End", 0);

            Transition tA = new Transition("A");
            Transition tB = new Transition("B");
            Transition tC = new Transition("C");
            Transition tD = new Transition("D");
            Transition tE = new Transition("E");

            pStart.AppendOutgoingTransition(tA);

            tA.AddIncomingPlace(pStart);
            tA.AddOutgoingPlace(p1);
            tA.AddOutgoingPlace(p2);

            p1.AppendIncomingTransition(tA);
            p1.AppendOutgoingTransition(tB);
            p1.AppendOutgoingTransition(tC);

            p2.AppendIncomingTransition(tA);
            p2.AppendOutgoingTransition(tC);
            p2.AppendOutgoingTransition(tD);

            tB.AddIncomingPlace(p1);
            tB.AddOutgoingPlace(p3);

            tC.AddIncomingPlace(p1);
            tC.AddIncomingPlace(p2);
            tC.AddOutgoingPlace(p3);
            tC.AddOutgoingPlace(p4);

            tD.AddIncomingPlace(p2);
            tD.AddOutgoingPlace(p4);

            p3.AppendIncomingTransition(tB);
            p3.AppendIncomingTransition(tC);
            p3.AppendOutgoingTransition(tE);

            p4.AppendIncomingTransition(tC);
            p4.AppendIncomingTransition(tD);
            p4.AppendOutgoingTransition(tE);

            tE.AddIncomingPlace(p3);
            tE.AddIncomingPlace(p4);
            tE.AddOutgoingPlace(pEnd);

            pEnd.AppendIncomingTransition(tE);

            petriNet.Transitions.Add(tA);
            petriNet.Transitions.Add(tB);
            petriNet.Transitions.Add(tC);
            petriNet.Transitions.Add(tD);
            petriNet.Transitions.Add(tE);

            petriNet.Places.Add(pStart);
            petriNet.Places.Add(p1);
            petriNet.Places.Add(p2);
            petriNet.Places.Add(p3);
            petriNet.Places.Add(p4);
            petriNet.Places.Add(pEnd);

            return petriNet;
        }
        /// <summary>
        /// This method creates a petri net with one loop, three places and four transitions.
        /// </summary>
        /// <autor>Thomas Meents</autor>
        public static PetriNet PetriNetWithOneLoopThreePlacesAndThreeTransitions()
        {
            PetriNet PetriNet = new PetriNet("Petri-Net Name");

            Place paIn = new Place("PlaceAIn", 0);
            Place paOut = new Place("PlaceAOut", 0);
            Place pbOut = new Place("PlaceBOut", 0);

            Transition ta = new Transition("TransitionA");
            Transition tb = new Transition("TransitionB");
            Transition tc = new Transition("");

            tb.IsLoop = true; //loop

            paIn.AppendOutgoingTransition(ta);
            paOut.AppendOutgoingTransition(tb);
            paOut.AppendIncomingTransition(tb); //loop
            pbOut.AppendOutgoingTransition(tc);
            pbOut.AppendOutgoingTransition(tb); //loop

            ta.AddOutgoingPlace(paOut);
            tb.AddOutgoingPlace(pbOut);
            tb.AddIncomingPlace(paIn); //loop

            PetriNet.Places.Add(paIn);
            PetriNet.Places.Add(paOut);
            PetriNet.Places.Add(pbOut);

            PetriNet.Transitions.Add(ta);
            PetriNet.Transitions.Add(tb);
            PetriNet.Transitions.Add(tc);

            return PetriNet;
        }
        /// <summary>
        /// This method creates a complex petri net with fourteen places and fourteen transitions.
        /// You can choose this for testing recursive parallelisms.
        /// </summary>
        /// <autor>Markus Holznagel</autor>
        public static PetriNet PetriNetWithFourteenPlacesAndFourteenTransitions()
        {
            PetriNet petriNet = new PetriNet("Petri-Net Name");

            Place pStart = new Place("pStart");
            Place p1 = new Place("p1");
            Place p2 = new Place("p2");
            Place p3 = new Place("p3");
            Place p4 = new Place("p4");
            Place p5 = new Place("p5");
            Place p6 = new Place("p6");
            Place p7 = new Place("p7");
            Place p8 = new Place("p8");
            Place p9 = new Place("p9");
            Place p10 = new Place("p10");
            Place p11 = new Place("p11");
            Place p12 = new Place("p12");
            Place pEnd = new Place("pEnd");

            Transition tA = new Transition("A");
            Transition tB = new Transition("B");
            Transition tC = new Transition("C");
            Transition tD = new Transition("D");
            Transition tE = new Transition("E");
            Transition tF = new Transition("F");
            Transition tG = new Transition("G");
            Transition tH = new Transition("H");
            Transition tI = new Transition("I");
            Transition tJ = new Transition("J");
            Transition tK = new Transition("K");
            Transition tL = new Transition("L");
            Transition tM = new Transition("M");
            Transition tN = new Transition("N");

            // Transitions and Places
            pStart.AppendOutgoingTransition(tA);

            tA.AddIncomingPlace(pStart);
            tA.AddOutgoingPlace(p1);
            tA.AddOutgoingPlace(p2);

            p1.AppendIncomingTransition(tA);
            p1.AppendOutgoingTransition(tB);

            tB.AddIncomingPlace(p1);
            tB.AddOutgoingPlace(p3);
            tB.AddOutgoingPlace(p4);

            p2.AppendIncomingTransition(tA);
            p2.AppendOutgoingTransition(tC);

            tC.AddIncomingPlace(p2);
            tC.AddIncomingPlace(p5);
            tC.AddIncomingPlace(p6);

            p3.AppendIncomingTransition(tB);
            p3.AppendOutgoingTransition(tD);
            p3.AppendOutgoingTransition(tE);

            tD.AddIncomingPlace(p3);
            tD.AddOutgoingPlace(p7);

            tE.AddIncomingPlace(p3);
            tE.AddOutgoingPlace(p7);

            p4.AppendIncomingTransition(tB);
            p4.AppendOutgoingTransition(tF);
            p4.AppendOutgoingTransition(tG);

            tF.AddIncomingPlace(p4);
            tF.AddOutgoingPlace(p8);

            tG.AddIncomingPlace(p4);
            tG.AddOutgoingPlace(p8);

            p5.AppendIncomingTransition(tC);
            p5.AppendOutgoingTransition(tH);
            p5.AppendOutgoingTransition(tI);

            tH.AddIncomingPlace(p5);
            tH.AddOutgoingPlace(p9);

            tI.AddIncomingPlace(p5);
            tI.AddOutgoingPlace(p9);

            p6.AppendIncomingTransition(tC);
            p6.AppendOutgoingTransition(tJ);
            p6.AppendOutgoingTransition(tK);

            tJ.AddIncomingPlace(p6);
            tJ.AddOutgoingPlace(p10);

            tK.AddIncomingPlace(p6);
            tK.AddOutgoingPlace(p10);

            p7.AppendIncomingTransition(tD);
            p7.AppendIncomingTransition(tE);
            p7.AppendOutgoingTransition(tL);

            p8.AppendIncomingTransition(tF);
            p8.AppendIncomingTransition(tG);
            p8.AppendOutgoingTransition(tL);

            tL.AddIncomingPlace(p7);
            tL.AddIncomingPlace(p8);
            tL.AddOutgoingPlace(p11);

            p9.AppendIncomingTransition(tH);
            p9.AppendIncomingTransition(tI);
            p9.AppendOutgoingTransition(tM);

            p10.AppendIncomingTransition(tJ);
            p10.AppendIncomingTransition(tK);
            p10.AppendOutgoingTransition(tM);

            tM.AddIncomingPlace(p9);
            tM.AddIncomingPlace(p10);
            tM.AddOutgoingPlace(p12);

            p11.AppendIncomingTransition(tL);
            p11.AppendOutgoingTransition(tN);

            p12.AppendIncomingTransition(tM);
            p12.AppendOutgoingTransition(tN);

            tN.AddIncomingPlace(p11);
            tN.AddIncomingPlace(p12);
            tN.AddOutgoingPlace(pEnd);

            pEnd.AppendIncomingTransition(tN);

            // Add Transitions and places to petrinet
            petriNet.Transitions.Add(tA);
            petriNet.Transitions.Add(tB);
            petriNet.Transitions.Add(tC);
            petriNet.Transitions.Add(tD);
            petriNet.Transitions.Add(tE);
            petriNet.Transitions.Add(tF);
            petriNet.Transitions.Add(tG);
            petriNet.Transitions.Add(tH);
            petriNet.Transitions.Add(tI);
            petriNet.Transitions.Add(tJ);
            petriNet.Transitions.Add(tK);
            petriNet.Transitions.Add(tL);
            petriNet.Transitions.Add(tM);
            petriNet.Transitions.Add(tN);

            petriNet.Places.Add(pStart);
            petriNet.Places.Add(p1);
            petriNet.Places.Add(p2);
            petriNet.Places.Add(p3);
            petriNet.Places.Add(p4);
            petriNet.Places.Add(p5);
            petriNet.Places.Add(p6);
            petriNet.Places.Add(p7);
            petriNet.Places.Add(p8);
            petriNet.Places.Add(p9);
            petriNet.Places.Add(p10);
            petriNet.Places.Add(p11);
            petriNet.Places.Add(p12);
            petriNet.Places.Add(pEnd);

            return petriNet;
        }