public void RedundantRemoverWithNestedAndNoRemoval() { 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 }; var activityE = new Activity("E", "somename5") { Included = false }; 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); //non-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 not removed a relation. Assert.IsTrue(newGraph.InRelation(activityE, newGraph.IncludeExcludes)); }
public void GetGeneralizationTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true }; var activityB = new Activity("B", "somename2") { Included = false }; var activityC = new Activity("C", "somename3") { Included = false }; dcrGraph.AddActivities(activityA, activityB, activityC); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityB.Id, activityC.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityA.Id); dcrGraph.AddIncludeExclude(false, activityB.Id, activityB.Id); var log = new Log(); log.AddTrace(new LogTrace('A', 'B')); log.AddTrace(new LogTrace('A', 'B', 'C')); log.AddTrace(new LogTrace('A', 'B', 'C')); //duplicate trace should not matter log.AddTrace(new LogTrace('A', 'B', 'C', 'A')); //illegal execution should count down log.AddTrace(new LogTrace('A', 'B', 'C', 'A', 'A')); //this one should not matter, as we've already seen A been illegally executed from this state. var log2 = new Log(); log2.AddTrace(new LogTrace('A', 'B')); var qd1 = QualityDimensionRetriever.Retrieve(dcrGraph, log); var qd2 = QualityDimensionRetriever.Retrieve(dcrGraph, log2); Assert.IsTrue(qd1.Generality > qd2.Generality); }
public void FitnessOnNestedGraph() { 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.AddCondition(activityE.Id, activityF.Id); //outgoing relation //ingoing relations 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 log = new Log(); log.AddTrace(new LogTrace('A', 'C','D')); log.AddTrace(new LogTrace('A', 'B', 'C')); log.AddTrace(new LogTrace('A', 'E', 'F')); log.AddTrace(new LogTrace('C', 'E','D')); //illegal trace should count down //expecting fitness = 75% var qd = UlrikHovsgaardAlgorithm.QualityMeasures.QualityDimensionRetriever.Retrieve(dcrGraph, log); Assert.AreEqual(75d, qd.Fitness); }
public void GetActivityTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = false }; dcrGraph.AddActivities(activityA, activityB, activityC); var retrievedActivity = dcrGraph.GetActivity(activityB.Id); Assert.AreSame(activityB, retrievedActivity); }
public void RetrieveImageWithMilestoneRelationTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true }; var activityB = new Activity("B", "somename2") { Included = false }; dcrGraph.AddActivities(activityA, activityB); dcrGraph.AddMileStone(activityA.Id, activityB.Id); var img = GraphImageRetriever.Retrieve(dcrGraph).Result; Assert.IsNotNull(img); }
public void CopyTest() { DcrGraph dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = false }; dcrGraph.AddActivities(activityA, activityB, activityC); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityB.Id, activityC.Id); var copy = dcrGraph.Copy(); Assert.AreEqual(dcrGraph.ToString(), copy.ToString()); }
public void CreateNestsTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = true }; var activityD = new Activity("D", "somename4") { Included = true }; var activityE = new Activity("E", "somename5") { Included = true, Pending = true }; var activityF = new Activity("F", "somename6") { Included = true }; var activityG = new Activity("G", "somename7") { Included = true }; dcrGraph.AddActivities(activityA, activityB, activityC, activityD, activityE, activityF, activityG); dcrGraph.AddResponse(activityB.Id, activityC.Id); //inner nest condition //From A to all inner dcrGraph.AddIncludeExclude(false, activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityC.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityD.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityE.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(false, activityD.Id, activityF.Id); //from in to out dcrGraph.AddMileStone(activityF.Id, activityG.Id); //From G to all inner and F dcrGraph.AddCondition(activityG.Id, activityB.Id); dcrGraph.AddCondition(activityG.Id, activityC.Id); dcrGraph.AddCondition(activityG.Id, activityD.Id); dcrGraph.AddCondition(activityG.Id, activityE.Id); dcrGraph.AddCondition(activityG.Id, activityF.Id); var exhaust = new ContradictionApproach(dcrGraph.Activities) { Graph = dcrGraph }; exhaust.Graph = ContradictionApproach.CreateNests(exhaust.Graph); Assert.IsTrue(exhaust.Graph.Activities.Any(a => a.IsNestedGraph)); }
public static DcrGraph ParseDreyerLog() { var graph = new DcrGraph(); graph.AddActivities(new Activity("Execute abandon", "Execute abandon") {Included = true, Roles = "Caseworker"}); graph.AddActivities(new Activity("Change phase to abandon", "Change phase to abandon") { Included = true, Roles = "Nobody" }); graph.AddActivities(new Activity("Round ends", "Round ends") {Included = true, Pending = false, Roles = "it"}); graph.AddActivities(new Activity("Fill out application", "Fill out application") { Included = true, Pending = false, Roles = "Nobody" }); graph.AddActivities(new Activity("End", "End") { Included = true, Pending = false, Roles = "*" }); graph.AddActivities(new Activity("Screening approve", "Screening approve") { Included = true, Pending = false, Roles = "caseworker" }); graph.AddActivities(new Activity("File architect", "File architect") { Included = true, Pending = false, Roles = "it" }); graph.AddActivities(new Activity("Screening reject", "Screening reject") { Included = true, Pending = false, Roles = "caseworker" }); graph.AddActivities(new Activity("File lawyer", "File lawyer") { Included = true, Pending = false, Roles = "it" }); graph.AddActivities(new Activity("Review 1", "Review 1") { Included = true, Pending = false, Roles = "lawyer" }); graph.AddActivities(new Activity("Review 2", "Review 2") { Included = true, Pending = false, Roles = "architect" }); graph.AddActivities(new Activity("Review 3", "Review 3") { Included = true, Pending = false, Roles = "lawyer" }); graph.AddActivities(new Activity("Review 4", "Review 4") { Included = true, Pending = false, Roles = "architect" }); graph.AddActivities(new Activity("Round approved", "Round approved") { Included = true, Pending = false, Roles = "it" }); graph.AddActivities(new Activity("Set pre-approved", "Set pre-approved") { Included = true, Pending = false, Roles = "it" }); graph.AddActivities(new Activity("Inform approve", "Inform approve") { Included = true, Pending = false, Roles = "casework" }); graph.AddActivities(new Activity("Receive end report", "Receive end report") { Included = true, Pending = false, Roles = "caseworker" }); graph.AddActivities(new Activity("Payout", "Payout") { Included = true, Pending = false, Roles = "it" }); graph.AddActivities(new Activity("Payout complete", "Payout complete") { Included = true, Pending = false, Roles = "it" }); graph.AddActivities(new Activity("Undo payout", "Undo payout") { Included = true, Pending = false, Roles = "caseworker" }); graph.AddActivities(new Activity("Reject application", "Reject application") { Included = true, Pending = false, Roles = "board" }); graph.AddActivities(new Activity("Approve application", "Approve application") { Included = true, Pending = false, Roles = "board" }); graph.AddActivities(new Activity("Note decision", "Note decision") { Included = true, Pending = false, Roles = "caseworker" }); graph.AddActivities(new Activity("Account no changed", "Account no changed") { Included = false, Pending = false, Roles = "it" }); graph.AddActivities(new Activity("Approve account no", "Approve account no") { Included = true, Pending = false, Roles = "accountant" }); graph.AddActivities(new Activity("Guard", "Guard") { Included = true, Pending = true, Roles = "*" }); //Should abort be included??? graph.AddActivities(new Activity("Abort application", "Abort application") { Included = false, Pending = false, Roles = "caseworker" }); graph.AddActivities(new Activity("Inform reject", "Inform reject") { Included = false, Pending = false, Roles = "caseworker"}); graph.AddActivities(new Activity("Purge application", "Purge application") { Included = false, Pending = false, Roles = "it" }); graph.AddIncludeExclude(false, "File architect", "File lawyer"); graph.AddIncludeExclude(false, "File lawyer", "File architect"); graph.AddCondition("Approve application", "Note decision"); graph.AddCondition("Reject application", "Note decision"); graph.AddIncludeExclude(false, "Payout", "Payout"); graph.AddCondition("Payout", "Undo payout"); graph.AddIncludeExclude(true, "Undo payout", "Payout"); graph.AddResponse("Undo payout", "Payout"); graph.AddResponse("Payout", "Payout complete"); graph.AddIncludeExclude(false, "Payout complete", "Undo payout"); graph.AddMileStone("Payout", "Payout complete"); graph.AddCondition("Abort application", "Inform reject"); graph.AddResponse("Abort application", "Inform reject"); graph.AddCondition("Inform reject", "Purge application"); graph.AddResponse("Inform reject", "Purge application"); graph.AddIncludeExclude(true, "Screening reject", "Inform reject"); graph.AddIncludeExclude(true, "Reject application", "Inform reject"); graph.AddIncludeExclude(false, "Screening approve", "Screening reject"); graph.AddCondition("Screening approve", "File lawyer"); graph.AddCondition("Screening approve", "File architect"); graph.AddCondition("File lawyer", "Review 1"); graph.AddCondition("File lawyer", "Review 2"); graph.AddCondition("File lawyer", "Review 3"); graph.AddCondition("File lawyer", "Review 4"); graph.AddCondition("File architect", "Review 1"); graph.AddCondition("File architect", "Review 2"); graph.AddCondition("File architect", "Review 3"); graph.AddCondition("File architect", "Review 4"); graph.AddIncludeExclude(false, "File architect", "Review 1"); graph.AddIncludeExclude(false, "File lawyer", "Review 2"); graph.AddCondition("Fill out application", "Screening approve"); graph.AddCondition("Fill out application", "Screening reject"); graph.AddResponse("Fill out application", "Payout"); graph.AddCondition("Review 3", "Approve application"); graph.AddCondition("Review 4", "Approve application"); graph.AddCondition("Review 3", "Reject application"); graph.AddCondition("Review 4", "Reject application"); graph.AddCondition("Inform approve", "Payout"); graph.AddCondition("Inform approve", "Receive end report"); graph.AddResponse("Approve application", "Set pre-approved"); graph.AddIncludeExclude(true, "Set pre-approved", "Abort application"); graph.AddCondition("Payout", "Receive end report"); graph.AddMileStone("Payout", "Receive end report"); graph.AddIncludeExclude(false, "Round approved", "Set pre-approved"); graph.AddResponse("Round approved", "Approve application"); graph.AddResponse("Round approved", "Reject application"); graph.AddResponse("Round approved", "Set pre-approved"); graph.AddResponse("Account no changed", "Approve account no"); graph.AddCondition("Account no changed", "Approve account no"); graph.AddMileStone("Approve account no", "Payout"); graph.AddIncludeExclude(false, "Payout", "Abort application"); graph.AddIncludeExclude(false, "Payout", "Account no changed"); graph.AddIncludeExclude(true, "Reject application", "Inform reject"); graph.AddCondition("Approve application", "Set pre-approved"); graph.AddCondition("Approve application", "Inform approve"); graph.AddIncludeExclude(false, "Inform approve", "Review 1"); graph.AddIncludeExclude(false, "Inform approve", "Review 2"); graph.AddIncludeExclude(false, "Inform approve", "Review 3"); graph.AddIncludeExclude(false, "Inform approve", "Review 4"); graph.AddIncludeExclude(false, "Inform approve", "Approve application"); graph.AddIncludeExclude(false, "Inform approve", "Reject application"); graph.AddIncludeExclude(false, "Inform approve", "Note decision"); graph.AddIncludeExclude(false, "Inform approve", "Abort application"); graph.AddCondition("Inform approve", "Payout"); graph.AddCondition("Inform approve", "Receive end report"); graph.AddResponse("Approve application", "Set pre-approved"); graph.AddCondition("Payout", "Receive end report"); graph.AddMileStone("Payout", "Receive end report"); graph.AddResponse("Approve application", "Payout"); graph.AddIncludeExclude(true,"Approve application", "Approve account no"); graph.AddIncludeExclude(true, "Set pre-approved", "Approve account no"); graph.AddIncludeExclude(false, "Receive end report", "Guard"); graph.AddIncludeExclude(false, "Inform reject", "Guard"); graph.AddCondition("Guard","Guard"); graph.AddCondition("Guard", "End"); graph.AddResponse("Fill out application","End"); return graph; }
public void GetConditionsTest() { var dcr = new DcrGraph(); var nested = new DcrGraph(); nested.AddActivities(new Activity("C", ""), new Activity("D", "")); nested.AddCondition("C", "D"); var nestedAct = new Activity("N", "", nested); dcr.AddActivities(new Activity("A", ""), new Activity("B", ""), nestedAct); dcr.AddCondition("A", "B"); var allConditions = dcr.GetConditions(); Assert.AreEqual(2, allConditions.Count); }
public void SomeTestForFindingTracesBeforeAfterStuff() { var dcr = new DcrGraph(); dcr.AddActivities(new Activity("A", "A"), new Activity("B", "B"), new Activity("C", "C")); dcr.AddCondition("A", "B"); dcr.AddCondition("A", "C"); dcr.AddCondition("B", "C"); dcr.SetIncluded(true, "A"); dcr.SetIncluded(true, "B"); dcr.SetIncluded(true, "C"); dcr.SetPending(true, "C"); var traceFinder = new UniqueTraceFinder(new ByteDcrGraph(dcr)); dcr = dcr.Copy(); dcr.RemoveCondition("A", "B"); traceFinder = new UniqueTraceFinder(new ByteDcrGraph(dcr)); }
public void SimplicityOnNestedGraph() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true}; var activityC = new Activity("C", "somename3") { Included = true }; var activityD = new Activity("D", "somename4") { Included = false }; var activityE = new Activity("E", "somename5") { Included = false }; var activityF = new Activity("F", "somename6") { Included = false }; dcrGraph.AddActivities(activityA, activityC, activityD, activityE, activityF); //ingoing relations dcrGraph.AddCondition(activityA.Id, activityC.Id); dcrGraph.AddCondition(activityA.Id, activityD.Id); dcrGraph.AddCondition(activityA.Id, activityE.Id); dcrGraph.AddCondition(activityC.Id, activityE.Id); //inside nested relation dcrGraph.AddIncludeExclude(true, activityC.Id, activityD.Id); dcrGraph.AddIncludeExclude(true, activityD.Id, activityE.Id); dcrGraph.AddIncludeExclude(true, activityE.Id, activityF.Id); //outgoing relation dcrGraph.AddIncludeExclude(false, activityA.Id, activityA.Id); dcrGraph.AddIncludeExclude(false, activityC.Id, activityC.Id); dcrGraph.AddIncludeExclude(false, activityD.Id, activityD.Id); dcrGraph.AddIncludeExclude(false, activityE.Id, activityE.Id); //F can be run more than once dcrGraph.MakeNestedGraph(new HashSet<Activity>() { activityC, activityD, activityE }); var log = new Log(); log.AddTrace(new LogTrace('A', 'C', 'D', 'E', 'F')); log.AddTrace(new LogTrace('A', 'C', 'D', 'E', 'E')); //S1 = amount of relations (9) / amount of possible relations n=6 (4n^2 - 3n = 126) = 9/126 //S2 = amount of coupled relations (9) / possible coupled relations (n^2 = 36) = 0,25 //S3 = amount of pending activities 1 / all activities (5) = 0,2 (pending activities should not count the nested graph) const double totalRelationsPart = (1.0 - 9.0 / 126.0) / 2; // 50 % weight const double relationCouplesPart = (1.0 - 9.0 / 21.0) / 2; // 50 % weight const double pendingPart = (1.0 / 5.0) * 0.1; // 10 % possible negative weight const double nestedPart = (1.0 / 5) * 0.2; // 20 % possible negative weight //expecting simplicity: 1 - ((9/126)*0,45 + 0,25*0,45 + 0,2 * 0,10) const double expected = (totalRelationsPart + relationCouplesPart - pendingPart - nestedPart) * 100.0; var qd = UlrikHovsgaardAlgorithm.QualityMeasures.QualityDimensionRetriever.Retrieve(dcrGraph, log); Assert.AreEqual(expected, qd.Simplicity); }
public void RetrieveSimplicityTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true }; var activityB = new Activity("B", "somename2") { Included = false }; dcrGraph.AddActivities(activityA, activityB); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); var log = new Log(); //log does not matter for simplicity log.AddTrace(new LogTrace('A', 'B')); log.AddTrace(new LogTrace('A', 'B', 'C')); log.AddTrace(new LogTrace('A', 'B', 'C')); log.AddTrace(new LogTrace('A', 'B', 'C', 'A')); //S1 = amount of relations (1) / amount of possible relations (4n^2 - 3n = 10) = 0,10 //S2 = amount of coupled relations (1) / possible coupled relations (n^2 = 4) = 0,25 //S3 = amount of pending activities 1 / all activities (2) = 0,5 //expecting simplicity: (1.0 - 1 / 10) / 2 + (1.0 - 1 / 3) / 2 - (1 / 2) * 0.1 var qd = UlrikHovsgaardAlgorithm.QualityMeasures.QualityDimensionRetriever.Retrieve(dcrGraph, log); Assert.AreEqual(((1.0 - 1.0 / 10.0) / 2 + (1.0 - 1.0 / 3.0) / 2 - (1.0 / 2.0) * 0.1) * 100.0, qd.Simplicity); }
public void RetrievePrecisionTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true }; var activityB = new Activity("B", "somename2") { Included = false }; var activityC = new Activity("C", "somename3") { Included = false }; dcrGraph.AddActivities(activityA, activityB, activityC); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityB.Id, activityC.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityA.Id); dcrGraph.AddIncludeExclude(false, activityB.Id, activityB.Id); var log = new Log(); log.AddTrace(new LogTrace('A', 'B')); log.AddTrace(new LogTrace('A', 'B', 'C')); log.AddTrace(new LogTrace('A', 'B', 'C')); //duplicate trace should not matter log.AddTrace(new LogTrace('A', 'B', 'C', 'A')); //illegal execution should count down log.AddTrace(new LogTrace('A', 'B', 'C', 'A', 'A')); //this one should not matter, as we've already seen A been illegally executed from this state. //legal activities executed pr. state = 3 // divided by illegal executed activities (1) + legal activities that could be executed (3 + 1) (c could be executed again.) //expecting precision 3/5 = 60% var qd = UlrikHovsgaardAlgorithm.QualityMeasures.QualityDimensionRetriever.Retrieve(dcrGraph, log); Assert.AreEqual(60d, qd.Precision); }
public void RetrieveFitnessTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true}; var activityB = new Activity("B", "somename2") { Included = false }; var activityC = new Activity("C", "somename3") { Included = false }; dcrGraph.AddActivities(activityA,activityB,activityC); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityB.Id, activityC.Id); dcrGraph.AddIncludeExclude(false, activityA.Id, activityA.Id); dcrGraph.AddIncludeExclude(false, activityB.Id, activityB.Id); var log = new Log(); log.AddTrace(new LogTrace('A', 'B')); log.AddTrace(new LogTrace('A','B','C')); log.AddTrace(new LogTrace('A', 'B', 'C')); //duplicate trace should still count log.AddTrace(new LogTrace('A', 'B', 'C', 'A')); //illegal trace should count down //expecting fitness = 75% var qd = UlrikHovsgaardAlgorithm.QualityMeasures.QualityDimensionRetriever.Retrieve(dcrGraph, log); Assert.AreEqual(75d,qd.Fitness); }
public void OriginalLogStatisticsGraphMeasures() { var originalLog = new List<LogTrace> { new LogTrace('A', 'B', 'E'), new LogTrace('A', 'C', 'F', 'A', 'B', 'B', 'F'), new LogTrace('A', 'C', 'E'), new LogTrace('A', 'D', 'F'), new LogTrace('A', 'B', 'F', 'A', 'B', 'E'), new LogTrace('A', 'C', 'F'), new LogTrace('A', 'B', 'F', 'A', 'C', 'F', 'A', 'C', 'E'), new LogTrace('A', 'B', 'B', 'B', 'F'), new LogTrace('A', 'B', 'B', 'E'), new LogTrace('A', 'C', 'F', 'A', 'C', 'E') }; var apriori = new DcrGraph(); apriori.AddActivities(new Activity("A", "nameA"), new Activity("B", "nameB"), new Activity("C", "nameC"), new Activity("E", "nameE"), new Activity("F", "nameF")); apriori.SetIncluded(true, "A"); apriori.SetIncluded(false, "B"); apriori.SetIncluded(false, "C"); apriori.SetIncluded(false, "E"); apriori.SetIncluded(false, "F"); apriori.AddResponse("A", "B"); apriori.AddResponse("A", "C"); apriori.AddResponse("A", "E"); apriori.AddResponse("A", "F"); apriori.AddResponse("B", "E"); // self-excludes apriori.AddIncludeExclude(false, "A", "A"); apriori.AddIncludeExclude(false, "C", "C"); apriori.AddIncludeExclude(false, "E", "E"); apriori.AddIncludeExclude(false, "F", "F"); apriori.AddIncludeExclude(true, "A", "B"); apriori.AddIncludeExclude(true, "A", "C"); apriori.AddIncludeExclude(true, "F", "A"); apriori.AddIncludeExclude(true, "B", "E"); apriori.AddIncludeExclude(true, "B", "F"); apriori.AddIncludeExclude(true, "C", "E"); apriori.AddIncludeExclude(true, "C", "F"); apriori.AddIncludeExclude(false, "B", "C"); apriori.AddIncludeExclude(false, "C", "B"); apriori.AddIncludeExclude(false, "E", "B"); apriori.AddIncludeExclude(false, "E", "F"); apriori.AddIncludeExclude(false, "F", "E"); apriori.AddIncludeExclude(false, "F", "B"); Console.WriteLine(QualityDimensionRetriever.Retrieve(apriori, new Log { Traces = originalLog })); Console.ReadLine(); }
public void ParseMortgageApplication2() { var graph = new DcrGraph(); graph.AddActivities(new Activity("Collect Documents", "Collect Documents") { Included = true, Roles = "Caseworker" }); graph.AddIncludeExclude(false, "Collect Documents", "Collect Documents"); graph.AddActivities(new Activity("Irregular neighbourhood", "Irregular neighbourhood") { Included = true, Roles = "it" }); graph.AddIncludeExclude(false, "Irregular neighbourhood", "Irregular neighbourhood"); graph.AddActivities(new Activity("Make appraisal appointment", "Make appraisal appointment") { Included = true, Roles = "Mobile consultant" }); graph.AddIncludeExclude(false, "Make appraisal appointment", "Make appraisal appointment"); graph.AddActivities(new Activity("Appraisal audit", "Appraisal audit") { Included = true, Roles = "Auditor" }); graph.AddIncludeExclude(false, "Appraisal audit", "Appraisal audit"); graph.AddActivities(new Activity("On-site appraisal", "On-site appraisal") { Included = true, Roles = "Mobile consulant" }); graph.AddIncludeExclude(false, "On-site appraisal", "On-site appraisal"); graph.AddActivities(new Activity("Submit budget", "Submit budget") { Included = true, Roles = "Customer" }); graph.AddIncludeExclude(false, "Submit budget", "Submit budget"); graph.AddActivities(new Activity("Budget screening approve", "Budget screening approve") { Included = true, Pending = true, Roles = "Intern" }); graph.AddIncludeExclude(false, "Budget screening approve", "Budget screening approve"); graph.AddActivities(new Activity("Statistical appraisal", "Statistical appraisal") { Included = true, Roles = "Caseworker" }); graph.AddIncludeExclude(false, "Statistical appraisal", "Statistical appraisal"); graph.AddActivities(new Activity("Assess loan application", "Assess loan application") { Included = true, Pending = true, Roles = "Caseworker" }); graph.AddIncludeExclude(false, "Assess loan application", "Assess loan application"); graph.AddCondition("Collect Documents", "Irregular neighbourhood"); graph.AddCondition("Collect Documents", "Make appraisal appointment"); graph.AddCondition("Collect Documents", "On-site appraisal"); graph.AddCondition("Collect Documents", "Statistical appraisal"); graph.AddIncludeExclude(false, "Statistical appraisal", "Irregular neighbourhood"); graph.AddIncludeExclude(false, "Statistical appraisal", "Make appraisal appointment"); graph.AddIncludeExclude(false, "Statistical appraisal", "On-site appraisal"); graph.AddIncludeExclude(false, "Irregular neighbourhood","Statistical appraisal"); graph.AddIncludeExclude(false, "Make appraisal appointment","Statistical appraisal" ); graph.AddIncludeExclude(false, "On-site appraisal","Statistical appraisal"); graph.AddCondition("Irregular neighbourhood", "Make appraisal appointment"); graph.AddCondition("Make appraisal appointment", "On-site appraisal"); graph.AddCondition("On-site appraisal", "Submit budget"); graph.AddCondition("Submit budget", "Budget screening approve"); graph.AddCondition("Budget screening approve", "Assess loan application"); graph.AddCondition("Assess loan application","Appraisal audit"); graph.AddCondition("Statistical appraisal", "Submit budget"); var nested = new HashSet<Activity>(); nested.Add(graph.GetActivity("Irregular neighbourhood")); nested.Add(graph.GetActivity("Make appraisal appointment")); nested.Add(graph.GetActivity("On-site appraisal")); graph.MakeNestedGraph(nested); //LogGenerator9001 logGenerator9001 = new LogGenerator9001(20, graph); //Log log = new Log(); //foreach (var trace in logGenerator9001.GenerateLog(500)) //{ // log.AddTrace(trace); //} using (StreamWriter sw = new StreamWriter("C:/Downloads/mortgageStrict.xml")) { sw.WriteLine(graph.ExportToXml()); } }
public void PrecisionOnNestedGraph() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true }; var activityB = new Activity("B", "somename2") { Included = false }; var activityC = new Activity("C", "somename3") { Included = true }; var activityD = new Activity("D", "somename4") { Included = false }; var activityE = new Activity("E", "somename5") { Included = false }; var activityF = new Activity("F", "somename6") { Included = false }; dcrGraph.AddActivities(activityA, activityB, activityC, activityD, activityE, activityF); //ingoing relations dcrGraph.AddCondition(activityA.Id, activityC.Id); dcrGraph.AddCondition(activityA.Id, activityD.Id); dcrGraph.AddCondition(activityA.Id, activityE.Id); dcrGraph.AddCondition(activityC.Id, activityE.Id); dcrGraph.AddIncludeExclude(true, activityC.Id, activityD.Id); dcrGraph.AddIncludeExclude(true, activityD.Id, activityE.Id); dcrGraph.AddIncludeExclude(true, activityE.Id, activityF.Id); //outgoing relation dcrGraph.AddIncludeExclude(false, activityA.Id, activityA.Id); dcrGraph.AddIncludeExclude(false, activityC.Id, activityC.Id); dcrGraph.AddIncludeExclude(false, activityD.Id, activityD.Id); dcrGraph.AddIncludeExclude(false, activityE.Id, activityE.Id); //F can be run more than once dcrGraph.MakeNestedGraph(new HashSet<Activity>() { activityC, activityD, activityE }); var log = new Log(); log.AddTrace(new LogTrace('A', 'C', 'D', 'E', 'F')); // we don't execute 'F' twice log.AddTrace(new LogTrace('A', 'C', 'D', 'E', 'E')); //we illegally execute E //legal activities executed pr. state = 5 // divided by illegal executed activities (1) + legal activities that could be executed (5 + 1) (F could be executed again.) //expecting precision 5/7 var qd = UlrikHovsgaardAlgorithm.QualityMeasures.QualityDimensionRetriever.Retrieve(dcrGraph, log); Assert.AreEqual((5d/7d)*100, qd.Precision); }
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 GetNestedActivityTest() { 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.AddCondition(activityE.Id, activityF.Id); //outgoing relation //ingoing relations 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 retrievedActivity = dcrGraph.GetActivity(activityC.Id); Assert.AreEqual(activityC.ToString(), retrievedActivity.ToString()); }
public void GetRelationCountTest() { DcrGraph dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true }; var activityB = new Activity("B", "somename2") { Included = true }; var activityC = new Activity("C", "somename3") { Included = false }; dcrGraph.AddActivities(activityA, activityB, activityC); dcrGraph.AddIncludeExclude(true, activityA.Id, activityB.Id); dcrGraph.AddIncludeExclude(true, activityB.Id, activityC.Id); dcrGraph.AddIncludeExclude(false, activityB.Id, activityB.Id); dcrGraph.AddCondition(activityB.Id, activityC.Id); //non-sensical condition dcrGraph.AddCondition(activityB.Id, activityB.Id); dcrGraph.AddMileStone(activityA.Id, activityC.Id); dcrGraph.AddResponse(activityA.Id, activityC.Id); Assert.AreEqual(6, dcrGraph.GetRelationCount); }
public void RetrieveTest() { var dcrGraph = new DcrGraph(); var activityA = new Activity("A", "somename1") { Included = true, Pending = true }; var activityB = new Activity("B", "somename2") { Included = false }; var activityC = new Activity("C", "somename3") { Included = true }; dcrGraph.AddActivities(activityA, activityB, activityC); dcrGraph.AddResponse(activityB.Id, activityC.Id); var img = GraphImageRetriever.Retrieve(dcrGraph).Result; Assert.IsNotNull(img); }