public void MakeHardDependencyMatrixFromSuccessorMatrix() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); SuccessorMatrix successorMatrix = new SuccessorMatrix(wlog); //Act DependencyMatrix dependencyMatrix = new DependencyMatrix(successorMatrix); //Assert Assert.AreEqual(successorMatrix.Activities.Count, dependencyMatrix.L1LDependencyMatrix.Length); //Each dependency is in range <-1, 1> foreach (var dependency in dependencyMatrix.DirectDependencyMatrix) { Assert.IsTrue(dependency >= -1 && dependency <= 1); } Assert.IsTrue(dependencyMatrix.L1LDependencyMatrix[0] > 0.9 && dependencyMatrix.L1LDependencyMatrix[0] < 1); //Check L2L dependency on BCB and CBC Assert.IsTrue(dependencyMatrix.L2LDependencyMatrix[1, 2] > 0.9 && dependencyMatrix.L2LDependencyMatrix[1, 2] < 1); Assert.IsTrue(dependencyMatrix.L2LDependencyMatrix[2, 1] > 0.9 && dependencyMatrix.L2LDependencyMatrix[2, 1] < 1); }
public void MakeDependencyMatrixFromSuccessorMatrix() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(heuristicCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); SuccessorMatrix successorMatrix = new SuccessorMatrix(wlog); // Act DependencyMatrix dependencyMatrix = new DependencyMatrix(successorMatrix); // Assert Assert.AreEqual(successorMatrix.Activities.Count, dependencyMatrix.L1LDependencyMatrix.Length); for (int i = 0; i < 4; i++) { Assert.IsTrue(dependencyMatrix.L1LDependencyMatrix[i] == 0); } //1 self loop with dependency 0.8 Assert.IsTrue(dependencyMatrix.L1LDependencyMatrix[4] == 0.8); foreach (var dependency in dependencyMatrix.L2LDependencyMatrix) { Assert.IsTrue(dependency == 0); } //Each dependency is in range <-1, 1> foreach (var dependency in dependencyMatrix.DirectDependencyMatrix) { Assert.IsTrue(dependency >= -1 && dependency <= 1); } }
public void MakeEasyPetriNetTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(easyCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); RelationMatrix matrix = new RelationMatrix(wlog); IPetriNet exampleNet = MakeEasyPetriNet(); // Act IPetriNet madeNet = Alpha.MakePetriNet(matrix); // Assert Assert.IsNotNull(exampleNet); Assert.AreEqual(exampleNet.EndPlace.Id, madeNet.EndPlace.Id); Assert.AreEqual(exampleNet.StartPlace.Id, madeNet.StartPlace.Id); Assert.AreEqual(exampleNet.Places.Count, madeNet.Places.Count); Assert.AreEqual(exampleNet.Transitions.Count, madeNet.Transitions.Count); foreach (IPlace p in exampleNet.Places) { Assert.IsTrue(madeNet.Places.Exists(a => a.Id == p.Id)); } foreach (ITransition t in exampleNet.Transitions) { Assert.IsTrue(madeNet.Transitions.Exists(a => a.Id == t.Id && a.Activity == t.Activity && a.InputPlaces.Count == t.InputPlaces.Count && a.OutputPlaces.Count == t.OutputPlaces.Count)); } }
public void MakeSuccessorMatrixFromHardEventLogTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); var expectedSuccessor = MakeExpectedHardSuccessorMatrix(); var expectedL2L = MakeExpectedHardL2LMatrix(); var expectedLong = MakeExpectedLongDistance(); //Act SuccessorMatrix successorMatrix = new SuccessorMatrix(wlog); Assert.AreEqual(expectedSuccessor.GetLength(0), successorMatrix.Activities.Count); CollectionAssert.AreEqual(expectedSuccessor, successorMatrix.DirectMatrix); CollectionAssert.AreEqual(expectedL2L, successorMatrix.L2LMatrix); CollectionAssert.AreEqual(new int[] { 129, 130, 130, 57, 100, 57, 100, 43, 43 }, successorMatrix.ActivityOccurrences); CollectionAssert.AreEqual(expectedLong, successorMatrix.LongDistanceMatrix); Assert.AreEqual(1, successorMatrix.StartActivities.Count); Assert.AreEqual(1, successorMatrix.EndActivities.Count); Assert.AreEqual("a", successorMatrix.StartActivities.First()); Assert.AreEqual("i", successorMatrix.EndActivities.First()); }
public void CSVImportInvalidTest() { // Arrange string path = "." + separator + "thisFileDoesNotExist.csv"; // Act and Assert Assert.ThrowsException <ArgumentException>(() => CSVImport.MakeDataFrame(path)); }
public void SimpleDependencyGraphWithL1LLoop() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(heuristicCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); var successorMatrix = new SuccessorMatrix(wlog); // Act HeuristicMinerSettings settings = new HeuristicMinerSettings { L1LThreshold = 0.7 }; DependencyGraph dependencyGraph = new DependencyGraph(successorMatrix, settings); // Assert Assert.AreEqual(successorMatrix.Activities.Count, dependencyGraph.Activities.Count); var start = successorMatrix.ActivityIndices[successorMatrix.StartActivities.First()]; var end = successorMatrix.ActivityIndices[successorMatrix.EndActivities.First()]; Assert.AreEqual(start, dependencyGraph.StartActivity); Assert.AreEqual(end, dependencyGraph.EndActivity); Assert.IsTrue(dependencyGraph.LongDependencies.Count == 0); //NO INPUT FOR START ACT Assert.IsTrue(dependencyGraph.InputActivities[start].Count == 0); //NO OUTPUT FOR END ACT Assert.IsTrue(dependencyGraph.OutputActivities[end].Count == 0); //ARCS CORRECT IN Assert.IsTrue(dependencyGraph.InputActivities[1].SetEquals(new HashSet <int> { 2, 3, 4 })); Assert.IsTrue(dependencyGraph.InputActivities[2].SetEquals(new HashSet <int> { 0 })); Assert.IsTrue(dependencyGraph.InputActivities[3].SetEquals(new HashSet <int> { 0 })); //SELF LOOP Assert.IsTrue(dependencyGraph.InputActivities[4].SetEquals(new HashSet <int> { 0, 4 })); //ARCS CORRECT OUT Assert.IsTrue(dependencyGraph.OutputActivities[0].SetEquals(new HashSet <int> { 2, 3, 4 })); Assert.IsTrue(dependencyGraph.OutputActivities[2].SetEquals(new HashSet <int> { 1 })); Assert.IsTrue(dependencyGraph.OutputActivities[3].SetEquals(new HashSet <int> { 1 })); //SELF LOOP Assert.IsTrue(dependencyGraph.OutputActivities[4].SetEquals(new HashSet <int> { 1, 4 })); }
private RelationMatrix MakeVeryHardRelationMatrix() { ImportedEventLog elog = CSVImport.MakeDataFrame(veryHardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); return(new RelationMatrix(wlog)); }
public void CSVImportValidSemicolonSeparatorTest() { // Arrange ImportedEventLog importedEventLog; // Act importedEventLog = CSVImport.MakeDataFrame(CSVPathSemicolon, separatorsString: ";"); // Assert Assert.IsNotNull(importedEventLog); }
public void CSVImportValidDefinedCultureTest() { // Arrange ImportedEventLog importedEventLog; // Act importedEventLog = CSVImport.MakeDataFrame(CSVPath, culture: "en-US"); // Assert Assert.IsNotNull(importedEventLog); }
public void CSVImportValidTest() { // Arrange ImportedEventLog importedEventLog; // Act importedEventLog = CSVImport.MakeDataFrame(CSVPath); // Assert Assert.IsNotNull(importedEventLog); }
public void CSVImportValidNoInferenceTest() { // Arrange ImportedEventLog importedEventLog; // Act importedEventLog = CSVImport.MakeDataFrame(CSVPath, inferTypes: false); // Assert Assert.IsNotNull(importedEventLog); Assert.AreEqual(importedEventLog.Contents.GetRow <string>(0).GetAt(0), "1"); }
public void CSVImportValidNoHeadersTest() { // Arrange ImportedEventLog importedEventLog; // Act importedEventLog = CSVImport.MakeDataFrame(CSVPath, hasHeaders: false); // Assert Assert.IsNotNull(importedEventLog); Assert.AreEqual(importedEventLog.Contents.GetRow <string>(0).GetAt(0), "id"); }
public void CSVImportValidLimitedRowsTest() { // Arrange ImportedEventLog importedEventLog; // Act importedEventLog = CSVImport.MakeDataFrame(CSVPath, maxRows: 2); // Assert Assert.IsNotNull(importedEventLog); Assert.AreEqual(importedEventLog.Contents.RowCount, 2); }
public void ImportedEventLogSetInvalidValuesTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(timestampedCsv); // Act and assert Assert.IsFalse(elog.SetActivity("thisIsNotValidActivity")); Assert.IsFalse(elog.SetCaseId("thisIsNotValidCaseId")); Assert.IsFalse(elog.SetTimestamp("thisIsNotValidTimestamp")); Assert.IsNull(elog.Activity); Assert.IsNull(elog.CaseId); Assert.IsNull(elog.Timestamp); }
public void MakeCNetHardLongDistanceSettings() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); // Act HeuristicMinerSettings settings = new HeuristicMinerSettings { UseLongDistance = true }; CNet causalNet = HeuristicMiner.MineCNet(wlog, settings); // Assert Assert.AreEqual(2, causalNet.LongDependencies.Count); Assert.AreEqual(0, causalNet.StartActivity.Id); Assert.AreEqual(6, causalNet.EndActivity.Id); //ACTIVITY OCCURRENCE Assert.AreEqual(9, causalNet.Activities.Count); Assert.AreEqual(129, causalNet.Activities[0].Frequency); Assert.AreEqual(130, causalNet.Activities[1].Frequency); Assert.AreEqual(130, causalNet.Activities[2].Frequency); Assert.AreEqual(57, causalNet.Activities[3].Frequency); Assert.AreEqual(100, causalNet.Activities[4].Frequency); Assert.AreEqual(57, causalNet.Activities[5].Frequency); Assert.AreEqual(100, causalNet.Activities[6].Frequency); Assert.AreEqual(43, causalNet.Activities[7].Frequency); Assert.AreEqual(43, causalNet.Activities[8].Frequency); //BINDINGS Assert.AreEqual(1, causalNet.InputBindings[0].Count); Assert.AreEqual(2, causalNet.InputBindings[1].Count); Assert.AreEqual(1, causalNet.InputBindings[2].Count); Assert.AreEqual(1, causalNet.InputBindings[3].Count); Assert.AreEqual(2, causalNet.InputBindings[4].Count); Assert.AreEqual(1, causalNet.InputBindings[5].Count); Assert.AreEqual(2, causalNet.InputBindings[6].Count); Assert.AreEqual(1, causalNet.InputBindings[7].Count); Assert.AreEqual(1, causalNet.InputBindings[8].Count); Assert.AreEqual(2, causalNet.OutputBindings[0].Count); Assert.AreEqual(1, causalNet.OutputBindings[1].Count); Assert.AreEqual(3, causalNet.OutputBindings[2].Count); Assert.AreEqual(1, causalNet.OutputBindings[3].Count); Assert.AreEqual(2, causalNet.OutputBindings[4].Count); Assert.AreEqual(1, causalNet.OutputBindings[5].Count); Assert.AreEqual(0, causalNet.OutputBindings[6].Count); Assert.AreEqual(1, causalNet.OutputBindings[7].Count); Assert.AreEqual(1, causalNet.OutputBindings[8].Count); }
public void CompareLogWithAccordingPetriNetTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); RelationMatrix matrix = new RelationMatrix(wlog); IPetriNet madeNet = Alpha.MakePetriNet(matrix); // Act double fitness = Computations.ComputeFitness(elog, madeNet); // Assert Assert.AreEqual(1.0, fitness); }
public void ComputeWorstAlignmentOnHardModel() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); PetriNet petriNet = CNetUtils.ConvertCNetToPetriNet(HeuristicMiner.MineCNet(wlog)); // Act var cost = AlignmentUtils.ComputeWorstCostOfModel(petriNet, 1); // Assert Assert.AreEqual(7, cost); }
public void MakeCNetEasyCustomSettings() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(heuristicCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); var successorMatrix = new SuccessorMatrix(wlog); // Act HeuristicMinerSettings settings = new HeuristicMinerSettings { DependencyThreshold = 0.7, RelativeToBestThreshold = 0.15, L1LThreshold = 0.7 }; CNet causalNet = HeuristicMiner.MineCNet(wlog, settings); // Assert Assert.AreEqual(0, causalNet.StartActivity.Id); Assert.AreEqual(1, causalNet.EndActivity.Id); //ACTIVITY OCCURRENCE Assert.AreEqual(5, causalNet.Activities.Count); Assert.AreEqual(40, causalNet.Activities[0].Frequency); Assert.AreEqual(40, causalNet.Activities[1].Frequency); Assert.AreEqual(21, causalNet.Activities[2].Frequency); Assert.AreEqual(21, causalNet.Activities[3].Frequency); Assert.AreEqual(17, causalNet.Activities[4].Frequency); //Number of bindings Assert.AreEqual(0, causalNet.InputBindings[0].Count); //NEW ARC A->C Assert.AreEqual(5, causalNet.InputBindings[1].Count); Assert.AreEqual(1, causalNet.InputBindings[2].Count); Assert.AreEqual(1, causalNet.InputBindings[3].Count); //NEW ARC D->D Assert.AreEqual(2, causalNet.InputBindings[4].Count); //NEW ARC A->C Assert.AreEqual(5, causalNet.OutputBindings[0].Count); Assert.AreEqual(0, causalNet.OutputBindings[1].Count); Assert.AreEqual(1, causalNet.OutputBindings[2].Count); Assert.AreEqual(1, causalNet.OutputBindings[3].Count); //NEW ARC D->D Assert.AreEqual(2, causalNet.OutputBindings[4].Count); //A&B BIND FREQUENCY Assert.AreEqual(20, causalNet.OutputBindings[0].First(u => u.Activities.Count == 2).Frequency); Assert.AreEqual(20, causalNet.InputBindings[1].First(b => b.Activities.Count == 2).Frequency); }
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); }
public void AlignmentOnTraceHard() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); PetriNet pNet = CNetUtils.ConvertCNetToPetriNet(HeuristicMiner.MineCNet(wlog)); // Act (EACH TRACE FITS TO THE MODEL) foreach (var trace in wlog.WorkflowTraces) { var alignment = new AlignmentOnTrace(trace, pNet); //Assert Assert.AreEqual(1, alignment.Fitness); Assert.AreEqual(0, alignment.OptimalCost); } }
public void CompareMildlyTamperedLogWithHardPetriNetTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); RelationMatrix matrix = new RelationMatrix(wlog); IPetriNet madeNet = Alpha.MakePetriNet(matrix); ImportedEventLog tamperedLog = CSVImport.MakeDataFrame(tamperedHardCsv); tamperedLog.SetActivity("act"); tamperedLog.SetCaseId("id"); // Act double fitness = Computations.ComputeFitness(tamperedLog, madeNet); // Assert Assert.AreEqual(96, (int)(fitness*100)); }
public void ConvertEasyCNetToPetriNetTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(heuristicCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); CNet causalNet = new CNet(wlog, new HeuristicMinerSettings()); // Act PetriNet petriNet = CNetUtils.ConvertCNetToPetriNet(causalNet); // Assert Assert.AreEqual("p0", petriNet.StartPlace.Id); Assert.AreEqual("p" + (2 * causalNet.EndActivity.Id + 1), petriNet.EndPlace.Id); Assert.AreEqual(10, petriNet.Places.Count); Assert.AreEqual(13, petriNet.Transitions.Count); // 8 invisible transitions Assert.AreEqual(8, petriNet.Transitions.Count(t => t.Invisible)); }
public void ConvertHardCNetToPetriNetTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); CNet causalNet = HeuristicMiner.MineCNet(wlog); // Act PetriNet petriNet = HeuristicMiner.MinePetriNet(wlog); // Assert Assert.AreEqual("p0", petriNet.StartPlace.Id); Assert.AreEqual("p" + (2 * causalNet.EndActivity.Id + 1), petriNet.EndPlace.Id); Assert.AreEqual(18, petriNet.Places.Count); Assert.AreEqual(21, petriNet.Transitions.Count); // 12 invisible transitions Assert.AreEqual(12, petriNet.Transitions.Count(t => t.Invisible)); }
public void AlignmentOnTraceHardNoL2LLoop() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); PetriNet pNet = CNetUtils.ConvertCNetToPetriNet(HeuristicMiner.MineCNet(wlog, new HeuristicMinerSettings() { L2LThreshold = 1 })); // Act unfitting trace abcbcdfgi (deleted L2L loop B->C->B) var alignment = new AlignmentOnTrace(wlog.WorkflowTraces[61], pNet); // Assert Assert.AreEqual(0.875, alignment.Fitness); // two moves (model and trace) for B and one for C Assert.AreEqual(2, alignment.OptimalCost); }
public void WorkflowLogBasicTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(easyCsv); elog.SetActivity("act"); elog.SetCaseId("id"); // Act WorkflowLog wlog = new WorkflowLog(elog); // Assert Assert.AreEqual(wlog.WorkflowTraces[0].CaseId, "1"); Assert.AreEqual(wlog.WorkflowTraces[1].CaseId, "2"); Assert.AreEqual(wlog.WorkflowTraces[0].Activities[0], "a"); Assert.AreEqual(wlog.WorkflowTraces[0].Activities[1], "b"); Assert.AreEqual(wlog.WorkflowTraces[0].Activities[2], "c"); Assert.AreEqual(wlog.WorkflowTraces[1].Activities[0], "a"); Assert.AreEqual(wlog.WorkflowTraces[1].Activities[1], "d"); Assert.AreEqual(wlog.WorkflowTraces[1].Activities[2], "c"); }
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); }
public void MakeCNetEasyDefaultSettings() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(heuristicCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); var successorMatrix = new SuccessorMatrix(wlog); // Act CNet causalNet = HeuristicMiner.MineCNet(wlog); // Assert Assert.AreEqual(0, causalNet.StartActivity.Id); Assert.AreEqual(1, causalNet.EndActivity.Id); //ACTIVITY OCCURRENCE Assert.AreEqual(5, causalNet.Activities.Count); Assert.AreEqual(40, causalNet.Activities[0].Frequency); Assert.AreEqual(40, causalNet.Activities[1].Frequency); Assert.AreEqual(21, causalNet.Activities[2].Frequency); Assert.AreEqual(21, causalNet.Activities[3].Frequency); Assert.AreEqual(17, causalNet.Activities[4].Frequency); //Number of bindings Assert.AreEqual(0, causalNet.InputBindings[0].Count); Assert.AreEqual(4, causalNet.InputBindings[1].Count); Assert.AreEqual(1, causalNet.InputBindings[2].Count); Assert.AreEqual(1, causalNet.InputBindings[3].Count); Assert.AreEqual(1, causalNet.InputBindings[4].Count); Assert.AreEqual(4, causalNet.OutputBindings[0].Count); Assert.AreEqual(0, causalNet.OutputBindings[1].Count); Assert.AreEqual(1, causalNet.OutputBindings[2].Count); Assert.AreEqual(1, causalNet.OutputBindings[3].Count); Assert.AreEqual(1, causalNet.OutputBindings[4].Count); //A&B BIND FREQUENCY Assert.AreEqual(20, causalNet.OutputBindings[0].First(u => u.Activities.Count == 2).Frequency); Assert.AreEqual(20, causalNet.InputBindings[1].First(b => b.Activities.Count == 2).Frequency); }
public void AlignmentOnTraceEasy() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(heuristicCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); PetriNet pNet = CNetUtils.ConvertCNetToPetriNet(HeuristicMiner.MineCNet(wlog)); // Act // trace "AE" -> Doesn't fit var traceAlignment1 = new AlignmentOnTrace(wlog.WorkflowTraces[0], pNet); // trace "ACBE" fits perfectly var traceAlignment2 = new AlignmentOnTrace(wlog.WorkflowTraces[10], pNet); // Assert Assert.AreEqual(0.8, traceAlignment1.Fitness); Assert.AreEqual(1, traceAlignment1.OptimalCost); Assert.AreEqual(1, traceAlignment2.Fitness); Assert.AreEqual(0, traceAlignment2.OptimalCost); }
public void MakeRelationMatrixFromEventLogTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(easyCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); List <string> exampleActivities = new List <string>() { "a", "b", "c", "d" }; Relation[,] exampleFootprint = MakeEasyRelationMatrix(); // Act RelationMatrix matrix = new RelationMatrix(wlog); // Assert Assert.AreEqual(matrix.Activities.Count, 4); for (int i = 0; i < matrix.Activities.Count; i++) { Assert.AreEqual(exampleActivities[i], matrix.Activities[i]); Assert.AreEqual(i, matrix.ActivityIndices[matrix.Activities[i]]); } Assert.AreEqual(1, matrix.StartActivities.Count); Assert.IsTrue(matrix.StartActivities.Contains("a")); Assert.AreEqual(1, matrix.EndActivities.Count); Assert.IsTrue(matrix.EndActivities.Contains("c")); for (int i = 0; i < matrix.Activities.Count; i++) { for (int j = 0; j < matrix.Activities.Count; j++) { Assert.AreEqual(exampleFootprint[i, j], matrix.Footprint[i, j]); } } }
public void MakeSuccessorMatrixFromEventLogTest() { // Arrange ImportedEventLog elog = CSVImport.MakeDataFrame(heuristicCsv); elog.SetActivity("act"); elog.SetCaseId("id"); WorkflowLog wlog = new WorkflowLog(elog); var expectedSuccessor = MakeExpectedSuccessorMatrix(); // Act SuccessorMatrix successorMatrix = new SuccessorMatrix(wlog); // Assert Assert.AreEqual(expectedSuccessor.GetLength(1), successorMatrix.Activities.Count); CollectionAssert.AreEqual(expectedSuccessor, successorMatrix.DirectMatrix); CollectionAssert.AreEqual(new int[5, 5], successorMatrix.L2LMatrix); CollectionAssert.AreEqual(new int[] { 40, 40, 21, 21, 17 }, successorMatrix.ActivityOccurrences); Assert.AreEqual(1, successorMatrix.StartActivities.Count); Assert.AreEqual(1, successorMatrix.EndActivities.Count); Assert.AreEqual("a", successorMatrix.StartActivities.First()); Assert.AreEqual("e", successorMatrix.EndActivities.First()); }