Assignment #3


For this assignment you will do a little book work and a little programming. First, do the following questions from chapter 5.

3, 5, 9

Now for the coding aspect of the assignment. For this assignment I want you to write a petri-net simulator. Notice that this is a simulator so there are delay times attached to firings. If at any time there are two or more transitions that could fire, randomly pick on and queue it to fire (removing markers) then check again if there are other transitions that could fire. Your simulation should take a configuration file with the following format.

# of places
for each place have starting marker count, # of outgoing arrows to transitions, and a list of numbers for the transitions (zero referenced)
# of transitions
for each transition have the firing delay time, # of outgoing arrows to places, and a list of the number of the places it goes to (zero referenced)

You need to give the user some way to control the running of the simulation and you can use this format to output the state for the system when the user wants the state output (like at the end of the simulation).

For extra credit, make your program draw the petri-net as it is being simulated.

Here is a sample petri-net input file for a single teller queue.