public void AnalyzeCyclePetriNetTest()
        {
            // Arrange
            RelationMatrix originalMatrix = MakeCycleNetRelationMatrix();
            IPetriNet      originalNet    = MakeCycleNetPetriNet();

            // Act
            RelationMatrix matrix = PetriNetAnalyzer.MakeRelationMatrix(originalNet);

            // Assert
            Assert.AreEqual(5, matrix.Activities.Count);
            foreach (string act in matrix.Activities)
            {
                Assert.IsTrue(originalMatrix.Activities.Contains(act));
            }
            Assert.AreEqual(1, matrix.StartActivities.Count);
            Assert.IsTrue(matrix.StartActivities.Contains("a"));
            Assert.AreEqual(1, matrix.EndActivities.Count);
            Assert.IsTrue(matrix.EndActivities.Contains("e"));

            foreach (string actI in matrix.Activities)
            {
                foreach (string actJ in matrix.Activities)
                {
                    Assert.AreEqual(originalMatrix.Footprint[originalMatrix.ActivityIndices[actI], originalMatrix.ActivityIndices[actJ]],
                                    matrix.Footprint[matrix.ActivityIndices[actI], matrix.ActivityIndices[actJ]]);
                }
            }
        }
Beispiel #2
0
        public void CompareEasyPetriNetWithSameMatrixTest()
        {
            // Arrange
            RelationMatrix matrixA = MakeEasyRelationMatrix();
            IPetriNet      net     = MakeEasyPetriNet();
            RelationMatrix matrixB = PetriNetAnalyzer.MakeRelationMatrix(net);

            // Act
            double fitness = FootprintComparer.Compare(matrixA, matrixB);

            // Assert
            Assert.AreEqual(1.0, fitness);
        }