Simulation II IE 2030 Lecture 18. Outline: Simulation II Advanced simulation demo Review of concepts from Simulation I How to perform a simulation –concepts:

Slides:



Advertisements
Similar presentations
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
Advertisements

Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
Modeling & Simulation. System Models and Simulation Framework for Modeling and Simulation The framework defines the entities and their Relationships that.
Lab Assignment 1 COP 4600: Operating Systems Principles Dr. Sumi Helal Professor Computer & Information Science & Engineering Department University of.
Outline input analysis input analyzer of ARENA parameter estimation
Statistics review of basic probability and statistics.
Copyright © 2010 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
Evaluation (practice). 2 Predicting performance  Assume the estimated error rate is 25%. How close is this to the true error rate?  Depends on the amount.
Simulation Where real stuff starts. ToC 1.What, transience, stationarity 2.How, discrete event, recurrence 3.Accuracy of output 4.Monte Carlo 5.Random.
Discrete Event Simulation How to generate RV according to a specified distribution? geometric Poisson etc. Example of a DEVS: repair problem.
Evaluation.
Simulation.
Lecture 9 Output Analysis for a Single Model. 2  Output analysis is the examination of data generated by a simulation.  Its purpose is to predict the.
Data Communication and Networks Lecture 13 Performance December 9, 2004 Joseph Conron Computer Science Department New York University
1 Validation and Verification of Simulation Models.
Queueing Models: Data Collection and Hand Simulation from Prof. Goldsman’s lecture notes.
Cmpt-225 Simulation. Application: Simulation Simulation  A technique for modeling the behavior of both natural and human-made systems  Goal Generate.
Model Calibration and Model Validation
Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:
Analysis of Simulation Results Andy Wang CIS Computer Systems Performance Analysis.
Simulation Output Analysis
1 Validation & Verification Chapter VALIDATION & VERIFICATION Very Difficult Very Important Conceptually distinct, but performed simultaneously.
Simulation Examples ~ By Hand ~ Using Excel
1 Performance Evaluation of Computer Networks: Part II Objectives r Simulation Modeling r Classification of Simulation Modeling r Discrete-Event Simulation.
 1  Outline  stages and topics in simulation  generation of random variates.
Verification & Validation
Software Reliability SEG3202 N. El Kadri.
1 OM2, Supplementary Ch. D Simulation ©2010 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible.
CS433 Modeling and Simulation Lecture 15 Random Number Generator Dr. Anis Koubâa 24 May 2009 Al-Imam Mohammad Ibn Saud Islamic University College Computer.
Analysis of Simulation Results Chapter 25. Overview  Analysis of Simulation Results  Model Verification Techniques  Model Validation Techniques  Transient.
Discrete Distributions The values generated for a random variable must be from a finite distinct set of individual values. For example, based on past observations,
CIS 2033 based on Dekking et al. A Modern Introduction to Probability and Statistics Michael Baron. Probability and Statistics for Computer Scientists,
Copyright © 2009 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
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.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 18 Sampling Distribution Models.
Discrete Random Variables
Chapter 10 Verification and Validation of Simulation Models
NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly.
Simulation & Confidence Intervals COMP5416 Advanced Network Technologies.
Chapter Part 1 Sampling Distribution Models for.
Chapter 2 Fundamental Simulation Concepts
MATH 3033 based on Dekking et al. A Modern Introduction to Probability and Statistics Slides by Sean Hercus Instructor Longin Jan Latecki Ch. 6 Simulations.
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.
1 OUTPUT ANALYSIS FOR SIMULATIONS. 2 Introduction Analysis of One System Terminating vs. Steady-State Simulations Analysis of Terminating Simulations.
MODELING EXAMPLES Types of model Conceptual Containing components that have not been clearly Identified in terms of theoretic categories such as state,
Exam 2: Rules Section 2.1 Bring a cheat sheet. One page 2 sides. Bring a calculator. Bring your book to use the tables in the back.
Random Variable The outcome of an experiment need not be a number, for example, the outcome when a coin is tossed can be 'heads' or 'tails'. However, we.
Sampling and estimation Petter Mostad
1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random.
OPERATING SYSTEMS CS 3530 Summer 2014 Systems and Models Chapter 03.
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.
CDA6530: Performance Models of Computers and Networks Chapter 8: Statistical Simulation ---- Discrete Event Simulation (DES) TexPoint fonts used in EMF.
STA347 - week 91 Random Vectors and Matrices A random vector is a vector whose elements are random variables. The collective behavior of a p x 1 random.
Random Variables r Random variables define a real valued function over a sample space. r The value of a random variable is determined by the outcome of.
Simulation Examples And General Principles Part 2
Simulation. Types of simulation Discrete-event simulation – Used for modeling of a system as it evolves over time by a representation in which the state.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 18 Sampling Distribution Models.
Copyright © 2009 Pearson Education, Inc. Chapter 11 Understanding Randomness.
Building Valid, Credible & Appropriately Detailed Simulation Models
CIS 2033 based on Dekking et al. A Modern Introduction to Probability and Statistics B: Michael Baron. Probability and Statistics for Computer Scientists,
Sampling Distribution Models
Discrete Event Simulation
DSS & Warehousing Systems
Chapter 10 Verification and Validation of Simulation Models
Objective of This Course
COMP60611 Fundamentals of Parallel and Distributed Systems
MECH 3550 : Simulation & Visualization
Verification and Validation of Simulation Models
Presentation transcript:

