Anda di halaman 1dari 48

A

Very Simple
Discrete-Event Simulation
(using AnyLogic)

MIT Center for


Transportation & Logistics ctl.mit.edu
Problem: Boarding Pass Kiosks at Logan
Emait Airlines wants to install several automated kiosks at
Logan Airport, for passengers to print their boarding passes.
Passengers are expected to arrive at a rate of 30 per hour.
The area has capacity for about sixteen passengers to wait
in line for a kiosk to become available.
Once at the kiosk, it takes the passengers on average 5
minutes to print their boarding pass, with minimum of half a
minute and maximum of 15 minutes.
The kiosks are rather expensive, and come in pairs, so they
must be installed in multiples of two.
If they want their passengers to wait in queue on average
less than 1 minute, how many kiosks should Emait install?
2
01 - Create a new model
Open AnyLogic in your computer
Click on Create a model or on New > Model
Select the location of the model in your computer
Give the model a name
Specify the time unit for the model: minutes, in our case

3
02 Create a Source for passengers
We want to simulate passengers arriving to use the kiosks
at a rate of 30 passengers per hour.
In the Palette, select the Process Modeling Library, and
look for the Source icon.
Drag the source into the Main area.
Go into Properties, and rename the source FrontDoor or
some other name that you want.
Specify that arrivals are defined by Rate, with an arrival
rate of 30 per hour.

4
03 Create a Sink for passengers to exit
We want to simulate passengers leaving to go to the
boarding gates when they are done using the kiosks.
In the Palette, in the Process Modeling Library, look for
the Sink icon. Drag the sink into the Main area.
Rename the sink ToGates or some other name.
Connect the source and the sink with a connector: double
click the green dot on the source and then click the green
dot on the sink.

5
04 Specify the length of the simulation
We want the simulation to run for as long as we can get it to
run, as fast as we can get it to run. AnyLogics personal
learning edition allows us to have up to 50 thousand
agents, so we will not be able to run the simulation beyond
100 thousand minutes given the arrival rate of 30 per hour.

Click on the Projects tab.


Click on Simulation: Main.
In Execution mode, specify Virtual time
In Stop, select Stop at specified time
In Stop time, type 90000 (this will give us 90K minutes)

6
05 Run the model
Click on the green play icon (Run)
Click on the Run button.
Wait for the simulation to run.

You should see that:


~45 thousand passengers entered through the source
The exact same number of passengers exited via the sink

7
What is the distribution at the source?
When we created the source, we stated that arrivals
were defined by rate, with an arrival rate of 30 per hour.
This means that, on average, there are 30/60 = 0.5
arrivals per minute.
However, this does not mean that the arrivals occur as
clockwork, one every two minutes. While keeping the
arrivals at an average of 30 per hour, the software
simulates a variability in the time between arrivals.
This inter-arrival time is randomly chosen using a
probability distribution known as the exponential
distribution, with an average of 2 minutes between
arrivals (or 1/30 hours between arrivals).

8
Experiment #1: Redefine the source
For you to experience first hand the validity of this, lets
redefine the source in terms of the inter-arrival time.
Go to Main, and click on the Source.
Go to Properties, and change the arrival rate to:
0.5
and change the units to minutes. This specifies that the
source should have, on average, 0.5 arrivals per minute,
which is the same as 30 arrivals per hour, since 30/60=0.5
Run the model. Compare the result to the one before.
Notice that the number of passengers is the same.

9
Experiment #2: Redefine the source
Now, redefine the source in terms of inter-arrival time.
Go to Main, and click on the Source.
Go to Properties, and change the way the arrivals are
defined. Instead of Rate, select Interarrival time.
As the value for the Interarrival time, type:
exponential( 0.5 )

and change the units to minutes. This specifies that the


source has on average 0.5 arrivals per minute, with an
exponential distribution.
Run the model. Compare the result to the one before.
Notice that the number of passengers is the same.
10
06 Create a Delay for kiosk use
In our discrete-event simulation, using the kiosk is
included as a delay before passengers can proceed.
In the Palette, in the Process Modeling Library, look for
the Delay icon. Drag the delay into the Main area, at
some point between the source and the sink.
Rename the delay UseKiosk or some other name.
Define the delay time using a triangular distribution:
triangular( 0.5, 5, 15 )
in minutes.

