예제 #1
0
        public void MakePetriNetFromTraceTest()
        {
            // Act
            var traceNet = AlignmentUtils.MakePNetFromTrace(MakeTrace());

            // Asserts
            Assert.AreEqual("p0'", traceNet.StartPlace.Id);
            Assert.AreEqual("p5'", traceNet.EndPlace.Id);
            Assert.AreEqual(6, traceNet.Places.Count);
            Assert.AreEqual(5, traceNet.Transitions.Count);
            //EACH TRANSITION HAS 1 INPUT AND OUTPUT
            foreach (var t in traceNet.Transitions)
            {
                Assert.AreEqual(1, t.InputPlaces.Count);
                Assert.AreEqual(1, t.OutputPlaces.Count);
            }
        }
예제 #2
0
        public void SyncNetAdvancedCustom()
        {
            // Arrange
            var trace = new WorkflowTrace("0");

            trace.Activities.Add("register");
            trace.Activities.Add("decide");
            trace.Activities.Add("register");
            trace.Activities.Add("send money");
            trace.Activities.Add("inform acceptance");
            var tNet = AlignmentUtils.MakePNetFromTrace(trace);

            List <ITransition> transitions = new List <ITransition>();
            List <IPlace>      places      = new List <IPlace>();

            for (int i = 1; i < 13; i++)
            {
                places.Add(new Place("p" + i));
            }

            transitions.Add(new Transition("t1", "register"));
            transitions[^ 1].InputPlaces.Add(places[0]);
예제 #3
0
        public void SyncNetHard()
        {
            // Arrange
            ImportedEventLog elog = CSVImport.MakeDataFrame(hardCsv);

            elog.SetActivity("act");
            elog.SetCaseId("id");
            WorkflowLog wlog = new WorkflowLog(elog);
            var         tNet = AlignmentUtils.MakePNetFromTrace(wlog.WorkflowTraces[23]);
            var         pNet = CNetUtils.ConvertCNetToPetriNet(HeuristicMiner.MineCNet(wlog));

            // Act
            var syncNet = new SynchronousProductNet(tNet, pNet);

            // Assert
            Assert.AreEqual(syncNet.Places.Count, pNet.Places.Count + tNet.Places.Count);
            Assert.AreEqual(pNet.Transitions.Count + 2 * tNet.Transitions.Count, syncNet.Transitions.Count);
            Assert.IsTrue(syncNet.EndPlaces.SetEquals(new HashSet <IPlace> {
                tNet.EndPlace, pNet.EndPlace
            }));
            Assert.IsTrue(syncNet.StartPlaces.SetEquals(new HashSet <IPlace> {
                tNet.StartPlace, pNet.StartPlace
            }));
        }