BU.520.601 BU.520.601 Decision Models Simulation1 Simulation Summer 2013.

Slides:



Advertisements
Similar presentations
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. A PowerPoint Presentation Package to Accompany Applied Statistics.
Advertisements

Chapter 10: Simulation Modeling
Simulation Operations -- Prof. Juran.
Session 7a. Decision Models -- Prof. Juran2 Overview Monte Carlo Simulation –Basic concepts and history Excel Tricks –RAND(), IF, Boolean Crystal Ball.
(Monté Carlo) Simulation
Basic Business Statistics, 11e © 2009 Prentice-Hall, Inc. Chap 5-1 Chapter 5 Some Important Discrete Probability Distributions Basic Business Statistics.
Chapter 4 Probability and Probability Distributions
ฟังก์ชั่นการแจกแจงความน่าจะเป็น แบบไม่ต่อเนื่อง Discrete Probability Distributions.
Spreadsheet Simulation
Simulating Normal Random Variables Simulation can provide a great deal of information about the behavior of a random variable.
CSE 221: Probabilistic Analysis of Computer Systems Topics covered: Discrete random variables Probability mass function Distribution function (Secs )
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 5-1 Chapter 5 Some Important Discrete Probability Distributions Statistics.
Previously Optimization Probability Review Inventory Models Markov Decision Processes Queues.
Chapter 14 Simulation. Monte Carlo Process Statistical Analysis of Simulation Results Verification of the Simulation Model Computer Simulation with Excel.
Discrete Probability Distributions
Statistics Alan D. Smith.
Simulation Basic Concepts. NEED FOR SIMULATION Mathematical models we have studied thus far have “closed form” solutions –Obtained from formulas -- forecasting,
Irwin/McGraw-Hill © The McGraw-Hill Companies, Inc., 2000 LIND MASON MARCHAL 1-1 Chapter Five Discrete Probability Distributions GOALS When you have completed.
Monté Carlo Simulation MGS 3100 – Chapter 9. Simulation Defined A computer-based model used to run experiments on a real system.  Typically done on a.
Stevenson and Ozgur First Edition Introduction to Management Science with Spreadsheets McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies,
Simulation.
Chap 5-1 Copyright ©2013 Pearson Education, Inc. publishing as Prentice Hall Chapter 5 Discrete Probability Distributions Business Statistics: A First.
Example 16.1 Ordering calendars at Walton Bookstore
Managerial Decision Modeling with Spreadsheets
Simulation Examples ~ By Hand ~ Using Excel
1 1 Slide © 2016 Cengage Learning. All Rights Reserved. A population is the set of all the elements of interest. A population is the set of all the elements.
5-1 Business Statistics: A Decision-Making Approach 8 th Edition Chapter 5 Discrete Probability Distributions.
Binomial Distributions Calculating the Probability of Success.
Chapter 14 Simulation. What Is Simulation? Simulation is to mimic a process by using computers.
Chapter 5: Probability Distribution What is Probability Distribution? It is a table of possible outcomes of an experiment and the probability of each outcome.
Introduction to Behavioral Statistics Probability, The Binomial Distribution and the Normal Curve.
Lesson Objective Understand how we can Simulate activities that have an element of chance using probabilities and random numbers Be able to use the random.
Created by Tom Wegleitner, Centreville, Virginia Section 3-6 Probabilities Through Simulations.
Advance Waiting Line Theory and Simulation Modeling.
Simulation is the process of studying the behavior of a real system by using a model that replicates the behavior of the system under different scenarios.
WOOD 492 MODELLING FOR DECISION SUPPORT Lecture 24 Simulation.
Definition A random variable is a variable whose value is determined by the outcome of a random experiment/chance situation.
WOOD 492 MODELLING FOR DECISION SUPPORT Lecture 25 Simulation.
Simulation is the process of studying the behavior of a real system by using a model that replicates the system under different scenarios. A simulation.
Simulating Probabilistic Behaviour
Computer Simulation. The Essence of Computer Simulation A stochastic system is a system that evolves over time according to one or more probability distributions.
Statistics What is the probability that 7 heads will be observed in 10 tosses of a fair coin? This is a ________ problem. Have probabilities on a fundamental.
1 BA 555 Practical Business Analysis Linear Programming (LP) Sensitivity Analysis Simulation Agenda.
Discrete Random Variables. Introduction In previous lectures we established a foundation of the probability theory; we applied the probability theory.
Simulation Chapter 16 of Quantitative Methods for Business, by Anderson, Sweeney and Williams Read sections 16.1, 16.2, 16.3, 16.4, and Appendix 16.1.
Simulation Discrete Variables. What is it? A mathematical model Probabilistic Uses the entire range of possible values of a variable in the model.
Business Statistics, A First Course (4e) © 2006 Prentice-Hall, Inc. Chap 5-1 Chapter 5 Some Important Discrete Probability Distributions Business Statistics,
Math 1320 Chapter 7: Probability 7.3 Probability and Probability Models.
Random Variables Lecture Lecturer : FATEN AL-HUSSAIN.
Chapter 1 What is Simulation?. Fall 2001 IMSE643 Industrial Simulation What’s Simulation? Simulation – A broad collection of methods and applications.
CIS 2033 based on Dekking et al. A Modern Introduction to Probability and Statistics B: Michael Baron. Probability and Statistics for Computer Scientists,
Copyright © Cengage Learning. All rights reserved. 8 PROBABILITY DISTRIBUTIONS AND STATISTICS.
Simulasi sistem persediaan
Chapter 5 - Discrete Probability Distributions
Section 4.4 Sampling Distribution Models and the Central Limit Theorem
Queuing Systems Don Sutton.
Chapter 5 Some Important Discrete Probability Distributions
Discrete Probability Distributions
Probability distributions
Discrete Probability Distributions
Discrete Probability Distributions
Simulation Discrete Variables.
Discrete Probability Distributions
RANDOM VARIABLES Random variable:
Discrete Probability Distributions
Discrete Probability Distributions
Chapter 5 – Probability Rules
Chapter 11 Probability.
Applied Statistical and Optimization Models
Presentation transcript:

BU BU Decision Models Simulation1 Simulation Summer 2013

BU Simulation2 Many definitions.Many definitions. It is the process of studying the behavior of a real system using a computer-based model that replicates the behavior of that system.It is the process of studying the behavior of a real system using a computer-based model that replicates the behavior of that system. Used in situations involving probabilistic elements (e.g. random arrivals, service times and process yields)Used in situations involving probabilistic elements (e.g. random arrivals, service times and process yields) Used in situations where the complexity or the size of the problem makes it difficult to use optimizing models.Used in situations where the complexity or the size of the problem makes it difficult to use optimizing models. Useful in both service or manufacturing systems.Useful in both service or manufacturing systems. SimulationSimulation Simulation Process

BU Simulation3 Simulation characteristics In a simulation model we have “transactions” (customers, cars,..) and “events” (arrivals, receiving service, departure,..). When probability distributions are associated with events, we use a method called random deviate generation to get numbers from the probability distribution to simulate events.When probability distributions are associated with events, we use a method called random deviate generation to get numbers from the probability distribution to simulate events. Timing of event may or may not be important in a simulation.Timing of event may or may not be important in a simulation. For simulation of a warehouse operation, if inventory is charged on items at the end of the month, we do not need to know precise timing of withdrawal of items. We only need to know how many items were withdrawn during the month. For simulation of toll booths, we need timings of two types of events – when each car arrives and how long it takes to pay. When time is involved, simulation may be done by changing simulation clock in fixed increment or by changing clock from one event to the next (this is the preferred method).When time is involved, simulation may be done by changing simulation clock in fixed increment or by changing clock from one event to the next (this is the preferred method).

BU Simulation4 Simulation is not an optimization tool, rather we try to establish values of performance measures to arrive at better decision making. Here is an example. Suppose we would like improve customer satisfaction at a bank drive-in facility. We study arrival patterns, service times etc., and simulate the operation with one drive-in window, with two and may be with three drive-in windows. Obviously three windows will be most satisfactory from the customer point of view. But then we take into account the cost (initial and operating) and other factors to make the final decision. Simulation characteristics..cont We will use EXCEL for some simple simulation exercises. In EXCEL we will use a function RAND() quite frequently. This function is volatile (it recalculates all the time). You should disable automatic calculations (switch to manual). Press F9 key and all values are recalculated.

