Simulation - Texas Tech University

Download Report

Transcript Simulation - Texas Tech University

Chapter 13 Supplement
Simulation
Operations Management - 6th Edition
Roberta Russell & Bernard W. Taylor, III
Copyright 2009 John Wiley & Sons, Inc.
Beni Asllani
University of Tennessee at Chattanooga
Lecture Outline
 Monte Carlo Simulation
 Computer Simulation with Excel
 Areas of Simulation Application
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-2
Simulation
 Mathematical and computer modeling technique for
replicating real-world problem situations
 Modeling approach primarily used to analyze
probabilistic problems

It does not normally provide a solution; instead it provides
information that is used to make a decision
 Physical simulation

Space flights, wind tunnels, tread-mills for tires
 Mathematical-computerized simulation

Computer-based replicated models
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-3
What Discrete Stochastic
Simulation is
 Probabilistic occurrences
 Activity completions
 Processes
 Precedence relationships
 Probabilistic routing
 Events, Entities and Attributes
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-4
Some definitions
 Activity—a task that requires time to complete,
has time duration
 Event – an instant in time at which the system
undergoes state change
 Entity—an object that engages the system
 Attributes—information elements carried along
with entities and attributes
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-5
Activities and Events
 All activities begin and end with an
event—nothing interesting happens inbetween
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-6
An example—Southwest
Airlines airline gate turn-ACTIVITIES








Disembark passengers
Cabin cleanup
Embark passengers
Unload baggage
Load Baggage
Refuel
Remove waste
Refurbish snacks and drinks
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-7
EVENTS for the airline gate
turn









Arrival at gate
Beginning of unloading
Completion of passenger unloading
Beginning of cleanup
Ending of cleanup
Beginning of passenger loading
Ending of passenger loading
Beginning of baggage unloading
Ending of baggage unloading
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-8
ACTIVITIES & EVENTS
 Activities always have time duration.

That time duration is in general random
 Events are instants in time
 Activities are sometimes engaged in by
entities
 Activities, events and entities have
attributes
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-9
Events, Entities and Attributes
 Entities may be permanent or temporary


Customers, students, piece parts,
messages, boxes, items,--TEMPORARY
Universities, cities, companies, facilities,
servers, professors, service areas -PERMANENT
Copyright 2006 John Wiley & Sons, Inc.
Supplement 12-10
Both entities and events possess
ATTRIBUTES


Attributes of a server entity—mean service
time, std. dev. of service time, probability
distribution type
attributes of an event--event type, time the
event is to occur, no of entities assoc. with
it, links to the specific entities attached to
the event
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-11
A typical service system scenario
 In the early morning hours between 7
and 9 a.m., arrivals to convenience
stores are larger than normal. If there
are more than 6 people waiting in line,
new arrivals will balk and go
somewhere else. People arrive at the
rate of 1 every second, but the time is
exponentially distributed. Patrons shop
for a time period that is uniformly
distributed between 3 and 5 minutes.
Copyright 2006 John Wiley & Sons, Inc.
Supplement 12-12
Convenience Store Scenario,
continued
 It takes the checkout clerk an average of 43
sec to collect money from a customer and
provide them with a receipt, but this time is
normally distributed with a std dev. of 30
sec. . People will automatically enqueue
themselves in front of the checkout stand.
 The manager can hire a second clerk, who
is less well paid but also much slower
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-13
Convenience Store Scenario,
continued
 The store manager is interested in


the average waiting time of his patrons in
the queue
the average number of customers that
balked
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-14
With one store clerk:
 average waiting time is 128 seconds
 number of balked customers is 76 out of
1000 customers
 Check out clerk is busy 86% of the time
checking out customers
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-15
With two store clerks:
 average waiting time is 42 secs for the
first server

69 secs for the second
 There are no balked customers
 Servers are busy 70% and 40% of the
time, respectively
Copyright 2006 John Wiley & Sons, Inc.
Supplement 12-16
How does randomness come
into play?
 Probabilistic activity durations
 Probabilistic routing “decisions”
 Probabilistic arrivals
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-17
How is randomness created
within a digital computer?
 Monte Carlo--the computer generation of
random numbers


Sample the clock?--no--not replicable
maintain a huge file of random numbers--no




Takes up too much space in primary memory
On secondary storage, its too slow
when deciding to fetch from disk as opposed to primary
memory, the time required. is 500,000 times longer
Use an ALGORITHM? --YES, YES
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-18
Why use an algorithm?
 The sequence it generates will be
deterministic
 Doesn’t take up much space in primary
storage
 Takes up no space on secondary
storage
 Far faster than getting data off of the
hard drive
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-19
An Algorithm for Generating
Random Numbers
 Must be fast (short and sweet)
 Must be capable of generating numbers
that have all of the characteristics of
randomness, but in fact are deterministic
 Multiplicative Congruence is one method
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-20
About Random Numbers
 Uniform on the interval zero to one
 They are completely independent and
therefore un-correlated
 We represent them this way: U(0,1)
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-21
Multiplicative Congruence Algorithm
 CI+1 = K*Ci
function random(float u, int I)
I = I * 1220703125;
if I<0 then
I = I + 2147483647 + 1;
else
U = I * 0.4656613E-9;
return “and” end;
Copyright 2006 John Wiley & Sons, Inc.
Supplement 12-22
Notes
 Generates a sequence on the entire interval
of 32-bit integers--0 to 2147483647
 Maps these onto the real interval of 0 to 1
 If the first multiplication causes integer