Simulation II IE 2030 Lecture 18

Outline: Simulation II Advanced simulation demo Review of concepts from Simulation I How to perform a simulation –concepts: state variables, events, etc. –example Sampling Verification and Validation

Core Concepts Steady State Transient Sample size, run length Variability of runs State variables Event Clock Activity Simulation Table FEL (future event list)

Concepts from Simulation I (Pseudo-) Random number generator Length of run –startup or transient behavior –steady state Stability Variability of runs ÔThere is no perfect random number generator ÔShould be enough to get steady state behavior. Often initial behavior is atypical Ô E.g. of queue length Ô2 runs of a simulation perform differently

Using pseudo-random numbers Most generators produce a (pseudo)random value x uniformly distributed on [0,1]. Example: you want 1 w.p. 1/3, 2 w.p.1/3, and 5 w.p. 1/3.  0 <= x <= 1/3 gives value 1  1/3<= x <= 2/3 gives value 2  2/3<= x <= 1 gives value 5  cumulative distribution function F :  F(.9)=0; F(1)=1/3 ; F(2)=2/3; F(5)=1

Using pseudo-random #’s What are you doing? Let F* be the inverse of the cumulative distribution function of your distribution. – F*(x)= 1 for 0 <= x <= 1/3 – F*(x) = 2 for 1/3 < x <= 2/3 – F* (x) = 5 for 2/3 < x <= 1 –You are computing F*(x) where x is U[0,1] ctovey: don’t worry about < vs. <= ctovey: don’t worry about < vs. <=

Another example: exponential You want to generate a value for an exponentially distributed random variable. You have x, a uniform [0,1] value Compute F*(t) = - log(1-t) Apply F* to x

Using tables of random numbers Use consecutive values in table to approximate a uniform distribution –then apply same method shown for U[0,1] If you only need a Bernoulli p=1/2 valuecan use one value more directly e.g. even/odd or 0-4 and 5-9. Same for some other simple discrete distributions, probabilities in tenths thirds: skip 0, 1-3,4-6,7-9

How to perform a simulation State variables -- describe state of system, give a “system snapshot”. Event: anything that can change the state of the system FEL, Future Event List Clock Keep all these and any desired cumulative statistics in a simulation table

Events and State Variables State variables x1 = 5.6 x2 = 4.8 x3 = 7.9 n =3 Clock 2:14 2:16 n decreases by 1 Future Event List