11
06 Create a Delay (continued)
The capacity of the delay tells us how many people can
use the kiosks at the same time.
For now, lets make this value equal to 10, to specify that
we want to allow up to ten people using the kiosks at the
same time. For now, this is the same as saying that we
have ten kiosks available. This value will change, as we try
different number of kiosks in the solution.
Specify a capacity of:
10

12
Experiment #3: Are we there yet?
What would happen if you tried to run the model now?

13
07 Create a Queue for waiting
The passengers need a space to wait until the kiosk is
available for them to use. This is called a queue.
In the Palette, in the Process Modeling Library, look for
the Queue icon. Drag the queue into the Main area, at
some point between the source and the delay.
Rename the queue KioskLine or some other name.
Define the queue capacity as:
16

14
08 Run the model
Click on the green play icon (Run)
Click on the Run button.
Wait for the simulation to run.

You should see that:


~45 thousand passengers entered through the source
The exact same number of passengers exited via the sink

15
09 Lets measure time in the queue
We want to know how long people wait in the queue. For
this, we will use time measure start and end markers.
In the Palette, in the Process Modeling Library, look for
the Time Measure Start icon.
Drag it into the Main area, at some point between the
source and the queue.
Rename it stk (for start time kiosk) or anything else you
want..

16
09 Lets measure time (continued)
In the Palette, in the Process Modeling Library, look for
the Time Measure End icon.
Drag it into the Main area, at some point between the
queue and the delay. Rename it etk (for end time
kiosk) or anything else you want.
Click on this Time Measure End icon, and go to
Properties.
Specify stk as TimeMeasureStart blocks, by clicking on the
plus sign.

17
10 Run the model
Click on the green play icon (Run)
Click on the Run button.
Wait for the simulation to run.

When the simulation is done:


Click on the icon of the Time Measure End block (etk).
A yellow window will open, that shows the minimum,
average and maximum waits in the queue, among other
information. Notice that the mean wait in the queue is
around ~0.001 minutes. This is for the current capacity of
10 kiosks, and is really small.

18
Question: How many kiosks?
Even though our model is still very primitive, it is good
enough for us to answer the key question of the problem:
how many kiosks should we install if we want the average
waiting time to be less than 1 minute?
Since the current average waiting time in the queue is
much smaller than 1 minute, lets try with less kiosks.
What if we had 8, 6, 4, or 2 kiosks? Change the capacity
of the delay from 10 to these other values.
For a capacity of 8, the mean wait in queue is ~0.02 min
For a capacity of 6, the mean wait in queue is ~0.3 min
For a capacity of 4, we get an error when we run. (Why?)
The answer to the question is: We should install 6 kiosks.
19
Improving the model: Time Plot

20
Plotting the size of a queue in time
Currently, when our queue overflows, we get an error.
We can avoid getting these types of errors if we make the
queues capacity big enough. For example, if we make the
queue capacity 50,000, we will never get an error.
But how can we then know if the size of the queue is within
what is allowed?
One solution is to graph the size of the queue in time, and
examine it at the end of the run.

21
11 Create a Time Plot for queue size
We want to graph the size of the queue along time.
In the Palette, select the Analysis section, and look for
the Time Plot icon.
Drag the icon into the Main area, to the space where you
want the graph. Resize to the size you want.
Go into Properties, and in the Data section, click on the
green plus sign. This adds a line to the plot.
As a Title, type: Size of Kiosk Waiting Line.
As Value, type:
KioskLine.size()

Source: 3M, 2016 22


12 Change the queue capacity
Make the queue capacity as big as the total population,
e.g. 50000. This way, it is impossible for the passengers to
not fit in the queue, no matter what.

Source: 3M, 2016 23


13 Run the model
Click on the green play icon (Run)
Click on the Run button.
Wait for the simulation to run.

When the simulation is done:


Notice that the plot shows the size of the queue, but you
can only see the last few values. We have to scale the
plot properly if we want to see all the values.

24
14 Scaling the Time Plot
We want to scale the time plot, so that we can see all the
values.
Click on the plot, and go into Properties.
In Data Update, where it says Display up to, type 90000.
In Scale, where it says Time window, type 90000 and
select either minutes or model time units.
By the way, you can select a different color for the line. I
like Dodger Blue.