BU Simulation5 Ex. 1 Simulate the tossing of a coin. Model construction: No simulation clock is involved Each transaction will be the toss of a coin. We will generate 500 transactions (an arbitrary decision).Each transaction will be the toss of a coin. We will generate 500 transactions (an arbitrary decision). We will assume that the coin is “fair”. The random variable X takes two values (0, 1 for T and H) with equal probabilities.We will assume that the coin is “fair”. The random variable X takes two values (0, 1 for T and H) with equal probabilities. To generate of a transaction, we need a very simple formula. Generate a random number (RN).To generate of a transaction, we need a very simple formula. Generate a random number (RN). If RN < 0.5, it’s a head; otherwise it’s a tail.If RN < 0.5, it’s a head; otherwise it’s a tail. In Excel, we will use the following formula in 500 cells =IF(RAND()<0.5,"H","T“).In Excel, we will use the following formula in 500 cells =IF(RAND()<0.5,"H","T“). Performance measure: We will compute the probability of tails based on our simulation to see if it is close to 0.5.

BU Simulation6 Ex. 1.. Excel: Simulate the tossing of a coin.

BU Simulation7 Generating random deviates (variates) For every probability distribution, as the variable X goes the minimum value to the maximum value, the cumulative probability increases from 0 to 1.For every probability distribution, as the variable X goes the minimum value to the maximum value, the cumulative probability increases from 0 to 1. Random number generators produce numbers between 0 to 1 (uniform distribution). Thus for any value of a random number, there is one matching point on the cumulative distribution of X. We match the value and generate X.Random number generators produce numbers between 0 to 1 (uniform distribution). Thus for any value of a random number, there is one matching point on the cumulative distribution of X. We match the value and generate X. RAND() generates a random number (say RN, 0  RN < 1). function automatically. RAND() generates a random number (say RN, 0  RN < 1). function automatically. For the discrete uniform distribution, when X varies between integers A and B, Excel has a special function = RANDBETWEEN(A, B). Discrete uniform distribution       A A+1 … B-1 B  X

BU We get corresponding X value (= 400) X F(X) Simulation8 Suppose we pick RN =  Empirical distribution The logic is simple. We match RN with cumulative probability. If RN < 0.3, X = 300. If 0.3  RN < 0.7, X = 400. If 0.7  RN < 0.9, X = 500. If 0.90  RN < 1.0, X = 600 Demand: X Pr(X) F(X) We need cumulative probabilities.

BU F(X) Simulation9 Using LOOKUP What is the value of X if RN = 0.632? X F(X)  Suppose we use HLOOKUP to find demand corresponding to F(X) = We need to use the function without exact match. But since 0.3 < < 0.7, Excel will match the value equal to 300. To avoid this, we need to replace F(X) with some variable G(X), in which F(X) values are shifted to the right. G(X) Demand: X Pr(X)

BU Simulation10 Ex. 2 Ships arrive in the night at a facility with two docks. Model construction: We will start with a flow chart If a dock is available in the morning, it is assigned to a waiting ship for the whole day and the ship leaves in the evening. If a dock cannot be assigned, there is a fee of $10,000 per day per ship. Simulate the operation and estimate the annual fee. Arrival distribution X Pr(X) Population QueueArrival Dock 1 Departure Dock 2 Our model is simpler because both docks take 1 day to process.

BU Simulation11 Population Queue ArrivalDocks:Service 1 or 2 Departure Ex. 2.. Every day, we will generate new arrivals with HLOOKUP. Assume ship arrive between midnight and 6 a.m. These ships will be added to the queue.Every day, we will generate new arrivals with HLOOKUP. Assume ship arrive between midnight and 6 a.m. These ships will be added to the queue. We will assign up to 2 ships from the queue (assumed FIFO – First In First Out) and calculate remaining ships waiting. These waiting ships will incur fee for that day.We will assign up to 2 ships from the queue (assumed FIFO – First In First Out) and calculate remaining ships waiting. These waiting ships will incur fee for that day. We will simulate the operation of a year and calculate the fee.We will simulate the operation of a year and calculate the fee. We can replicate the experiment many times.We can replicate the experiment many times. Performance measure: We will compute the annual fee. Dock simulation

BU Simulation12 Ex. 2… Run for 365 days Simulation generated ? Excel: Dock simulation

BU Simulation13 Ex. 2…. Excel: Dock simulation

BU Simulation14 Ex. 2….. Arrivals are generated with HLOOKUP. Excel: Dock simulation

