示例#1
0
        public void AlignmentOnLogEasy()
        {
            // Arrange
            ImportedEventLog elog = CSVImport.MakeDataFrame(heuristicCsv);

            elog.SetActivity("act");
            elog.SetCaseId("id");
            WorkflowLog wlog = new WorkflowLog(elog);
            var         pNet = CNetUtils.ConvertCNetToPetriNet(HeuristicMiner.MineCNet(wlog));

            // Act
            AlignmentOnLog alignment = new AlignmentOnLog(wlog, pNet);

            // Assert
            Assert.IsTrue(alignment.Fitness >= 0.96);
            Assert.AreEqual(wlog.GetTracesWithOccurrence().Count, alignment.AlignmentsOnLog.Count);
        }
示例#2
0
        /// <summary>
        /// Find bindings based on the dependency graph and the workflow log
        /// </summary>
        /// <param name="dependencyGraph">Dependency graph</param>
        /// <param name="workflowLog">Workflow log</param>
        private void FindBindings(DependencyGraph dependencyGraph, WorkflowLog workflowLog)
        {
            foreach (var(trace, occurrence) in workflowLog.GetTracesWithOccurrence())
            {
                for (var i = 0; i < trace.Activities.Count; i++)
                {
                    int currentActivity = dependencyGraph.ActivityIndices[trace.Activities[i]];

                    var outCandidate = OutBindCandidate(dependencyGraph, currentActivity, i, trace, occurrence);
                    var inCandidate  = InBindCandidate(dependencyGraph, currentActivity, i, trace);

                    if (outCandidate.Count > 0)
                    {
                        var binding = OutputBindings[currentActivity].FirstOrDefault(b => b.Activities.SetEquals(outCandidate));
                        if (binding is null)
                        {
                            OutputBindings[currentActivity].Add(new Binding(outCandidate, occurrence));
                        }
                        else
                        {
                            binding.AddFrequency(occurrence);
                        }
                    }

                    if (inCandidate.Count <= 0)
                    {
                        continue;
                    }
                    {
                        var binding = InputBindings[currentActivity].FirstOrDefault(b => b.Activities.SetEquals(inCandidate));
                        if (binding is null)
                        {
                            InputBindings[currentActivity].Add(new Binding(inCandidate, occurrence));
                        }
                        else
                        {
                            binding.AddFrequency(occurrence);
                        }
                    }
                }
            }
        }
示例#3
0
        public void AlignmentOnLogHardCustomSettings()
        {
            // Arrange
            ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv);

            elog.SetActivity("act");
            elog.SetCaseId("id");
            WorkflowLog wlog = new WorkflowLog(elog);
            var         pNet = CNetUtils.ConvertCNetToPetriNet(HeuristicMiner.MineCNet(wlog, new HeuristicMinerSettings()
            {
                L2LThreshold = 1
            }));

            // Act
            AlignmentOnLog alignment = new AlignmentOnLog(wlog, pNet);

            // Assert
            // Now all traces doesn't fit, because L2L loop (B->C->B) is removed
            Assert.IsTrue(alignment.Fitness < 1);
            Assert.AreEqual(wlog.GetTracesWithOccurrence().Count, alignment.AlignmentsOnLog.Count);
        }