overflow, the resultant number I will be
negative--it is made positive by adding the
largest 32-bit integer representable +1
The last multiplication is like dividing the
number by the largest integer possible
1/2147483647 = .4656613x10 to the minus 9
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-23
You can easily generate
random numbers in an EXCEL
spreadsheet using the function
RAND()
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-24
What about non-uniform
random numbers?
Exponential
Normal
Gamma
Poisson
Lognormal
Rectangular
Triangular
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-25
ONE ANSWER: Use the
inverse transformation method
Every non-uniform random variate has an
associated cumulative distribution
function F(x) whose values are contained
within the interval 0 to 1 and whose
values are uniformly distributed over this
interval
If x is a non uniform random variate, y =
F(x) is uniformly distributed over the
interval 0 to 1.
Supplement 12-26
Strategy
If the inverse of the cumulative distribution
function F(x) exists so that x = F-1(y) can
be determined, then
1) simply generate a random number
uniformly distributed on the interval 0 to 1
2) call this number y and apply the inverse
transformation F-1(y) to obtain a random
number x with the appropriate
distribution.
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-27
Exponential Random variates
1) generate a random number U using the
program given above
2)then apply EXPRND = -XMEAN *
ALOG(U)
(This is simply using the inverse
distribution method)
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-28
When Analytic inverses of the
cumulative distribution
function are unavailable
You can use a table function (this is what
we will do in the subsequent problems)
You can use specialized algorithms that
have been developed by academics over
thirty-five years of cumulative research
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-29
Outputs
 The animation reveals bottlenecks,
idleness
 We are also interested in



productivity, cycle time (time in the system),
wait time,blocked time,
number of trips made in a given period of time,
system throughput within a given period of
time
 We can get this from the statistical reports
provided after the simulation is finished
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-30
Monte Carlo Simulation
 Select numbers randomly from a
probability distribution
 Use these values to observe how a
model performs over time
 Random numbers each have an equal
likelihood of being selected at random
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-31
Distribution of Demand
LAPTOPS DEMANDED
PER WEEK, x
FREQUENCY OF
DEMAND
PROBABILITY OF
DEMAND, P(x)
0
1
2
3
4
20
40
20
10
10
0.20
0.40
0.20
0.10
0.10
100
1.00
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-32
Random Numbers in Excel
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-36
15 Weeks of Demand
WEEK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
r
DEMAND (x)
39
73
72
75
37
02
87
98
10
47
93
21
95
97
69
1
2
2
2
1
0
3
4
0
1
4
1
4
4
2
 = 31
Copyright 2009 John Wiley & Sons, Inc.
REVENUE (S)
4,300
8,600
8,600
8,600
4,300
0
12,900
17,200
0
4,300
17,200
4,300 Average demand
17,200
= 31/15
17,200
= 2.07 laptops/week
8,600
$133,300
Supplement 12-37
Computing Expected Demand
E(x) = (0.20)(0) + (0.40)(1) + (0.20)(2)
+ (0.10)(3) + (0.10)(4)
= 1.5 laptops per week
•Difference between 1.5 and 2.07 is due to small
number of periods analyzed (only 15 weeks)
•Steady-state result
•an average result that remains constant after
enough trials
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-38
Simulation in Excel
Enter this formula
in G6 and copy to
G7:G20
Enter “=4300*G6”
in H6 and copy to
H7:H20
Generate random
numbers for cells
F6:F20 with the
formula “=RAND()”
in F6 and copying to
F7:F20
= AVERAGE (G6:G20)
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-39
Simulation in Excel (cont.)
Copyright 2006 John Wiley & Sons, Inc.
Supplement 12-40
Decision Making with
Simulation
This formula entered in
G7 and copied to
G8:G105
=VLOOKUP
(F6,LOOKUP,2)
in H6 and copied to
H7:H105
=G6*50 entered into
cell L6 and copied
to L7:L105
Shortages computed
by entering
=MIN(G6-H6,0)
in I6 and copying
to I7:I105
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-41
Decision Making with
Simulation (cont.)
New formula for two
laptops ordered
per week
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-42
Areas of Simulation Application
 Waiting Lines/Service


Complex systems for which it is difficult to develop
analytical formulas
Determine how many registers and servers are
needed to meet customer demand
 Inventory Management


Traditional models make the assumption that
customer demand is certain
Simulation is widely used to analyze JIT without
having to implement it physically
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-43
Areas of Simulation
Application (cont.)
 Production and Manufacturing Systems


Examples: production scheduling, production sequencing,
assembly line balancing, plant layout, and plant location
analysis
Machine breakdowns typically occur according to some
probability distributions
 Capital Investment and Budgeting


Capital budgeting problems require estimates of cash flows,
often resulting from many random variables
Simulation has been used to generate values of cash flows,
market size, selling price, growth rate, and market share
Copyright 2006 John Wiley & Sons, Inc.
Supplement 12-44
Areas of Simulation Application
(cont.)
 Logistics

Typically include numerous random variables, such as
distance, different modes of transport, shipping rates, and
schedules to analyze different distribution channels
 Service Operations


Examples: police departments, fire departments, post offices,
hospitals, court systems, airports
Complex operations that no technique except simulation can
be employed
 Environmental and Resource Analysis

Examples: impact of manufacturing plants, waste-disposal
facilities, nuclear power plants, waste and population
conditions, feasibility of alternative energy sources
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-45
Copyright 2009 John Wiley & Sons, Inc.
All rights reserved. Reproduction or translation of this work beyond that
permitted in section 117 of the 1976 United States Copyright Act without
express permission of the copyright owner is unlawful. Request for further
information should be addressed to the Permission Department, John Wiley &
Sons, Inc. The purchaser may make back-up copies for his/her own use only and
not for distribution or resale. The Publisher assumes no responsibility for
errors, omissions, or damages caused by the use of these programs or from the
use of the information herein.
Copyright 2009 John Wiley & Sons, Inc.
Supplement 12-46