public void RedundantRemoverWithNested() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = true }; var activityD = new Activity("D", "somename4") { Included = false }; var activityE = new Activity("E", "somename5") { Included = true }; var activityF = new Activity("F", "somename6") { Included = true }; dcrGraph.AddActivities(activityA, activityB, activityC, activityD, activityE, activityF); dcrGraph.AddIncludeExclude(true, activityC.Id,activityD.Id); dcrGraph.AddIncludeExclude(true, activityC.Id, activityE.Id); //Redundant include dcrGraph.AddCondition(activityE.Id,activityF.Id); //outgoing relation //ingoing relation dcrGraph.AddCondition(activityA.Id,activityC.Id); dcrGraph.AddCondition(activityA.Id, activityD.Id); dcrGraph.AddCondition(activityA.Id, activityE.Id); dcrGraph.MakeNestedGraph(new HashSet<Activity>() {activityC, activityD, activityE}); var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); //we check that the Nested graph has had the redundant relation removed. Assert.IsFalse(newGraph.InRelation(activityE,newGraph.IncludeExcludes)); }
public void RedundancyTestCase7() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = false, Pending = true }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = true }; dcrGraph.Activities.Add(activityA); dcrGraph.Activities.Add(activityB); dcrGraph.Activities.Add(activityC); dcrGraph.AddResponse(activityB.Id, activityA.Id); dcrGraph.AddIncludeExclude(true, activityC.Id, activityA.Id); dcrGraph.AddIncludeExclude(true, activityB.Id, activityA.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityB.Id); var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); //Now either the redundant response relation or A's initial pending state should be removed:"); Assert.IsFalse(newGraph.InRelation(activityA, newGraph.Responses) && newGraph.GetActivity(activityA.Id).Pending); }
public void TestResponseAndExcludeRedundantIfNoTargetInclude() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true }; var activityB = new Activity("B", "somename2") { Included = true }; dcrGraph.Activities.Add(activityA); dcrGraph.Activities.Add(activityB); dcrGraph.AddResponse(activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityB.Id); var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); //Now the redundant response relation should be removed: Assert.IsFalse(newGraph.InRelation(activityB, newGraph.Responses)); }
public void TestRedundantActivityIsRemoved() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = false }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = true }; dcrGraph.Activities.Add(activityA); dcrGraph.Activities.Add(activityB); dcrGraph.Activities.Add(activityC); dcrGraph.AddResponse(activityB.Id, activityA.Id); var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); Assert.IsNull(newGraph.GetActivity(activityA.Id)); }
public void TestNonRedundantResponseIsNotRemoved2() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true }; var activityB = new Activity("B", "somename2") { Included = false }; dcrGraph.Activities.Add(activityA); dcrGraph.Activities.Add(activityB); dcrGraph.AddResponse(activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityA.Id); var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); Assert.IsTrue(newGraph.InRelation(activityA, newGraph.Responses)); }
public void TestIncludesToIncludedRedundant() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true }; var activityB = new Activity("B", "somename2") { Included = true }; dcrGraph.Activities.Add(activityA); dcrGraph.Activities.Add(activityB); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); //Now the redundant include relation should be removed:"); var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); Assert.IsFalse(newGraph.InRelation(activityA, newGraph.IncludeExcludes)); }
public void TestIncludeConditionRedundancy() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true }; var activityB = new Activity("B", "somename2") { Included = false }; dcrGraph.Activities.Add(activityA); dcrGraph.Activities.Add(activityB); dcrGraph.AddCondition(activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); //Now the redundant condition relation from A to B should be removed: Assert.IsFalse(newGraph.InRelation(activityB, newGraph.Conditions)); }
public void TestConditionMilestoneRedundancy() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = false }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = true }; dcrGraph.Activities.Add(activityA); dcrGraph.Activities.Add(activityB); dcrGraph.Activities.Add(activityC); dcrGraph.AddCondition(activityA.Id, activityB.Id); dcrGraph.AddMileStone(activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityC.Id, activityA.Id); dcrGraph.AddResponse(activityC.Id, activityA.Id); var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); //Now either the redundant Condition or Milestone relation should be removed:"); Assert.IsFalse(newGraph.InRelation(activityA, newGraph.Conditions) && newGraph.InRelation(activityA, newGraph.Milestones)); }
public void TestAlwaysIncludeIncludedRedundant() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = false }; dcrGraph.Activities.Add(activityA); dcrGraph.Activities.Add(activityB); dcrGraph.Activities.Add(activityC); dcrGraph.AddCondition(activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityB.Id, activityC.Id); dcrGraph.AddIncludeExclude(true, activityA.Id, activityC.Id); var newDcr = new RedundancyRemover().RemoveRedundancy(dcrGraph); //we should now have removed include b -> c. so we are asserting that B no longer has a include relation Assert.IsFalse(newDcr.GetIncludeOrExcludeRelation(activityB, true).Contains(activityC)); }
public void TestActivityAlwaysExcludedRedundant() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = false }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = true }; dcrGraph.Activities.Add(activityA); dcrGraph.Activities.Add(activityB); dcrGraph.Activities.Add(activityC); dcrGraph.AddCondition(activityA.Id, activityB.Id); dcrGraph.AddMileStone(activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityC.Id); dcrGraph.AddResponse(activityA.Id, activityB.Id); dcrGraph.AddResponse(activityB.Id, activityA.Id); var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); //Now all the relations from or to A should be removed:"); Assert.IsTrue(!newGraph.InRelation(activityA, newGraph.Conditions) && !newGraph.InRelation(activityA, newGraph.IncludeExcludes) && !newGraph.InRelation(activityA, newGraph.Responses) && !newGraph.InRelation(activityA, newGraph.Milestones)); }
public void RedundantRemoverWithNestedRedundantIncludes() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = false }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = true }; var activityD = new Activity("D", "somename4") { Included = false }; dcrGraph.AddActivities(activityA, activityB, activityC, activityD); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityA.Id, activityC.Id); dcrGraph.AddIncludeExclude(true, activityA.Id, activityD.Id); dcrGraph.MakeNestedGraph(new HashSet<Activity>() { activityB, activityC, activityD }); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); // redundant include var newGraph = new RedundancyRemover().RemoveRedundancy(dcrGraph); //we check that the (redundant) include to an activity within an included nested graph was removed Assert.IsFalse(newGraph.InRelation(activityB, newGraph.IncludeExcludes)); }
public void TestLogParserHospital() { var watch = new Stopwatch(); watch.Start(); var log = XmlParser.ParseLog( new LogStandard("http://www.xes-standard.org/", "trace", new LogStandardEntry(DataType.String, "conceptName"), "event", new LogStandardEntry(DataType.String, "ActivityCode"), new LogStandardEntry(DataType.String, "conceptName"), new LogStandardEntry(DataType.String, "org:group")), Properties.Resources.Hospital_log); Console.WriteLine("Finished parsing " + log.Traces.Count + " traces. Took: " + watch.Elapsed); Console.WriteLine("Alphabeth of size " + log.Alphabet.Count); int occurences = 0; // log.Traces = new List<LogTrace>(log.Traces.Where(t => t.Events.Distinct().Count() < 8)); foreach (var character in log.Alphabet) { foreach (var other in log.Alphabet.Where(a => (a.IdOfActivity == character.IdOfActivity && a.Name != character.Name))) { //Console.WriteLine("Name: " + character.Name + ", " + character.IdOfActivity +" is not : "+ other.IdOfActivity); occurences++; } } Console.WriteLine("occurences of Id/Name-mismatch: " + occurences); var actors = new HashSet<String>(); foreach (var name in log.Traces.SelectMany(trace => trace.Events.Select(a => a.ActorName))) { actors.Add(name); } foreach (var name in actors) { var tracesLength = log.Traces.Where(t => t.Events.Any(n => n.ActorName == name)).Select(a=> a.Events.Count); Console.WriteLine(name + " : " + tracesLength.Count() + " traces, Longest trace = " + tracesLength.Max()); } foreach (var trace in log.Traces.First().Events) { //Console.WriteLine("Example trace: " + log.Traces.First().Id); //Console.Write("ID: " + trace.IdOfActivity + ", Name: " + trace.Name + " | "); } Console.WriteLine("\nPlease choose department to process mine:"); string department= Console.ReadLine(); var newLog = log.FilterByActor(department); ContradictionApproach ex = new ContradictionApproach(new HashSet<Activity>(newLog.Alphabet.Select(logEvent => new Activity(logEvent.IdOfActivity,logEvent.Name)))); Console.WriteLine(ex.Graph); var redundancy = new RedundancyRemover(); foreach (var trace in newLog.Traces) { ex.AddTrace(trace); } var redundancyRemoved = redundancy.RemoveRedundancy(ex.Graph); Console.WriteLine(redundancyRemoved); Console.WriteLine(QualityDimensionRetriever.Retrieve(redundancyRemoved, newLog)); Console.ReadLine(); }
public void TestFinalStateMisplacement() { var graph = new DcrGraph(); graph.AddActivity("A", "somename1"); graph.AddActivity("B", "somename2"); graph.AddActivity("C", "somename3"); graph.SetIncluded(true, "A"); // Start at A graph.AddIncludeExclude(true, "A", "B"); graph.AddIncludeExclude(true, "B", "C"); graph.AddIncludeExclude(false, "C", "B"); graph.AddResponse("B", "C"); // Self-excludes graph.AddIncludeExclude(false, "A", "A"); graph.AddIncludeExclude(false, "B", "B"); graph.AddIncludeExclude(false, "C", "C"); Console.WriteLine(graph); var graph2 = new RedundancyRemover().RemoveRedundancy(graph); Console.WriteLine(graph2); Console.ReadLine(); }
public void TestSimpleGraph() { var graph = new DcrGraph(); graph.AddActivity("A", "somename1"); graph.AddActivity("B", "somename2"); graph.SetIncluded(true, "A"); // Start at A graph.SetIncluded(true, "B"); Console.WriteLine(graph); var graph2 = new RedundancyRemover().RemoveRedundancy(graph); Console.WriteLine(graph2); Console.ReadLine(); }
public void Init() { Activities = new ObservableCollection<Activity>(); _contradictionApproach = new ContradictionApproach(new HashSet<Activity>(Activities)); ContradictionApproach.PostProcessingResultEvent += UpdateGraphWithPostProcessingResult; _redundancyRemover = new RedundancyRemover(); _redundancyRemover.ReportProgress += ProgressMadeInRedundancyRemover; ActivityButtons = new ObservableCollection<ActivityNameWrapper>(); EntireLog = new TrulyObservableCollection<LogTrace>(); PerformPostProcessing = false; IsTraceAdditionAllowed = true; var startOptionsViewModel = new StartOptionsWindowViewModel(); startOptionsViewModel.AlphabetSizeSelected += SetUpWithAlphabet; startOptionsViewModel.LogLoaded += SetUpWithLog; startOptionsViewModel.DcrGraphLoaded += SetUpWithGraph; OpenStartOptionsEvent?.Invoke(startOptionsViewModel); }