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. 1. The number of servers. You may assume a maximum of 20 servers. 2. For each server: the efficiency of the server. 3. Arrival records consisting of the arrival time and service time of each customer. Your program should: 1. Read the name of the text file from the console. 2. Read the information related to each server. 3. Read and process the customer arrival data. Note: 1. There is a single queue of customers. 2. Each customer will be served by the server with the best available efficiency (the smallest value) from the available idle servers. 3. The servers are all initially idle. 4. Customers must be served in the order in which they arrive. 5. 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: 1. The number of customers served. 2. The time at which the last customer completed service. 3. The greatest length reached by the queue. 4. The average length of the queue. 5. The average time spent by a customer in the queue. (If a customer is served immediately, their queue time is 0.0). 6. For each server: a. The number of customers they served b. 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. 2 Marking Guide: 1. Programs submitted must work! A program which fails to compile or run will receive a mark of zero. 2. There will be a 4-mark deduction for using STL, or equivalent libraries, rather than coding the data structures yourself. 3. A program which produces the correct output will receive a minimum of 50%. 4. Additional marks beyond this will be awarded for the appropriate use of data structures and the efficiency of the program at processing the input and producing the output. 5. Programs which lack clarity, both in code and comments, will lose marks. You must submit two files: 1. Your program source file ass2.ext where .ext will be one of .c, .cpp, .java and .py 2. 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.
Get Free Quote!
357 Experts Online