public void AlphaMinerDetectActivitySetTest()
        {
            Field field = new Field { EventLog = GenerateTestLog() };

            AlphaMiner alphaMiner = new AlphaMiner(field);
            PrivateObject priObj = new PrivateObject(alphaMiner);

            priObj.Invoke("DetectActivitiySet");
            HashSet<String> listOfActivities = (HashSet<String>)priObj.GetField("_listOfActivities");

            Assert.IsNotNull(listOfActivities);
        }
Esempio n. 2
0
        /// <summary>
        /// Goes through the inductive miner algorithm
        /// </summary>
        /// <param name="field">A field from the data selection</param>
        /// <returns>A PetriNet as a ProcessModel</returns>
        public static ProcessModel Mine(Field field)
        {
            if (field == null)
            {
                throw new ArgumentNullException("field", "The field parameter was null");
            }

            TraceFrequency(field);
            DetectAllConnections();
            DivideAndConquer();

            return(AlphaMiner.Mine(field));
        }
        public void AlphaMinerBuildTheNetTest()
        {
            Field field = new Field { EventLog = GenerateTestLog() };

            AlphaMiner alphaMiner = new AlphaMiner(field);
            PrivateObject priObj = new PrivateObject(alphaMiner);

            priObj.Invoke("DetectAllPlaces");
            priObj.Invoke("DetectStartAndEndActivitiesInTraces");
            priObj.Invoke("AddsPlacesTogether");
            priObj.Invoke("RemoveAllDuplicatePlaces");
            priObj.Invoke("BuildTheNet");

            PetriNet petriNet = (PetriNet)priObj.GetField("_petriNet");
            Place startPlace = petriNet.GetPlaceByName("start");
            Place endPlace = petriNet.GetPlaceByName("end");

            Assert.IsNotNull(petriNet);
            Assert.IsNotNull(startPlace);
            Assert.IsNotNull(endPlace);

            //MiningAlgorithm.AlphaMiner.PetriNet = new PetriNet("");

            //MiningAlgorithm.AlphaMiner.ListOfStartActivities.Add("A");
            //MiningAlgorithm.AlphaMiner.ListOfEndActivities.Add("D");

            //MiningAlgorithm.AlphaMiner.ListOfActivities.Add("A");
            //MiningAlgorithm.AlphaMiner.ListOfActivities.Add("B");
            //MiningAlgorithm.AlphaMiner.ListOfActivities.Add("C");
            //MiningAlgorithm.AlphaMiner.ListOfActivities.Add("D");
            //MiningAlgorithm.AlphaMiner.ListOfActivities.Add("E");

            //MiningAlgorithm.AlphaMiner.ListOfAlphaPlaces = ListAlphaMinerPlaces;

            //MiningAlgorithm.AlphaMiner.BuildTheNet();
        }
        public void DetectAllPlacesTestOntoTrue()
        {
            Field field = new Field { EventLog = GenerateTestLog() };

            AlphaMiner alphaMiner = new AlphaMiner(field);
            PrivateObject priObj = new PrivateObject(alphaMiner);

            priObj.Invoke("DetectAllPlaces");
            priObj.Invoke("AddsPlacesTogether");
            priObj.Invoke("RemoveAllDuplicatePlaces");
            List<AlphaMinerPlaces> alphaPlaces = (List<AlphaMinerPlaces>)priObj.GetField("_listOfAlphaPlaces");

            List<AlphaMinerPlaces> testPlaces = new List<AlphaMinerPlaces> {
                new AlphaMinerPlaces(new HashSet<string> { "A" }, new HashSet<string> { "B", "E" }),
                new AlphaMinerPlaces(new HashSet<string> { "A" }, new HashSet<string> { "C", "E" }),
                new AlphaMinerPlaces(new HashSet<string> { "C", "E" }, new HashSet<string> { "D" }),
                new AlphaMinerPlaces(new HashSet<string> { "B", "E" }, new HashSet<string> { "D" })
            };

            Assert.IsTrue(alphaPlaces.Count.Equals(testPlaces.Count));

            foreach (AlphaMinerPlaces testPlace in testPlaces)
            {
                int count = alphaPlaces
                                .Count(k => k.PredecessorHashSet.SetEquals(testPlace.PredecessorHashSet) &&
                                            k.FollowerHashSet.SetEquals(testPlace.FollowerHashSet));
                Assert.IsTrue(count == 1);
            }
        }
        public void DetectAllPlacesTestOntoFalse()
        {
            Field field = new Field { EventLog = GenerateTestLog() };

            AlphaMiner alphaMiner = new AlphaMiner(field);
            PrivateObject priObj = new PrivateObject(alphaMiner);

            priObj.Invoke("DetectAllPlaces");
            priObj.Invoke("AddsPlacesTogether");
            priObj.Invoke("RemoveAllDuplicatePlaces");
            List<AlphaMinerPlaces> alphaPlaces = (List<AlphaMinerPlaces>)priObj.GetField("_listOfAlphaPlaces");

            List<AlphaMinerPlaces> testPlaces = new List<AlphaMinerPlaces> {
                new AlphaMinerPlaces(new HashSet<string> { "A" }, new HashSet<string> { "B", "E" }),
                new AlphaMinerPlaces(new HashSet<string> { "A" }, new HashSet<string> { "C", "E" }),
                new AlphaMinerPlaces(new HashSet<string> { "G", "E" }, new HashSet<string> { "F" }), // correctly -> "C,E", "D"
                new AlphaMinerPlaces(new HashSet<string> { "B", "E" }, new HashSet<string> { "D" }),
                new AlphaMinerPlaces(new HashSet<string> { "D" }, new HashSet<string> { "F" })       // too much
            };

            Assert.IsFalse(alphaPlaces.Count.Equals(testPlaces.Count));
            Assert.IsFalse(testPlaces[2].PredecessorHashSet.SetEquals(alphaPlaces[2].PredecessorHashSet));
            Assert.IsFalse(testPlaces[2].FollowerHashSet.SetEquals(alphaPlaces[2].FollowerHashSet));
        }