Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description and Specifications : You have decided to use a simulation to determine two things about a bank: 1) Which method of lining up in

Description and Specifications: You have decided to use a simulation to determine two things about a bank: 1) Which method of lining up in banks (and other establishments) is better: a) a single queue that feeds all of the tellers or b) an individual queue at each teller. 2) How many tellers you should have working in your bank. You will use a discrete-event simulation for your test, in which you will 'generate' customers at random and keep track of their progress through two fictitious banks, SQBank, Inc. and MultiBank, Ltd. You may assume each bank has K tellers on the job, and that SQBank uses a single queue to feed all K tellers, while MultiBank uses K queues, one for each teller. Each bank opens at 8AM and closes to new customers at 4PM (i.e. is open for 8 hours). However, customers already in the bank at 4PM will be allowed to complete their transactions.

Your goal is to determine the following for each customer at each bank: 1) customer # (order customer was generated) 2) time upon arrival at the bank (time customer is generated see Implementation Details). 3) time required for transaction (in minutes see Implementation Details) 4) whether or not the customer stays at the bank (yes or no; if the answer is no, do not calculate any of the values below. For details on how to decide, see Implementation Details) 5) queue id [-1 if customer does not have to wait, or value from 0 to K-1] 6) teller id who serves customer [value from 0 to K-1] 7) time service begins for customer 8) time customer waits for service [item 7 item 2] 9) time service ends for customer 10) total time of customer in the bank [item 9 item 2] This information should be output for each customer at the end of your simulation. In addition, you must determine the following for each bank: 1) The number of Queues being used (could be either 1 or K) 2) The maximum number of customers who can be waiting in line at the same time 3) The specified customer arrival rate (per hr) 4) The specified mean service time (in min) 5) The total number of customers generated 6) The total number of customers served 7) The total number of customers turned away due to long lines (see Implementation Details) For the remaining items below, do NOT count the customers that left the bank without being served. 8) The number of customers who had to wait before being served 9) The average wait time spent by all customers in the bank (in min) (see Implementation Details) 10) The maximum wait time for any customer in the bank (in min) 11) The 1st standard deviation of the wait time for all customers in the bank (see Implementation Details) 12) The average service time of customers (measured, in min) 13) The average wait time spent by customers who had to wait (in min) 14) The average time in the system for all customers (in min).

Execution / Runs / Input / Output Note that in the main program, Assig1.java, the SimBank objects are initialized with several arguments, most of which are input by the user: ntell = number of tellers true / false = whether or not to use a single queue hrs = hours the simulation will run arr_rate = rate of customer arrivals per hour t_min = average transaction time in minutes maxq = maximum number of customers waiting (not being serviced) seed = random seed to initialize RandDist object You should run the Assig1 program 5 times. Note that for each run, 2 SimBank objects are created, one with a single queue (true) and one with multiple queues (false). The following values should be the same for all 4 runs: hrs = 8, arr_rate = 30, t_min = 6, maxq = 10, seed = 80. The ntell value should change with each run, going from 1 to 5. In other words, you will run the simulation 5 times for each bank, with the only difference in the runs being the number of tellers. Note: When ntell = 1, the results for both of your banks should be identical. Your program output should contain a list of all of the customers who were served by the bank and another list of all of the customers who did not stay in the bank. The information for each customer should be that specified in the Description section of this document. For an example of the output see file "a1-out2.txt" on the Assignments page. Since your program will generate a lot of output for each run it will be helpful for analysis and grading for the output to be sent to a file. This can be done in a very easy way using redirection from the command prompt. In this way, you can write all of your output to standard output and see it as it is generated during program development. Then when you are ready to do your official runs, you can send them to files. This can be done in the following way: java Assig1 > a1-out1.txt The statement above will send all output from the program to file a1-out1.txt. Use the following names for your output files: a1-out1.txt 1 teller a1-out2.txt 2 tellers a1-out3.txt 3 tellers a1-out4.txt 4 tellers a1-out5.txt 5 tellers All of these output files must be included in your .zip submission file. Note that when you redirect the output to a file, you will also not see the prompts for input when the program is initialized (since they will also go to the file). The input will still work you just need to remember which values to enter at each point in the program initialization.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

