You must write a program which models the operation of a shop using Discrete Event simulation:
The shop has several servers, each of which has a different level of efficiency. This is measured by a time multiplier ei which differs for each server si and works as follows:
If server i with efficiency ei serves customer j with service time tj the actual time taken to serve the customer is: ei x tj.
For example, if server 5 has an efficiency of 1.2 and customer 7 has a service time of 5.0 then server 5 takes a time of 6.0 to serve customer 7.
The input file contains the following information.
- The number of servers. You may assume a maximum of 20 servers.
- For each server: the efficiency of the server.
- Arrival records consisting of the arrival time and service time of each customer.
Your program should:
- Read the name of the text file from the console.
- Read the information related to each server.
- Read and process the customer arrival data.
Note:
- There is a single queue of customers.
- Each customer will be served by the server with the best available efficiency (the smallest value) from the available idle servers.
- The servers are all initially idle.
- Customers must be served in the order in which they arrive.
- You should not attempt to read in all the arrival data at the start of the simulation.
At the end of the simulation, when the last customer in the file has been served, your program should print out the following information:
- The number of customers served.
- The time at which the last customer completed service.
- The greatest length reached by the queue.
- The average length of the queue.
- The average time spent by a customer in the queue. (If a customer is served immediately, their queue time is 0.0).
- For each server:
- The number of customers they served
- The time they spent idle.
You must choose appropriate data structures and algorithms to accomplish this task.
Note: A sample input file test.txt is provided for you to test your program. A larger text file may be used for final assessment.
You must submit two files:
- Your program source file ass2.ext where .ext will be one of .c, .cpp, .java and .py
- A report in file report2.pdf containing an explanation of the data structures and algorithms you have used and your reasons for using them.
submit -u user -c CSCI203 -a 2 ass2.ext ass2.pdf
where: user your unix userid and ext is the appropriate extension of your program.
Note: All programs submitted must compile and run on banshee. The following commands will be used to test your program.
C gcc ass2.c -o ass2
ass2
C++ g++ ass2.cpp -o ass2 ass2
Java javac ass2.java java ass2
Python python ass2.py
It is your responsibility to ensure that your program compiles and runs correctly.
Reviews
There are no reviews yet.