Ejemplo n.º 1
0
        public void IsAfterLoopingEventTest()
        {
            Place testPlace = new Place();
            testPlace.OutgoingTransitions.Add(new Transition("t1", isLoop: true));

            Assert.IsTrue(testPlace.IsAfterLoopingEvent);
        }
Ejemplo n.º 2
0
        public void IsBeforeLoopingEventTest()
        {
            Place testPlace = new Place();
            testPlace.IncomingTransitions.Add(new Transition("t1", isLoop: true));

            Assert.IsTrue(testPlace.IsBeforeLoopingEvent);
        }
        /// <summary>
        /// Adds all added Transition to the NetWithDifference
        /// </summary>
        /// <author>Jannik Arndt,Thomas Meents</author>
        public void AddAddedTransitions(PetriNet netWithDifference)
        {
            // Find all Transitions that have the DiffStatus "added"
            List<Transition> addedTransitions = ListOfChoosenProcessModels[1].Transitions.Where(transition => transition.DiffStatus == DiffState.Added).ToList();

            foreach (Transition addedTransition in addedTransitions)
            {
                netWithDifference.Places.AddRange(addedTransition.OutgoingPlaces);
                addedTransition.DiffStatus = DiffState.Added;

                // For non-starting transitions
                if (addedTransition.IncomingPlaces[0].IncomingTransitions != null && addedTransition.IncomingPlaces[0].IncomingTransitions.Count > 0)
                {
                    List<Transition> listOfFollower = new List<Transition>();
                    if (addedTransition.OutgoingPlaces[0].OutgoingTransitions.Count > 0)
                    {
                        foreach (Place t in addedTransition.OutgoingPlaces)
                            foreach (Transition newfollower in t.OutgoingTransitions)
                                if (!listOfFollower.Contains(newfollower))
                                    listOfFollower.Add(newfollower);
                    }
                    else
                    {
                        Transition follower = new Transition();
                        listOfFollower.Add(follower);
                    }

                    if (listOfFollower.Count > 0)
                    {
                        listOfFollower[0].IncomingPlaces.Add(addedTransition.OutgoingPlaces[0]);
                    }
                    else
                    {
                        Place endPlace = new Place("End");
                        addedTransition.OutgoingPlaces.Add(endPlace);
                    }
                }

                // For starting Transitions
                else
                {
                    foreach (Place t in addedTransition.OutgoingPlaces)
                    {
                        if (t.OutgoingTransitions.Count <= 0) continue;
                        addedTransition.IncomingPlaces[0].Name = "Start";
                        netWithDifference.Places.Add(addedTransition.IncomingPlaces[0]);

                        if (addedTransition.IncomingPlaces[0].OutgoingTransitions.Count > 1)
                            addedTransition.IncomingPlaces[0].OutgoingTransitions.RemoveAt(1);

                        if (addedTransition.OutgoingPlaces[0].IncomingTransitions.Count > 1)
                            addedTransition.OutgoingPlaces[0].IncomingTransitions.RemoveAt(1);

                        netWithDifference.Places.RemoveAt(0);
                    }
                }
                netWithDifference.Transitions.Add(addedTransition);
            }
        }
Ejemplo n.º 4
0
        public void AppendIncomingTransitionTest()
        {
            Place testPlace = new Place();
            testPlace.IncomingTransitions.Add(new Transition("t1"));
            testPlace.OutgoingTransitions.Add(new Transition("t2"));

            Assert.AreEqual("(t1) => (t2)", testPlace.ToString());
        }
Ejemplo n.º 5
0
        public void PlaceTest()
        {
            Place testPlace = new Place();

            Assert.AreEqual(0, testPlace.Token);
            Assert.IsNotNull(testPlace.IncomingTransitions);
            Assert.IsNotNull(testPlace.OutgoingTransitions);

            Place testPlace2 = new Place("Name", 2);

            Assert.AreEqual(2, testPlace2.Token);
            Assert.AreEqual("Name", testPlace2.Name);
        }