Events and State Variables State variables x1 = 5.6 x2 = 4.8 x3 = 7.9 n =3 Clock 2:15 2:16 n decreases by 1 Future Event List (we don’t need this)

Events and State Variables State variables x1 = 5.6 x2 = 4.8 x3 = 7.9 n =3 Clock 2:16 n decreases by 1 Future Event List

Events and State Variables State variables x1 = 5.6 x2 = 4.8 x3 = 7.9 n =2 Clock 2:16 2:21 x1 = x3 - x2 Future Event List

Events and State Variables State variables x1 = 5.6 x2 = 4.8 x3 = 7.9 n =2 Clock 2:21 x1 = x3 - x2 Future Event List

Events and State Variables State variables x1 = 3.1 x2 = 4.8 x3 = 7.9 n =2 Clock 2:21 2:25 n increases by 2 Future Event List

Example: Clocks and Socks ( Foley & Tovey) I have n pairs of socks in my dryer. I remove socks 1 at a time and place them on top of the dryer. When I get a matching pair, I fold them and place them in my laundry basket. How much room do I need on top of my dryer?

Clocks and Socks n couples plan to meet under the clock at 6:00 pm. People arrive 1 at a time. When a couple meets, they leave to go eat dinner. How big does the crowd under the clock get?

clocks and socks Orders for parts arrive at a warehouse. Each order is for Kmin to Kmax different parts. The ASRS system retrieves one type of part for one order at at time. Partially completed orders are stored on pallets in a WIP storage area. How big should the WIP storage area be?

Simulating Clocks and Socks Assume n pairs distinct socks notation: Li, Ri, i=1,...,n: the two socks Assume I remove a sock from dryer in 1 sec. I check for match and fold, all in 2 sec –Could have assumed I check for a match in 5 sec; fold and toss into basket in 3 sec. *This is like implementing an algorithm. You usually have to make additional decisions or assumptions.

clocks and socks: state variables For each i=1,...n, Li and Ri can equal –D if in dryer –T if on top of dryer –DT if being moved to dryer top –B if in basket The values of the variables Li and Ri (together with the clock time t) provide a complete system snapshot

initial snapshot Li = Ri = D for all i=1,...,n t=0 useful extra state variable (not logically necessary): –nD = # of socks in dryer nD = 2n initially –nT = # socks on dryer top nT = 0 initially

Future event list Event: anything that can change the state of a system FEL: a list of events that you know about, but that have not yet occurred, i.e. with times > =t (usually >t) First event on FEL: time 0. Grab a sock from dryer. (t=0) Second event will be: put sock on dryer top (t=1).

Event types 1st type (grab) : a sock leaves the dryer. Its state changes from D to DT. nD decreases. 2nd type (arrive top): a sock arrives at the dryer top. Its state changes from DT to T. 3rd type (fold): a pair of socks is matched, folded, and put in basket. Both socks have a change in state from T to B

Clock and Sock Activities Activity: a time interval. Triggers an event. Activity: moving sock from dryer to top –event triggered: sock arrives on top of dryer Activity: checking for a match (2sec) –event triggered: possibly, fold (placing sock pair in basket); certainly, grab sock from dryer, unless nD=0

Simulation: n=2 t=0- (startup) L1=D R1=D L2=D R2=D nD=4 nT=0 t=0 Grab a sock from dryer

Simulation: n=2 t=0 L1=D R1=D L2=DT R2=D nD=3 nT=0 t=0 Grab a sock from dryer –to process this event we need a random integer in [1,...,nD]. In this case, say it is 3. So grab L2.

Simulation: n=2 t=0+ L1=D R1=D L2=DT R2=D nD=3 nT=0 t=1 arrive top sock L2 placed on top of dryer

Simulation: n=2 t=1 L1=D R1=D L2=T R2=D nD=3 nT=1 t=1 arrive top sock L2 t=3 grab a sock from dryer

Simulation: n=2 t=1+ L1=D R1=D L2=T R2=D nD=3 nT=1 t=3 grab a sock from dryer

