/// <summary>
        /// Interface for calculating Casual Footprint fitness
        /// </summary>
        /// <param name="pathToLogToBeMined">Path to the log file, from which we will mine the model using Petri net</param>
        /// <param name="pathToLogFile"></param>
        /// <returns>fitness E [0,1]</returns>
        public static double CalculateCasualFootprintFitness(string pathToLogToBeMined, string pathToLogFile)
        {
            Dictionary <List <string>, int> log      = FileParser.ParseXES(pathToLogToBeMined);
            Dictionary <List <string>, int> logNoisy = FileParser.ParseXES(pathToLogFile);

            PetriNet minedModel = AlphaMiner.mine(log);

            return((double)CasualFootprints.CalculateCasualFootprintFitness(minedModel, logNoisy));
        }
        /// <summary>
        /// Token replay technique
        /// </summary>
        /// <param name="pathToLogToBeMined"></param>
        /// <param name="pathToLogFile">path to the log file</param>
        /// <returns>Fitness E [0;1]</returns>
        public static double TokenReplayFitness(string pathToLogToBeMined, string pathToLogFile)
        {
            Dictionary <List <string>, int> log      = FileParser.ParseXES(pathToLogToBeMined);
            Dictionary <List <string>, int> logNoisy = FileParser.ParseXES(pathToLogFile);

            PetriNet minedModel = AlphaMiner.mine(log);

            return((double)TokenReplayFitness(minedModel, logNoisy));
        }
Exemple #3
0
        static void Main(string[] args)
        {
            string logPath =
                @"D:\New folder\conformance-checking-c-\ProcessMiningC#\ProcessMining\extension-log.xes";
            string logPath_noisy =
                @"D:\New folder\conformance-checking-c-\ProcessMiningC#\ProcessMining\extension-log-noisy.xes";

            AlphaMiner.test_alpha_miner(logPath);
            //  ConformanceChecking.TestConformanceChecking();

            //"C:\\Users\\Nikolay Dobrev\\source\\repos\\ProcessMining\\ProcessMining\\extension-log.xes";



            //TestShortestPathWithVeryComplexModel();

            //AlphaMiner.test_alpha_miner(logPath);
            // ConformanceChecking.TestConformanceChecking();
            //AlignmentBased.TestAlignment(logPath,logPath_noisy);
        }
        /// <summary>
        /// Test
        /// </summary>
        public static void TestConformanceChecking()
        {
            Dictionary <List <string>, int> log = FileParser.ParseXES(
                @"D:\New folder\conformance-checking-c-\ProcessMiningC#\ProcessMining\extension-log.xes");
            Dictionary <List <string>, int> log_noisy =
                FileParser.ParseXES(
                    @"D:\New folder\conformance-checking-c-\ProcessMiningC#\ProcessMining\extension-log-noisy.xes");

            PetriNet minedModel = AlphaMiner.mine(log);

            var casualFitness      = CasualFootprints.CalculateCasualFootprintFitness(minedModel, log);
            var casualFitnessNoisy = CasualFootprints.CalculateCasualFootprintFitness(minedModel, log_noisy);

            Console.WriteLine($"CasualFootprint fitness of the same logs and model: {casualFitness}");
            Console.WriteLine($"CasualFootprint fitness of the model and noisy logs: {casualFitnessNoisy}");

            Console.WriteLine(ConformanceChecking.TokenReplayFitness(minedModel, log));
            Console.WriteLine(ConformanceChecking.TokenReplayFitness(minedModel, log_noisy));

            Console.ReadLine();
        }
Exemple #5
0
        public static void test_alpha_miner(string pathToLog)
        {
            var minedModel = AlphaMiner.mine(FileParser.ParseXES(pathToLog));



            List <string> trace = new List <string>()
            {
                "record issue", "inspection", "intervention authorization", "work mandate", "work completion", "issue completion"
            };

            //var cost = minedModel.GetShortestPath(minedModel.TransitionNameToId("inspection"),
            //    minedModel.TransitionNameToId("issue completion"), null);

            //Console.WriteLine(cost);

            foreach (var a in trace)
            {
                check_enabled(minedModel);
                minedModel.FireTransition(minedModel.TransitionNameToId(a));
            }
        }
Exemple #6
0
        private static SuccessionType[,] CreateFootprintTable(Dictionary <List <string>, int> trace_frequencies,
                                                              Dictionary <string, int> transitionsNameToId)
        {
            var directSuccessions = AlphaMiner.GetDirectSuccessions(trace_frequencies);

            List <KeyValuePair <int, int> > directSucessionList = new List <KeyValuePair <int, int> >();

            foreach (var directSuccession in directSuccessions)
            {
                var key   = transitionsNameToId[directSuccession.Item1];
                var value = transitionsNameToId[directSuccession.Item2];

                directSucessionList.Add(new KeyValuePair <int, int>(key, value));
            }

            var ids = directSucessionList.Select(x => x.Key).ToList();

            ids.AddRange(directSucessionList.Select(x => x.Value).ToList());
            ids = ids.Distinct().OrderByDescending(x => x).ToList();

            var footprintTable = new SuccessionType[ids.Count, ids.Count];

            for (int i = 0; i < ids.Count; i++)
            {
                var casualityChildIdList  = directSucessionList.Where(kvp => kvp.Key == -(i + 1)).Select(kvp => kvp.Value).ToList();
                var casualityParentIdList = directSucessionList.Where(kvp => kvp.Value == -(i + 1)).Select(kvp => kvp.Key).ToList();
                var parallerIdList        = casualityChildIdList.Intersect(casualityParentIdList).ToList();

                for (int j = 0; j < ids.Count; j++)
                {
                    var nodeId = -(j + 1);
                    footprintTable[i, j] = DetermineSuccessionType(casualityChildIdList, casualityParentIdList,
                                                                   parallerIdList, nodeId);
                }
            }

            return(footprintTable);
        }