CS 302 - Data Structures

Fall 2016

Programming Assignment 5: Event Simulation

Due on Tuesday, November 15 at 4:00 pm

Programming Problem 6 and 7 on Page 413-414. Remember that Section 13.4 provides details of how to implement simulations.

Note that, problem 7 has three variations of queues that are small modifications to the previous one.

  1. Single queue for one teller
  2. Three queue for three tellers (events take turn in the order of arrival or enter the shortest line)
  3. Single queue for three tellers
  4. [Bonus 1 points] Single queue with arbitrary number of tellers
  5. [Bonus 1 points] Arbitrary number of queues with a teller for each

Implement both the array and linked list version of the data structures.

Randomly generate 99,999 events with a random start time from the same range (i.e., from 0 to 100,000) and a duration in the range of 1 to 100 to be used as the input to the simulation. Note that the input file should be the same when different queue methods are compared.

You should first generate 99,999 random values for event start time (from a range of 0 to 100,000) and then sort them. Then, for each you can independently determine how long the event is for (random value from range of 1 to 100). These values should be written into a file that will be later read by simulator.

The following output should be provided for an average of 10 simulations for each of the simulation in a table:

  1. the total simulation time (in terms of CPU time)
  2. the total processing time (in terms of virtual time)
  3. the average wait time
  4. the maximum wait time
  5. the average length of the line
  6. the maximum length of the line
  7. the total idle time of each teller

Note: You can only use (i.e., copy) code from the book and slides. You need to develop the rest of the code yourself.

Deliverables: (as source code or a doc or pdf file)

  1. Source code for your classes (one for each data structure)
  2. Doxygen reports for code documentation
  3. A main file that tests the classes with randomly generated data
  4. Test output of your codes (i.e., result table with average of 10 runs)

Teaching Assistant: Iman Vakili

What to turn in: A softcopy of your sourcecode and reports should be uploaded to WebCampus. Combine the files in a single zip file.