7CS 0445 Spring 2019 //Simply a subclass with a constructor, and tostring,but no other // methods. // This subclass is simply to distinguish it from other event types public class ArrivalEvent extends SimEvent public ArrivalEvent (double new_time) super (new time); public String tostring () return "ArrivalEvent:"+ e time; CS 0445 Spring 2019 // Another subclass of SimEvent public class CompletionEvent extends SimEvent public CompletionEvent (double new time) super (new_time) public String tostring () return "CompletionEvent: "+ e time; CS 0445 Spring 2019 // This subclass of CompletionEvent allows the event to store // an index -which will correspond to the teller in which /7 the event occurs. You will use this for Assignment 1. The // idea is that a CompletionLocEvent will be generated for each // customer when the customer is "waited on" at a specific teller. public class CompletionLocEvent extends CompletionEvent private int location; public CompletionLocEvent (double new_time, int loc) super (new_time) location-loc public int getLoc return location public String tostring return super.toString +" at location"+ location; 7CS 0445 Spring 2019 // This will allow exponentially distributed values to be // generated. To see how it is used also see handout RandTest.java import java.util.Random; import java.lang.Math; public class RandDist // Use a Random object to generate the underlying pseudo-random // values. We will then transform these into the distribution that // we want (i.e. exponential) private Random R public RandDist (long seed) // The seed value is what initializes the pseudo-random sequence. // If two Random objects are initilialized with the same seed, and // if the same methods are called for both, they will produce // identical pseudo-random sequences Rnew Random (seed); // Transform U (0,1) (i.e. the uniform distribution from 0 to 1, which // is basically nextDouble ()) into the exponential distribution using the // inverse transform technique You may look this up if you wish but // for our purposes we can abstract this implementation out of our /I view public double exponential (double lambda) double rVal R.nextDouble ) double mean1/1ambda; double nextran-mean Math.log (rVal) return nextran; cs 0445 Spring 2019 /I simple demonstration of using a class to generate // exponentially distributed arrivals Also demonstrates // seeding a generator to reproduce a consistent set of // pseudo-random values // You will use this distribution to generate arrivals /1 for Assignment 1. import java.util. public class RandTest public static void main (String [ args) Scanner inScannew Scanner (System.in) System.out.print("Enter rate in arrivals per hour:") double lambda = inscan. next Double() ; // The above value for lambda is the arrival rate, which will // be passed as an argument to the exponential ) function. System.out.print ("Enter number of trials:") int numinScan.nextInt O // Run this program using usind the same value for both seeds and // different values for the seed You should see that if the same // seed is used the identical results will occur for both calls. On // the other hand, if different seeds are used the results should be // similar but not identical System.out.print ("Enter a seed:" long seed1 = nscan.nextLong(); System.out.print ("Enter another seed: " long seed2inScan.nextLong) testDist (num, seedl, lambda) testDist (num, seed2, lambda) public static void testDist (int reps, long seed, double lambda) // The average time between arrivals will be 1/1ambda However, // with an exponential distribution there is a lot of variance in // the actual arrival gaps double goa IAve = l/lambda; double goalMingoalAve 60; double total-0, calcAve, calcMin; RandDist Rnew RandDist (seed); for (int i = 0; protected double e_time: 17 Time when event was generated public SimEvent (double new_time) e time- new time; public double get e time () return e time // This method will allow events to be ordered (ex: via a 7PriorityQueue) public int compareTo (SimEvent right) double diff = e-time - right .e-time ; if (Math.abs (diff) protected double e_time: 17 Time when event was generated public SimEvent (double new_time) e time- new time; public double get e time () return e time // This method will allow events to be ordered (ex: via a 7PriorityQueue) public int compareTo (SimEvent right) double diff = e-time - right .e-time ; if (Math.abs (diff)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

When is it appropriate to use a root cause analysis

Answered: 1 week ago

Question

=+j Describe how EU directives impact IHRM.

Answered: 1 week ago

Question

=+and reduction in force, and intellectual property.

Answered: 1 week ago