public void TestBifurcatingTransition() // a bifurcating transition { var m = new Marking(3, new Dictionary <int, int> { { (int)Places.p1, 0 }, { (int)Places.p2, 0 }, { (int)Places.p3, 0 } }); var p = CreatePetriNet.Parse(StdPetriNets.Bifurcation).CreateNet <GraphPetriNet>(); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 0 }, { "p2", 0 }, { "p3", 0 } }); m.Set(p.Places, "p1", 1); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 1 }, { "p2", 0 }, { "p3", 0 } }); m = p.Fire(m); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 0 }, { "p2", 1 }, { "p3", 1 } }); }
public void TestMultiEnabledPetriNet() { var m = new Marking(4, new Dictionary <int, int> { { (int)Places.p1, 0 }, { (int)Places.p2, 0 }, { (int)Places.p3, 0 }, { (int)Places.p4, 0 } }); var p = CreatePetriNet.Parse(StdPetriNets.MultiEnabled).CreateNet <GraphPetriNet>(); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 0 }, { "p2", 0 }, { "p3", 0 }, { "p4", 0 } }); m.Set(p.Places, "p1", 1); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 1 }, { "p2", 0 }, { "p3", 0 }, { "p4", 0 } }); m = p.Fire(m); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 0 }, { "p2", 1 }, { "p3", 0 }, { "p4", 0 } }); m = p.Fire(m); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 0 }, { "p2", 0 }, { "p3", 1 }, { "p4", 0 } }); m.Set(p.Places, "p4", 1); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 0 }, { "p2", 0 }, { "p3", 1 }, { "p4", 1 } }); m = p.Fire(m); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 0 }, { "p2", 1 }, { "p3", 1 }, { "p4", 0 } }); m = p.Fire(m); m.Assert(p.Places, new Dictionary <string, int> { { "p1", 0 }, { "p2", 0 }, { "p3", 2 }, { "p4", 0 } }); }