Source: 3M, 2016 25


15 Run the model
Click on the green play icon (Run)
Click on the Run button.
Wait for the simulation to run.

When the simulation is done:


Notice that the plot shows the size of the queue for all
the values.
If you run the model with a capacity of 4 kiosks, you will
see that the queue reaches sizes that exceed the capacity
of 16 stipulated by the problem. So 4 kiosks is not a
feasible solution. But now, we dont get an error!

26
Improving the model:
Resources and Utilization

27
Knowing the utilization of a resource
Currently, we dont know the utilization of our kiosks. If
knowing this utilization was important to us, we could
describe the kiosks as resources. We will do that in this
session.

28
16 Create a Resource Pool
First, lets create a resource pool for the kiosks.
In the Palette, select the Process Modeling Library
section, and look for the Resource Pool icon.
Drag the icon into the Main area. The exact location does
not matter. Now, in Properties:
Rename this pool Kiosks (or other name).
Make the Resource type equal to Static.
Make the Capacity equal to the number of kiosks you
want to have. For example, you can make it 6.

29
17 Replacing the queue with a Seize
Delete the KioskLine queue.
In the Palette, select the Process Modeling Library
section, and look for the Seize icon.
Drag the icon into the Main area. Drop it in the place
where the queue was, between the two time measures.
Now, in Properties, rename this seize KioskLine.
Set its Queue capacity to 50000.
In Resource sets, click the plus sign and select Kiosks.
The 1 means that each person will seize 1 when available.

30
18 Add a Release when done
Now we need to add a release, to free up the kiosk when
the person is done using it.
In the Palette, select the Process Modeling Library
section, and look for the Release icon.
Drag the icon into the Main area. Drop it between the
delay and the sink.
Now, in Properties, rename this release LeaveKiosk.
In Release, select All resources seized in given Seize
block(s), and select the seize block called KioskLine.

31
19 Relax capacity at delay
Our blocks to use kiosks as a resource are now in place.
However, we must relax the capacity constraint that we
had set at the delay.
You may remember that the capacity at the delay was set
at a value equal to the number of kiosks available. That
was an indirect way to say how many kiosks were
available. However, now that we have defined kiosks as a
resource, we do not need this constraint.
So make the capacity at the delay very large: 50000. So
that, in theory, every person could use their own kiosk as
long as it is available in the resource pool.

32
20 Run the model
Click on the green play icon (Run)
Click on the Run button.
Wait for the simulation to run.

When the simulation is done:


Notice that next to the Kiosks resource pool you can see
the utilization as a percent:
~84% or so when you have 4 kiosks
~56% or so when we have 6 kiosks
~42% or so when we have 8 kiosks, etc.

33
Expanding the model:
Select output

34
Part 2 of Boarding Pass Problem
Emait Airlines has realized that, for some passengers, the
kiosks are not an attractive option: they prefer a human.
The airline estimates that around 20% of their passengers
boarding in Logan would prefer to get their passes from a
human. So Emait has decided to open a desk with a few
customer service representatives (CSRs) to issue passes.
Emait estimates that, once a representative is available to
serve a passenger, they spend on average 6 minutes issuing
the pass, with a minimum of 3 and a maximum of 9 minutes.
How many customer representatives (CSRs) should there be
at the desk if Emait wants the passengers to spend on
average no more than 10 minutes waiting both in queue and
for the representative to issue the pass, combined?
35
21 Create a Select Output
It is true that 1 in 5 passengers prefer seeing a CSR.
In the Palette, select the Process Modeling Library
section, and look for the Select Output icon.
Drag the icon into the Main area, and drop it right after
the source. Now, in Properties:
Rename this block WantsCSR (or other name).
Make the Probability equal to 0.2. This is the 20%
probability that the passenger wants a CSR.
Connect the true output (right one) with the sink.
Connect the false output with the Kiosk part of the
model.

