Return-Path: william@bourbon.usc.edu
Delivery-Date: Sat Sep 16 00:48:16 2006
X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on merlot.usc.edu
X-Spam-Level:
X-Spam-Status: No, score=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,
NO_REAL_NAME autolearn=ham version=3.1.3
Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75])
by merlot.usc.edu (8.13.5/8.13.5) with ESMTP id k8G7mGfK013135
for ; Sat, 16 Sep 2006 00:48:16 -0700
Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1])
by bourbon.usc.edu (8.13.5/8.13.5) with ESMTP id k8G7lRx1027699
for ; Sat, 16 Sep 2006 00:47:27 -0700
Message-Id: <200609160747.k8G7lRx1027699@bourbon.usc.edu>
To: cs551@merlot.usc.edu
Subject: Re: CS551: statistics calculation
Date: Sat, 16 Sep 2006 00:47:27 -0700
From: william@bourbon.usc.edu
Someone wrote:
> For the project we need to calculate the average number of
> customers at Q1 (S1 and S2).
>
> Again, putting the example (sorry for repeating).
>
> Total simulation time = 10s
> customer c1 was in the queue between time 1s and 3s
> customer c2 was in the queue between time 2s and 4s
> customer c3 was in the queue between time 7s and 8s
>
> Average number of Customers at Q1 = (2 + 1 + 1) s/10s = 0.4
>
> Is this is what the you expect the output to be? If yes,
> then we can figure out the time from the code where we do
> incrementing and decrementing.
>
> c3 | x-----x
> c2 | x-----------x
> c1 | x----------x
> |
> |__1__2__3__4__5__6__7__8__9__10
>
>
> From the above figure, out of 10 seconds, only 4 seconds
> people were in Queue. All the other time, people were served
> by the servers.
>
> Again for S1
> Total time is 10 seconds
> customer c1 was served by s1 and it took 2 seconds.
> customer c2 was served by s1 and it took 3 seconds.
> Average number of customers at S1 = 5 / 10 = 0.5
In my previous messages, I have suggested two ways to get the
statistics right. There may be more ways. Like before, you
should convince yourself that what you are doing is correct
and your code matches what you are thinking.
--
Bill Cheng // bill.cheng@usc.edu
----- Original Message -----
From: william@bourbon.usc.edu
Date: Friday, September 15, 2006 11:59 pm
Subject: Re: CS551: statistics calculation
To: cs551@merlot.usc.edu
> Someone wrote:
>
> > So, do we have to take periodic samples of the queue to calculate
> > this?
>
> You should *not* sample it. Since you are simulating it, you
> know exactly when these events (queue size incrementing or
> decrementing) happens.
>
> > I'm little bit confused about generating an algorithm to
> > compute this.
>
> You should look at the picture and figure out a way to
> get the right statistics.
>
> > Consider for example, the total simulation time is 10 seconds and
> > we have 3 customers.
> >
> > customer c1 was in the queue between time 1 and 3
> > customer c2 was in the queue between time 2 and 4
> > customer c3 was in the queue between time 7 and 8
> >
> > The average time = 2 + 1 + 1 / 10 = 4/10 = 0.4?
> >
> > Is this the way to calculate this?
>
> So you are calculating the average time a customer spends at
> Q1? This is very different from the average number of
> customers at Q1. (The units are different to begin with.)
>
> If c1 spends 2, c2 spends 2, and c3 spends 1 unit of time at
> Q1, then the average time a customer spends at Q1 is
> (2+2+1)/3=1.667.
>
> In your example, it looks like:
>
> |
> 2 + +----+
> | | |
> 1 + +----+ +----+ +----+
> | | | | |
> 0 +----+----+----+----+----+----+----+----+-> time
> 0 1 2 3 4 5 6 7 8
>
> The average number customers at Q1 is like you calculated
> because the area under the curve is 4 and the total
> simulation time is 10. So, your calculation is correct, but
> you gave it the wrong label.
>
> > In case of S1 and S2 it is little bit easy as there is no time
> > overlap (a server can serve only one customer at a time).
> > For example,
> >
> > customer c1 was served by s1 and it took 2 seconds.
> > customer c2 was served by s1 and it took 3 seconds.
> >
> > Average time at S1 = 5 / 10 = 0.5?
> >
> > Please advice.
>
> Here you are calculating the average time a customer spends
> at S1. This has a unit of time. And it should be (2+3)/2=1.5.
>
> The average number customers at S1 is 0.5 because the area
> under the curve is 5 and the total simulation time is 10.
> So, your calculation is correct, but you gave it the wrong
> label again.
> --
> Bill Cheng // bill.cheng@usc.edu
>
>
>
>
>
>
>
> ----- Original Message -----
> From: william@bourbon.usc.edu
> Date: Friday, September 15, 2006 10:51 pm
> Subject: Re: CS551: statistics calculation
> To: cs551@merlot.usc.edu
>
> > Someone wrote:
> >
> > > Could you please provide some hint in calculating the average
> > > number of customers in Q1 (and s1 and s2)? Do we need to
> consider > > the overlapping time (say customer is in the queue
> from time 1-5,
> > > and customer 2 is in the queue from 2-7 etc)?
> >
> > In your example, you can plot the number of customers in Q1
> > vs. time and it should look like the following:
> >
> > |
> > 2 + +--------------+
> > | | |
> > 1 + +----+ +---------+
> > | | |
> > 0 +----+----+----+----+----+----+----+--> time
> > 0 1 2 3 4 5 6 7
> >
> > If simulation ends at time 8, then the average number of
> > customers at Q1 is the area under the above curve divided by
> > the total time which is 9/8=1.125.
> >
> > You can do the same plot with S1 (and S2). The only
> > difference is that the number of customers at S1 only
> > goes between 0 and 1.
> > --
> > Bill Cheng // bill.cheng@usc.edu
> >
> >
> >
> > ----- Original Message -----
> > From: william@bourbon.usc.edu
> > Date: Friday, September 8, 2006 2:53 pm
> > Subject: Re: CS551: statistics calculation
> > To: cs551@merlot.usc.edu
> >
> > > Someone wrote:
> > >
> > > > Since the poisson distribution only corresponds to only
> > inter-
> > > arrival > times and service times, I'm not sure how to
> > calculate
> > > the following
> > > > statistics:
> > > > Let me know if the following assumptions are correct. And
> > how to
> > > > calculate 3 & 4.
> > > > 1. customer drop probability =
> (number of
> > > > customers dropped / total number of customers) ?
> > >
> > > This is correct.
> > >
> > > > 2. average number of customers in Q1 =
> (number of
> > > > customers/size of Q1) ?
> > >
> > > This is not correct. If 50% of the time Q1 is empty,
> > > 30% of the time Q1 has 1 customer, and 20% of the time
> > > Q1 has 2 customers, then the average number of customers
> > > in Q1 is:
> > >
> > > 0.5 * 0 + 0.3 * 1 + 0.2 * 2 = 0.7
> > >
> > > > 3. average number of customers at S1 =
> > > > 4. average number of customers at S2 =
> > >
> > > If 60% of the time S1 is empty and 40% of the time
> > > S1 has 1 customer, then the average number of customers
> > > at S1 is:
> > >
> > > 0.6 * 0 + 0.4 * 1 = 0.4
> > >
> > > This is the same as saying the probability that S1
> > > is busy or the utilization of S1.
> > > --
> > > Bill Cheng // bill.cheng@usc.edu
> > >