Simulation: n=2 t=3 L1=DT R1=D L2=T R2=D nD= 2 nT=1 t=3 grab a sock from dryer. Needs random integer from 1 to 3=nD. In this case, say it was 1.

Simulation: n=2 t=4 L1=T R1=D L2=T R2=D nD= 2 nT=2 event t=4 arrive top L1

Simulation: n=2 t=4+ L1=T R1=D L2=T R2=D nD= 2 nT=1 t=6 grab a sock

Simulation: n=2 t=6 L1=T R1=DT L2=T R2=D nD= 1 nT=2 t=6 grab a sock, say it is R1

Simulation: n=2 t=6+ L1=T R1=DT L2=T R2=D nD= 1 nT=2 t=7 arrive top R1

Processing Events (grabz) : Sock z state changes from D to DT. nD--. Sock move activity (1 sec) triggers arrive top z. (arrive top z): Sock z state changes from DT to T. nT++. Checking for match, 2 secs: If z’s match is on T, triggers fold z’s pair. Triggers grab unless nD=0. (fold): both socks change state from T to B.nT decreases by 2.

Simulation: n=2 t=7 L1=T R1=T L2=T R2=D nD= 1 nT= 3 t=7 arrive top R1

Simulation: n=2 t=7+ L1=T R1=T L2=T R2=D nD= 1 nT= 3 t= 9 fold pair 1 t=9 grab (R2) –we process the fold before the grab

Simulation: n=2 t=9 L1=B R1=B L2=T R2=D nD= 1 nT= 1 t= 9 fold pair 1 t=9 grab (R2) –we process the fold before the grab

Simulation: n=2 t=9 L1=B R1=B L2=T R2=DT nD= 0 nT= 1 t=9 grab (R2)

Simulation: n=2 t=9+ L1=B R1=B L2=T R2=DT nD= 0 nT= 1 t=10 arrive top R2

Simulation: n=2 t=10 L1=B R1=B L2=T R2=T nD=0 nT= 2 t=10 arrive top R2 add the event: t=12 fold pair 2 don’t add grab event since nD=0

Simulation: n=2 t=12 L1=B R1=B L2=B R2=B nD=0 nT= 0 t=12 fold pair 2 no events are placed on FEL -- simulation terminates

other variables Summary stats you might keep track of: –number of socks on top of dryer –maximum number of socks on top of dryer –average (by time? by sock pick?) number of socks on dryer top –for each i, length of time 2,1, and 0 socks in pair i are in dryer You can walk through your simulation a second time to collect these statistics. –Almost always easier to collect them as the simulation progresses

Clocks and Socks If we were only interested in nT, number on dryer top, we could eliminate the activity of checking for a match. If checking for a match took longer when nT was big, we might let the activity time in the simulation vary with nT, and collect more information about time spent checking.

Sampling How to deal with transient behavior: –discard it –use long enough runs that its effect is negligible –“hot-start” the simulation (can be risky) –run length: how do you know in “steady state”? Not defined for one sample path the more variability, the longer run length is needed Variability from one run to another –sample size: number of runs

Verification & Validation Building the model right –like debugging a computer program –use a pseudo- random number generator that is deterministic given the seed Building the right model –does the model accurately predict what happens in the real system? –Several levels of validation –use many seeds

Verification & Validation Building the model right Examples of bugs: –triggering a grab when nD=0 –not decreasing nT Building the right model –Do we really remove socks from the dryer in random order? –Are our activity times accurate (if we care)? –Does it accurately predict dryer top usage?

Types of Validation Face Validity: Does an expert think that the simulation model behaves realistically? –domain expert, not simulation expert Weak External Validity: Does the output of the simulation match the behavior of the system that is being simulated?

More Kinds of Validation Strong External Validity: Make a change to the simulation model and make the corresponding change to the actual system. Compare the simulation output to the actual system behavior. –Does the model correctly predict the effects of changes to the system? Validation of Assumptions: Test the assumptions made by the model. –E.g., independence or distribution of arrivals