BU Simulation15 Random Deviates: Continuous distributions Suppose X has continuous probability distribution (range 100 to 500) and we can find the cumulative distribution F(X). Every F(X) varies between 0 and 1. We can use random numbers (RN) to generate X values because RN also vary between 0 and 1 and there is a one to one correspondence. We can find corresponding X value (say 264) Suppose we pick RN = F(X) 100 X

BU Simulation16 A X  B A X  B Uniform distribution Random Deviates…… Uniform: = A + RAND()*(B – A) Triangular: Let p = (B - A) / (C – A) =IF(RAND() ≤ p, X, Y) where X = A + SQRT(RAND() * (C – A) * (B – A)), Y = C - SQRT((1-RAND()) * (C – A) * (C – B)) Normal distribution = NORMINV(RAND(),Mean, Std. dev.) Log-Normal = LOGINV(RAND(),Mean, Std. dev.) Exponential distribution = (-Mean)*LN(RAND()) A X  B C A X  B C Triangular distribution

BU Simulation17 Ex. 3 Retirement Planning  You are 30 years old, and would like to invest 3000 dollars at the end of each year from now till you reach 60.  Assume interest paid to be N(12, 2) meaning normally distributed with mean = 12% and std. dev. = 2%; interest is paid at the end of year.  You would like to estimate probability of reaching the target of one million dollars at the age 60.  You would like to know chances of achieving the target if you increase the annual amount invested. Age Investment value 30 X 30 = X 31 = X 30 + interest on X X 32 = X 31 + interest on X 31

BU Simulation18 Ex. 3.. =B12*(1+NORMINV(RAND(), Mean_R,STDV_R))+ Annual_contr

BU Simulation19 Ex. 3… Retirement Planning sensitivity analysis Effect of changing contribution on the probability of achieving the desired outcome.

BU Simulation20 Ex. 4 An IPO is to be launched with the opening price expected to be from the distribution shown. Estimate the following using simulation: (a)Price of the stock at the end of the 5 year period assuming the company has not failed. (b)Probability of survival at the end of 5 years. For the next five years, the stock price is expected to increase by an amount given by a lognormal distribution with mean of 1.5% and standard deviation of 0.5% provided the company does not fail. The probability of failure is 40%, 30%, 20%, 20% and 10% during the next five years. Opening Stock Price X Pr(X) Theoretical answer to part (b) is (1 – 0.4) * (1 – 0.3) * (1 – 0.2) * (1 – 0.2) * (1 – 0.1) =

BU Simulation21 Ex. 4.. IPO Launching

BU Simulation 22 Ex. 4… IPO Launching Fail in Year 4: =IF(K3="Y","Y",IF(RAND()<F$15,"Y","N"))  How? Count failures through Y1, then Y2 – Y1, etc.

BU Simulation 23 Ex. 4…. IPO Launching Stock Price in Year 4: =IF(L4="N",Q4*(1+0.01*LOGINV(RAND(),Log_mean, Log_Stdv)),0) =IF(L4="N",Q4*(1+0.01*LOGINV(RAND(),Log_mean, Log_Stdv)),0)

BU Simulation24 We will consider the following: Transactions (customers) enter the system in a single line and are processed at a single facility (server) on a FIFO basis also called “First Come First Served” (FCFS). Population QueueArrivalServiceDeparture We will consider several different situations. First, the dock example appeared to have same flow chart but it was somewhat different. Docks were open only during day time (say from 7). This means ships arrive in the night could be considered as arriving at 7 and using the docks for fixed amount of time. Each row generated new arrivals for a new day. Time Based Event Oriented Simulation

BU Job 2 Job Simulation25 A simple example A machine take exactly 5 minutes to process a job. Our work load is only 10 jobs per hour. So we don’t need simulation, we can simply schedule a job every 6 minutes. Population QueueArrivalServiceDeparture M1 5 min 5 min M1 Job 1 Job 1 5 Job 3 Job There is an idle time of 1 minute after every job. Machine utilization is (5/6)* 100 = 83.3%. There will be no queue.

BU Simulation26 Example 5 Population QueueArrivalServiceDeparture We are now going to consider different arrival and service time distributions. Case Arrival distribution Service time distribution A Uniform (discrete) 1 to 11 min Fixed ( 5 minutes) B Uniform (continuous) 1 to 11 minutes Fixed ( 5 minutes) C Triangular (1, 5, 9) minutes D Poisson: 10 arrivals/hour (time between arrival 6 minutes – exponential) Exponential (Average service time 5 minutes) Note that the average time between arrival is 6 minutes and average service time is 5 minutes. M1 5 min 5 min