Ejemplo n.º 6
0
        public void OutgoingANDTransitionsTest()
        {
            Place testPlace = new Place();
            Transition t1 = new Transition("t1");
            Transition t2 = new Transition("t2");
            t1.IsANDJoin = true;
            t2.IsANDSplit = true;
            testPlace.OutgoingTransitions.Add(t1);
            testPlace.OutgoingTransitions.Add(t2);

            List<Transition> result = testPlace.OutgoingANDTransitions;

            Assert.IsTrue(result.Contains(t1));
            Assert.IsTrue(result.Contains(t2));
        }
        /// <summary>
        ///     Adds the transitions of a place (separated by AND-Splits/-Joins and others) to the correct Column of the
        ///     GlobalColumnList
        /// </summary>
        /// <param name="place">A Place that is already in the GlobalColumnList</param>
        /// <param name="columnNumber">The number of the column where the Transitions are supposed to be added</param>
        /// <author>Jannik Arndt</author>
        private static void AddPlace(Place place, int columnNumber)
        {
            Column column = GetOrCreateColumn(columnNumber);

            // 1. Handle AND-Transitions
            foreach (Transition transition in place.OutgoingANDTransitions)
            {
                column.ContainsAndTransitions = true;
                column.HashSetOfNodes.Add(transition);
                if (!transition.IsLoop)
                    AddTransition(transition, columnNumber + 1);
            }
            // if the next column contains an AND-transition, skip it (ColumnNumber + 2)
            if (column.ContainsAndTransitions)
            {
                columnNumber = columnNumber + 2;
                column = GetOrCreateColumn(columnNumber);
            }

            // 2. Handle other Transitions
            foreach (Transition transition in place.OutgoingTransitionsWithoutANDs)
            {
                if (!transition.IsLoop)
                {
                    if (!NodeAlreadyIsInColumns(transition))
                    {
                        column.HashSetOfNodes.Add(transition);
                        AddTransition(transition, columnNumber + 1);
                    }
                }
            }
            // If this place happens to be before a looping event, it will have a loop as an incoming places. Since the loop transition will be ignored it has to be added here
            if (place.IsBeforeLoopingEvent)
                foreach (Transition transition in place.IncomingTransitions)
                    if (transition.IsLoop)
                        column.HashSetOfNodes.Add(transition);
        }
        /// <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;
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Add a connection between this transition and the given preceding place.
 /// </summary>
 public void AddIncomingPlace(Place incoming)
 {
     //if (!IncomingPlaces.Contains(incoming))
     //    IncomingPlaces.Add(incoming);
     //incoming.AppendOutgoingTransition(this);
     IncomingPlaces.Add(incoming);
     incoming.AppendOutgoingTransition(this);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Add a connection between this transition and the given following place.
 /// </summary>
 public void AddOutgoingPlace(Place outgoing)
 {
     if (!OutgoingPlaces.Contains(outgoing))
         OutgoingPlaces.Add(outgoing);
     outgoing.AppendIncomingTransition(this);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Creates a new <see cref="Place"/> and adds it to the net.
 /// </summary>
 /// <param name="name">The Name of the new <see cref="Place"/>.</param>
 /// <param name="tokenNumber">The amount of tokens lying on the new <see cref="Place"/>.</param>
 /// <returns>Returns the new place for future reference.</returns>
 public Place AddPlace(String name = "", int tokenNumber = 0)
 {
     Place newPlace = new Place(name, tokenNumber);
     Places.Add(newPlace);
     return newPlace;
 }
 /// <summary>
 /// Draws an initial place and starts the draw tree cycle. 
 /// </summary>
 /// <returns>true if the tree was successfully drawn</returns>
 /// <author>Thomas Meents, Bernd Nottbeck</author>
 public bool GeneratePetriNet()
 {
     Place myPlace = new Place("Start");
     IMPetriNet.Places.Add(myPlace);
     Place endPlace = TraverseTreePetrinet(IMTree, myPlace);
     endPlace.Name = "End";
     return true;
 }
        /// <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;
        }
        /// <summary>
        ///     Draw a Ellipse
        /// </summary>
        /// <param Name="myCanvas"></param>
        /// <param name="place"></param>
        /// <autor>Thomas Meents, Krystian Zielonka</autor>
        private ExtendedThumb DrawPlace(Place place)
        {
            String name = place.Name.Trim();
            ExtendedThumb placeThumb = new ExtendedThumb
            {
                Name = "Place",
                Width = Settings.Default.PlaceRadius,
                Height = Settings.Default.PlaceRadius
            };
            placeThumb.Margin = new Thickness(-placeThumb.Width/2);
            placeThumb.Template = GetPlaceTemplate();
            placeThumb.SetValue(ContentControl.ContentProperty, name);
            placeThumb.InternName = place.ToString();

            return placeThumb;
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Creates a new <see cref="Transition"/> and adds it to the net.
        /// </summary>
        /// <param name="setname">The name of the new transition.</param>
        /// <param name="incomingPlaces">The places that proceeds the transition.</param>
        /// <param name="outgoingPlaces">The places that follow the transition.</param>
        /// <param name="incomingPlace">If only one place proceeds the transition.</param>
        /// <param name="outgoingPlace">If only one place follows the transition.</param>
        /// <param name="isLoop">Whether the transition is a loop.</param>
        /// <returns>A new transition that is connected to the net and the places before and after it.</returns>
        /// <author>Jannik Arndt</author>
        public Transition AddTransition(String setname = "", List<Place> incomingPlaces = null, List<Place> outgoingPlaces = null, Place incomingPlace = null, Place outgoingPlace = null, bool isLoop = false)
        {
            incomingPlaces = incomingPlaces ?? new List<Place>();
            outgoingPlaces = outgoingPlaces ?? new List<Place>();
            if (incomingPlace != null)
                incomingPlaces.Add(incomingPlace);
            if (outgoingPlace != null)
                outgoingPlaces.Add(outgoingPlace);

            Transition newTransition = new Transition(setname, incomingPlaces, outgoingPlaces, isLoop);
            Transitions.Add(newTransition);
            return newTransition;
        }
        /// <summary>
        /// This method creates a petri net with five places and four transitions.
        /// </summary>
        /// <autor>Markus Holznagel</autor>
        public static PetriNet PetriNetWithFivePlacesAndFourTransitions()
        {
            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);
            Place pCOut = new Place("PlaceCOut", 0);
            Place pDOut = new Place("PlaceDOut", 0);

            Transition tA = new Transition("TransitionA");
            Transition tB = new Transition("TransitionB");
            Transition tC = new Transition("TransitionC");
            Transition tD = new Transition("TransitionD");

            pAIn.AppendOutgoingTransition(tA);
            pAOut.AppendOutgoingTransition(tB);
            pBOut.AppendOutgoingTransition(tC);
            pCOut.AppendOutgoingTransition(tD);

            tA.AddOutgoingPlace(pAOut);
            tB.AddOutgoingPlace(pBOut);
            tC.AddOutgoingPlace(pCOut);
            tD.AddOutgoingPlace(pDOut);

            // Create petri net
            petriNet.Places.Add(pAIn);
            petriNet.Places.Add(pAOut);
            petriNet.Places.Add(pBOut);
            petriNet.Places.Add(pCOut);
            petriNet.Places.Add(pDOut);

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

            return petriNet;
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Returns a generated PlaceID
 /// </summary>
 /// <param name="place"></param>
 /// <returns></returns>
 /// <autor>Andrej Albrecht</autor>
 public String GetPlaceID(Place place)
 {
     return "p" + Places.IndexOf(place);
 }
Ejemplo n.º 18
0
        public void ToStringTest1()
        {
            Place testPlace = new Place("Name");

            Assert.AreEqual("Name", testPlace.ToString());
        }
        /// <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;
        }
        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 + ")");
            }
        }
        /// <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>
        /// 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>
        /// 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;
        }
        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 + ")");
            }
        }
        public void GetTransitionsWithoutFollowersIgnoreLoopsTest()
        {
            Model.PetriNet.PetriNet testNet = new Model.PetriNet.PetriNet("TestNet");
            Transition testTransition1 = testNet.AddTransition("TestTransition1");
            Transition testTransition2 = testNet.AddTransition("TestTransition2");
            Transition testTransition3 = testNet.AddTransition("TestTransition3");
            testNet.AddTransition("TestTransition4");
            testTransition1.AddOutgoingPlace(new Place());
            testTransition2.AddOutgoingPlace(new Place());
            Place testPlace = new Place();
            testTransition3.AddOutgoingPlace(testPlace);
            testPlace.AppendOutgoingTransition(new Transition("", isLoop: true));

            List<Transition> testList = testNet.GetTransitionsWithoutFollowersIgnoreLoops();

            Assert.IsNotNull(testList);
            Assert.AreEqual(testTransition3, testList.First());
            Assert.AreEqual(2, testList.Count);
        }