rep23

Upload: jose-stevens

Post on 04-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 rep23

    1/4

    H0: The data points are independent.

    Ha: Not H0

    P Value = 0.4883

    Thus H0 cannot be rejected.

    From the above two i.e. correlation plot and LB test we conclude that the observations are

    independent and hence proceed to fit a distribution.

    Fitting a distribution:

    From the histogram and the value of coefficient of variation, which is computed as 0.995, we narrowdown to exponential and weibull distributions.

    The maximum likelihood estimates of the respective parameters are as follows.

    Distribution Shape parameter Scale parameter

    We go with exponential distribution because of the error generated in R due to indeterminacy.

    Hence our distribution is exponential with the above parameter.

    Goodness of Fit:

    Goodness of fit is tested with Kolmogorov Smirnov test (KS test) due to the following advantages of

    the KS test.

    Non necessity of grouping the data Exactly valid for any sample size n. More powerful than chi-square test.

    H0: The observations are from the hypothesized distribution i.e. fit is good

    Ha: Not H0

    P Value = 0.8383

    Hence null hypothesis cannot be rejected.

    The fit is good enough.

  • 7/30/2019 rep23

    2/4

    Simulation:

    Given:

    There are 3 classes of customers. 20% of the customers are in class A, 40% in class B and the

    remaining 40% in class C. The service time distribution of each class is given. Customers of class A

    and B are to go in to one queue and class C to another queue.

    The minimum number of tellers is to be used. Hence we use one teller for both the queues. This

    teller essentially shuttles between the two counters. The priority is also given as class C>B>A.

    Approach in coding:

    In order to segregate the customers in to three classes, we make use of uniform (0, 1)random variates. As and when each customer is generated we generate a uniform (0,1)

    random variate. If that is less than 0.2 we classify the customer as class A, if between 0.2 and

    0.6 class B and greater than 0.6 class C. This is in keeping with the required percentage

    under each class.

    We use the distribution obtained by fitting the data points and generate the inter arrivaltimes for the customers from that distribution.

    Under customer class, three separate visit modules are activated, one for each class ofcustomers. These modules are Simulation is done for 5000 minutes.

    The code for question 1 is enclosed in the appendix.

    Average time a type A spends in the bank:

    Time spent by a customer in the bank = time in the queue + service time.

    Accordingly a monitor mA is initialized and the mean is taken. The same is replicated 50 times

    using seeds 100 to 150.

  • 7/30/2019 rep23

    3/4

    The 95% confidence interval for the same is (20.05467, 22.64498) minutes.

    Average time a type B spends in the bank:

    A monitor mB is initialized and the mean is taken. The same is replicated 50 times using seeds

    100 to 150.

    The 95% confidence interval for the same is (11.86976, 12.29478) minutes

    Average time a type C spends in the bank:

    A monitor mC is initialized and the mean is taken. The same is replicated 50 times using seeds

    100 to 150.

    The 95% confidence interval for the same is (13.61194, 14.18023) minutes

    The above three show that a type A customer spends the most time in the bank. This might be the

    reflection of the lowest priority accorded to him.

    Type C spending more time than B in spite of having a higher priority, may be because of the

    increased service time needed by Type C. The mean of C is 4.2 compared to a uniform (3,4)

    distribution for the service time needed by B

    Average time a type A spends in the queue:

    A monitor cA is initialized and mean is taken. A confidence interval is needed in such a way that

    the half-length is less than 5% of the mean. However 50 replications do not yield such a confidence

    interval. Hence we iteratively increase the number of replications. Finally doing 200 replications

    from seeds 100 to 300 yields a suitable confidence interval.

    The 95% confidence interval for the same is (17.02831, 18.50863) minutes

    Utilization of the teller:

    A monitor U is defined. This is assigned to 1 as soon as a customer enters service and 0 as soon as

    he leaves the counter. This is a measure of the time when the teller is occupied. The timeAverage

    of U is taken here as this is the area under the function defined as follows.

    B(t) = 1,

  • 7/30/2019 rep23

    4/4

    Testing with two tellers:

    As we can see from the one teller scenario, the queues do not build up indefinitely. We do a check

    with two tellers and find the utilization. This can be done by removing the teller resource

    definition from the code. SimPy, by default considers two tellers for two queues.

    Utilization is taken over 50 replications for two tellers. The 95% confidence interval is (0.5450356,

    0.5551337).

    Since the utilization is substantially lower we can conclude that having two tellers is not necessary.