How to keep track of markings in a Petri net
1 view (last 30 days)
Show older comments
I am writing some code for a class assignment that determines the reachable states for a petri net. The net is fully conservative so there are no dominant nodes, but there may be repeats. I have come up with some basic code that determines the next states based on a given state.(See below) Now I am trying to figure out how to keep track of the paths (the tree)
Any advice or tips?
Thanks!
%B (Incident Matrix) of plant and controller
%M0 is initial condition
%initial values
p=0; Mk=zeros(12,1);M=zeros(12,1);
% This loop tests each transition, and adds to list if fireable
for k=1:1:12
Mk=M0+Bc(:,k);% Mk is M0 + kth column of Bc
C=(Mk>=0); %C is test vector, returns 1 for elements >=0
if(all(C)) % if all elements in Mk are non-neg
p=p+1; %increment p
M(:,p)=Mk; %Add to the Marking List
end
end
M %display M
0 Comments
Answers (0)
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!