BU Simulation27 Arrival SS? Join Q Add 1 to Q Determine next arrival time SS=1 Enter service Set SS = 1 Set next Dep. Time SS=0 QQueue Dep. Time Departure Time Arrival Flow chart Server Status (SS) SS = 0 Idle SS = 1 Busy When an arrival event happens, the following is checked at that point in time.

BU Simulation28 Departure Q. Status Remove first Tr. From Q, start service & set Dep. Time Shorten Q by 1 Q not empty Set SS = 0 Q Empty QQueue SS = 0 Server Status: Idle Tr.Transaction Departure Flow chart When a departure event happens, the following is checked at that point in time.

BU Simulation29 Single server system simulation – 4 cases Model Parameters: Each model may have many parameters. Examples are: arrival and service rates, capacities, etc. Statistics of interest /performance measures: Statistics on performance measures can be useful in validating the model and for decision making. Some examples. What’s the average waiting time? Maximum waiting time? What is the maximum queue length? What is the server utilization? How many people had to wait in queue before using the server? How many people waited more than X minutes? Example 5.. Case Arrival distribution Service time distribution A Uniform (discrete) 1 to 11 min Fixed ( 5 minutes) B Poisson: 10 arrivals/hour Exponential (Average time 5 min.)

BU Simulation30 Single server system simulation When the simulation starts at time zero, the system is empty. Value of a performance measure such as server utilization keeps on changing as time progresses. After some time, when the process reaches a “steady state”, value of the performance measure comes close to the expected value of that measure. In all four cases since average time between arrivals is 6 minutes and the average service time (when the server is busy) is 5 minutes. The server utilization will stabilize at about 83% (=100*75/90). Parameter value 0 Time  Expected Parameter value t For better estimate of the performance measure values, we generally chop off initial observations (up to period t). For our example, we will start collecting data from observation 201 (to 1200). Example 5…

BU Simulation31 Example 5A Arrival Service time Uniform (discrete) 1 to 11 min Fixed ( 5 minutes) How did we get numbers in the table below?

BU Simulation32 Example 5A.. Arrival Service time Uniform (discrete) 1 to 11 min Fixed ( 5 minutes)

BU Simulation33 Example 5B Arrival Service time Poisson: 10 / hour Exponential: 5 min When the number of arrivals is Poisson (with 10 units / hr.), the time between arrivals is exponential (with average time = 6 minutes).

BU Simulation34 Example 5D.. Arrival Service time Poisson: 10 / hour Exponential: 5 min The graph here shows that it is not easy to determine when steady state may be reached (how many observations to chop off), nor do we know how many total observations to collect in a simulation run or how many time to replicate.

BU Simulation35Case Arrival distribution Service time distribution A Uniform (discrete) 1 to 11 min Fixed ( 5 minutes) D Poisson: 10 arrivals/hour Exponential (Average time 5 min.) Example 5: Comparison A B A B

BU Simulation36 Simulation: general comments One can use visual basic macros within EXCEL. Risk solver also includes some simulation capability. Many specialized simulation languages have been developed. These can handle even more complex situations. Examples: AutoMod, Arena, GASP, GPSS, Promodel, SIMSCRIPT, Simula. Many simulation software packages also come with “animation” capability (there are even “free” ones). This can make a tremendous impact in visualizing the operations. One note of caution. Impressive visual display may give some false impressions even though data used in the simulation or the simulation logic is faulty.

BU Simulation37 Simulation Advantages Disadvantages Simulation Advantages Disadvantages 1.Flexibility. 2.Can handle large and complex systems. 3.Can answer “what-if” questions. 4.Does not interfere with the real system. 5.Allows study of interaction among variables. 6.“Time compression” is possible. 7.Handles complications that other methods can’t. 1.Can be expensive and time consuming. 2.Does not generate optimal solutions. 3.Managers must choose solutions they want to try (“what-if” scenarios). 4.Each model is unique.

BU Simulation38 ATM Simulation 1 vs. 2 Average number of arrival per hour: 40 (Poison) Average service time 75 sec. (Exponential)