36
22 Create a Resource Pool for CSRs
Lets create a resource pool for the CSRs.
In the Palette, select the Process Modeling Library
section, and look for the Resource Pool icon.
Drag the icon into the Main area. The exact location does
not matter. Now, in Properties:
Rename this pool CSRs (or other name).
Make the Resource type equal to Static.
Make the Capacity equal to the number of
representatives you want to have. For example, 4.

37
23 Add a Service for seeing the CSRs
Since we need to measure only the combined time it
takes the passenger to go through both the queue and
the customer service, we can use a Service block, which is
basically a delay, a queue and a seize in a single unit.
In the Palette, select the Process Modeling Library
section, and look for the Service icon.
Drag the icon into the Main area, over the connector
between the false output and the sink.

38
23 Add a Service for CSRs (continued)
Now, in Properties, rename this service SeeCSRs.
In Seize, specify units from the same pool. In Resource
pool, select CSRs as the pool. Leave 1 in number of units,
meaning only 1 CSR is drawn per passenger being served.
In Queue capacity, say 10000 (the most we can expect)
In Delay time, specify:
triangular(3, 6, 9)
and set units as minutes.

39
24 Lets measure time in the service
We want to know how long people wait in the service.
For this, we will use time measure start and end markers.
In the Palette, in the Process Modeling Library:
Look for Time Measure Start. Drag it to right before the
service. Rename it as stc or something like that.
Look now for Time Measure End, and drag it to right
after the service. Rename it as etc or something like it.
Specify stc as TimeMeasureStart block, by clicking on the
plus sign.

Source: 3M, 2016 40


25 Run the model
Click on the green play icon (Run)
Click on the Run button.
Wait for the simulation to run.
Click on the etc clock to see the mean time in service.

Using 6 kiosks, run with different CSR numbers. Notice that:


4 CSRs result in a mean time at service of ~6 minutes
3 CSRs result in a mean time at service of ~6.1 minutes
2 CSRs result in a mean time at service of ~6.3 minutes
1 CSRs result in a mean time at service of ~10.9 minutes
So the answer is: 2 customer service representatives.

41
Expanding the model:
Exit on Timeouts

42
Part 3a of Boarding Pass Problem
Emait Airlines is considering investing in a technology that
will identify when a person has been waiting in the line for a
kiosk to become available for 5 minutes, and redirect them
to see one of the customer service representatives.
What fraction of passengers that prefer the kiosk would
benefit from this technology?

43
26 Define a timeout in the Seize
Click on the KioskLine seize, and go to Properties. Under
Advanced, click the box for Enable exit on timeout.
Enter a timeout value of 5 and set the unit to minutes.
Connect the timeout node of the Seize (the one on the
top right) to the left node of the stc clock.

44
27 Run the model
Click on the green play icon (Run)
Click on the Run button.
Wait for the simulation to run.
Click on the etc clock to see the mean time in service.

Using 6 kiosks and 2 CSRs, notice that


Around ~32 people out of ~36 thousand, or less than 1 in
every thousand people that enter the kiosk line would
benefit from the redirecting technology.
Is it worth investing in this technology?

45
Part 3b of Boarding Pass Problem
Emait Airlines is considering reducing the number of
customer service representatives, from two to only one.
Some have argued that this could lead to longer waits to get
the boarding passes, which would lead some passengers to
get angry and want to talk with a manager.
The Airline estimates that, if a person has to wait more than
half an hour in the queue to see the CSR to get their
boarding pass, they typically ask to see a manager.
What fraction of the passengers that go to see CSRs would
have to wait half an hour or more if we have only 1 CSRs?
What fraction would have to wait half an hour with 2 CSRs?

46
28 Define a timeout in the Service
Drag a new Sink into Main, and call it Manager.
Click on the SeeCSRs service, and go to Properties. Under
Advanced, click the box for Queue: exit on timeout.
Enter a timeout value of 30 and set the unit to minutes.
Connect the timeout node of the Service (the one on the
top right) to the new Manager sink.

47
29 Run the model
Click on the green play icon (Run)
Click on the Run button.
Wait for the simulation to run.
Using 6 kiosks, notice that
Having 2 CSRs results in ~ zero people asking to talk with
a manager, because nobody has to wait over 30 mins.
Having 1 single CSR, on the other hand, results in ~22
people out of 8.9K (e.g. five passengers out of every 2K)
asking to talk with a manager.

48