Java Reference
In-Depth Information
event-driven simulation
13.2
Let us return to the bank simulation problem described in the introduction.
Here, we have a system in which customers arrive and wait in line until one of
k tellers is available. Customer arrival is governed by a probability distribu-
tion function, as is the service time (the amount of time to be served once a
teller becomes available). We are interested in statistics such as how long on
average a customer has to wait and what percentage of the time tellers are
actually servicing requests. (If there are too many tellers, some will not do
anything for long periods.)
With certain probability distributions and values of k , we can compute
these answers exactly. However, as k gets larger the analysis becomes consid-
erably more difficult and the use of a computer to simulate the operation of
the bank is extremely helpful. In this way, bank officers can determine how
many tellers are needed to ensure reasonably smooth service. Most simula-
tions require a thorough knowledge of probability, statistics, and queueing
theory.
13.2.1 basic ideas
A discrete event simulation consists of processing events. Here, the two
events are (1) a customer arriving and (2) a customer departing, thus freeing
up a teller.
We can use a probability function to generate an input stream consisting
of ordered pairs of arrival and service time for each customer, sorted by
arrival time. 3 We do not need to use the exact time of day. Rather, we can use
a quantum unit, referred to as a tick.
The tick is the
quantum unit of
time in a simulation.
In a discrete time-driven simulation we might start a simulation clock at zero
ticks and advance the clock one tick at a time, checking to see whether an event
occurs. If so, we process the event(s) and compile statistics. When no customers
are left in the input stream and all the tellers are free, the simulation is over.
The problem with this simulation strategy is that its running time does not
depend on the number of customers or events (there are two events per cus-
tomer in this case). Rather, it depends on the number of ticks, which is not
really part of the input. To show why this condition is important, let us change
the clock units to microticks and multiply all the times in the input by
1,000,000. The simulation would then take 1,000,000 times longer.
A discrete time-
driven simulation
processes each
unit of time con-
secutively. It is inap-
propriate if the
interval between
successive events
is large.
3. The probability function generates interarrival times (times between arrivals), thus guaran-
teeing that arrivals are generated chronologically.
 
 
 
Search WWH ::




Custom Search