COMP155 Computer Simulation September 8, 2008. States and Events  A state is a condition of a system at some point in time  An event is something that.

Slides:



Advertisements
Similar presentations
CS433: Modeling and Simulation
Advertisements

Statistics review of basic probability and statistics.
Chapter 5 Statistical Models in Simulation
Chapter 5 Some Important Discrete Probability Distributions
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 5-1 Chapter 5 Some Important Discrete Probability Distributions Statistics.
Chapter 8 Random-Variate Generation
Prepared by Lloyd R. Jaisingh
Chapter 4 Discrete Random Variables and Probability Distributions
Continuous Random Variables. For discrete random variables, we required that Y was limited to a finite (or countably infinite) set of values. Now, for.
Random-Variate Generation. Need for Random-Variates We, usually, model uncertainty and unpredictability with statistical distributions Thereby, in order.
Simulation Modeling and Analysis
Probability Distributions
Chapter 6 Continuous Random Variables and Probability Distributions
Probability Distributions
Agenda Purpose Prerequisite Inverse-transform technique
Chapter 5 Discrete and Continuous Probability Distributions
BCOR 1020 Business Statistics
Continuous Random Variables and Probability Distributions
Statistics for Managers Using Microsoft Excel, 5e © 2008 Pearson Prentice-Hall, Inc.Chap 6-1 Statistics for Managers Using Microsoft® Excel 5th Edition.
Chapter 5 Continuous Random Variables and Probability Distributions
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 6-1 Chapter 6 The Normal Distribution and Other Continuous Distributions.
1 Random Variables and Probability Distributions: Discrete versus Continuous For this portion of the session, the learning objective is:  Learn that the.
Properties of Random Numbers
Lecture II-2: Probability Review
Chapter 21 Random Variables Discrete: Bernoulli, Binomial, Geometric, Poisson Continuous: Uniform, Exponential, Gamma, Normal Expectation & Variance, Joint.
Chapter 4 Continuous Random Variables and Probability Distributions
Chapter 5 Statistical Models in Simulation Banks, Carson, Nelson & Nicol Discrete-Event System Simulation.
CPSC 531: Probability Review1 CPSC 531:Distributions Instructor: Anirban Mahanti Office: ICT Class Location: TRB 101.
DATA ANALYSIS Module Code: CA660 Lecture Block 3.
Chapter 4 Continuous Random Variables and their Probability Distributions The Theoretical Continuous Distributions starring The Rectangular The Normal.
Chapter 5 Statistical Models in Simulation
Dept of Bioenvironmental Systems Engineering National Taiwan University Lab for Remote Sensing Hydrology and Spatial Modeling STATISTICS Random Variables.
Modeling and Simulation CS 313
PROBABILITY & STATISTICAL INFERENCE LECTURE 3 MSc in Computing (Data Analytics)
Basic Business Statistics, 10e © 2006 Prentice-Hall, Inc.. Chap 5-1 Chapter 5 Some Important Discrete Probability Distributions Basic Business Statistics.
Theory of Probability Statistics for Business and Economics.
Chapter 4 Continuous Random Variables and their Probability Distributions Another one of life’s great adventures is about to begin. Chapter 4A.
CPSC 531: Probability Review1 CPSC 531:Probability & Statistics: Review II Instructor: Anirban Mahanti Office: ICT 745
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.
Lecture 19 Nov10, 2010 Discrete event simulation (Ross) discrete and continuous distributions computationally generating random variable following various.
Monte Carlo Methods So far we have discussed Monte Carlo methods based on a uniform distribution of random numbers on the interval [0,1] p(x) = 1 0  x.
© 2002 Prentice-Hall, Inc.Chap 6-1 Basic Business Statistics (8 th Edition) Chapter 6 The Normal Distribution and Other Continuous Distributions.
Continuous Probability Distributions Statistics for Management and Economics Chapter 8.
MATH 4030 – 4B CONTINUOUS RANDOM VARIABLES Density Function PDF and CDF Mean and Variance Uniform Distribution Normal Distribution.
Probability Refresher COMP5416 Advanced Network Technologies.
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.
The generalization of Bayes for continuous densities is that we have some density f(y|  ) where y and  are vectors of data and parameters with  being.
CONTINUOUS RANDOM VARIABLES
Chap 5-1 A Course In Business Statistics, 4th © 2006 Prentice-Hall, Inc. A Course In Business Statistics 4 th Edition Chapter 5 Discrete and Continuous.
Random Variables. Numerical Outcomes Consider associating a numerical value with each sample point in a sample space. (1,1) (1,2) (1,3) (1,4) (1,5) (1,6)
© 2002 Prentice-Hall, Inc.Chap 5-1 Statistics for Managers Using Microsoft Excel 3 rd Edition Chapter 5 The Normal Distribution and Sampling Distributions.
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.
Statistics for Managers Using Microsoft Excel, 5e © 2008 Pearson Prentice-Hall, Inc.Chap 6-1 Statistics for Managers Using Microsoft® Excel 5th Edition.
Basic Business Statistics, 10e © 2006 Prentice-Hall, Inc.. Chap 6-1 Chapter 6 The Normal Distribution and Other Continuous Distributions Basic Business.
5 - 1 © 2000 Prentice-Hall, Inc. Statistics for Business and Economics Continuous Random Variables Chapter 5.
Module 9.4 Random Numbers from Various Distributions -MC requires the use of unbiased random numbers.
Chap 5-1 Discrete and Continuous Probability Distributions.
Generating Random Variates
Random Variable 2013.
Simulation Statistics
Continuous Probability Distributions
CONTINUOUS RANDOM VARIABLES
Chapter 5 Statistical Models in Simulation
Chapter 8 Random-Variate Generation
Chapter 6 Introduction to Continuous Probability Distributions
Further Topics on Random Variables: Derived Distributions
Further Topics on Random Variables: Derived Distributions
Experiments, Outcomes, Events and Random Variables: A Revisit
Chapter 6 Continuous Probability Distributions
Further Topics on Random Variables: Derived Distributions
Presentation transcript:

COMP155 Computer Simulation September 8, 2008

States and Events  A state is a condition of a system at some point in time  An event is something that cause a system to shift from one state to another

Last Time  FSA: Finite State Automata event driven transitions  Markov Models probabalistic transitions  Production Systems rule based transitions

Conditions and Events

Petri Nets placestransitions tokens

Petri Nets  Places are conditions  Transitions are events  Transitions can fire if all incoming places have a token  Firing a transition results in a token in all outgoing places

Petri Nets t1 and t2 are ready to fire

Petri Nets t3 is ready to fire

Petri Nets system is idle

Inputs to Petri Nets  Some places can be designated as inputs May be a time-based function for adding tokens May be an infinite source of tokens

A Manufacturing Line

Manufacturing Line: Petri Net

Mutex - Semaphore semaphore critical section

Modeling Uncertainty

Probabilistic Processes  Many of the parameters in real-world systems are probabilistic rather than deterministic  To simulate these parameters, we need random number generators

Example: Single Queue Checkout  Consider the following functional model for a single-queue of customers (i.e., a 7-11) Block K is the source of customer arrivals. Block Q is the queue of customers. Customers enter the queue immediately upon arrival and exit after checkout. Both of these blocks should be replaced by probabilistic functions. KQ

Example: Single Queue Checkout  Sources of Randomness: Customer Arrival: time between customer arrivals Checkout: time required to checkout  Although random, both times can be described statistically by probability distributions (PDs)  To model the system, we need to: determine the PD from the real systems replicate the PD with appropriate random numbers

Probability Distributions  A probability distribution describes the range of possible values that a random variable can attain, and the probability that the value of the random variable is within any subset of that range  Probability distributions may be: continuous: allowing for all values in a range (real numbers) discrete: allowing for particular values in a range (integers)

Uniform Distributions  A uniform distribution is one in which the probability of any of the possible values is the same.  Example: The time between arrivals of customers is uniformly distributed over the range [1, 10] minutes.

Uniform Distribution: Discrete 10% arrival interval (minutes) probability If we only allow for integer values in [1,10], then the probability of any one of those values is 10%. Sum of probabilities must be 1.0 (100%)

Uniform Distribution: Continuous arrival interval (minutes) probability If we allow for all real values in [1,10], we have a continuous probability distribution. Area under the curve must be 1.0 (100%) 11.11%

Non-uniform Distributions  Non-uniform distributions are described by functions, such as the familiar bell-shaped Gaussian distribution: likely valuesunlikely values

Discrete Random Variables  If the number of possible values for X is finite or countably infinite, then X is a discrete random variable.  Examples: X ∊ { 1, 2, 3, 4, 5 } (finite) X ∊ { 0, 2, 4, 6, … } (countably infinite)

Continuous Random Variables  If the range of X is an interval (or collection of intervals) of real numbers, then X is a continuous random variable.  Examples: X ∊ [1.0, 10.0] X ∊ (0.0, 1.0] or X ∊ [-1.0, 0.0) ( is exclusive, [ is inclusive

Interval Probabilities: Continuous  for continuous random variables, probabilities must be computed over intervals: where f(x) is the probability density function (pdf).

Interval Probabilities probability that r is in [a,b] is the area of shaded region f(x)

Interval Probabilities arrival interval (minutes) probability

Interval Probabilities: Discrete  for discrete random variables, probabilities summed over intervals: where f(x) is the pdf

Uniform Distribution: Discrete probability 10% arrival interval (minutes)

Common Distribution Functions  Uniform  Triangular  Exponential  Normal

Uniform Distributions  Probability of any value is the same

Triangular Distributions  Probability peaks at some mode value then decreases to 0 at ends of range c is mode, a and b are range

Triangular Distribution a c b probability

Exponential Distributions  Lambda is a rate (arrival rate, failure rate)

Exponential Distributions φ = 2 φ = 1.5 φ = 1 φ = 0.5

Normal Distributions  aka: Gaussian Distribution, Bell curve  μ = mean (average) σ 2 = variance

Normal Distributions 3σ3σ

Cumulative Distribution Functions  A CDF defines the probability that a random variable is less than some given value.  The CDF is the summation of a discrete PDF or integral of a continuous PDF

CDF for Uniform Distribution

Pseudorandomness  A pseudorandom process appears random, but isn’t  Pseudorandom sequences exhibit statistical randomness but generated by a deterministic process  Pseudorandom sequences are easier to produce than a genuine random sequences  Pseudorandom sequences can reproduce exactly the same numbers useful for testing and fixing software.

Pseudorandom Generator Seeds  Random number generators typically compute the next number in the sequence from the previous number  The first number in a sequence is called the seed to get a new sequence, supply a new seed (current machine time is useful) to repeat a sequence, repeat the seed

Uniform Distribution Generation  Most programming environments have some function for generating random numbers with a continuous uniform PDF  C/C++: int rand() (cstdlib) Java: java.util.Random Python: random() (module random)

Generating Random Numbers  If we have a uniform PDF generator, we can generate RNs for non-uniform PDFs  Given a pdf, f(x): rejection method: generate a random 2D point (x,y), if y <= f(X) use y, otherwise try again inverse transformation method: compute inverse of cumulative distribution function generate random number N in [0.0,1.0] use N as probability in CDF to generate number

Rejection Method x y f(x) get random point (x,y), where y > 0. if y < f(x), accept y with correct probability. otherwise, reject y and try again

Inverse Method  Suppose P(X=1) = 25%, P(X=2) = 50%, P(X=3) = 25% then CDF(1) = 25%, CDF(2) = 75%, CDF(3) = 100%  generate N in [0.0,1.0]  if (n <= CDF(1)) X = 1 else if (n <= CDF(2)) X = 2 else X = 3

Resources for RN Generation  Python:  C++ and Java: RandomGenerator class  Arena: textbook, appendix D

SOURCES  Petri Nets, Random Numbers: Simulation Model Design and Execution by Paul A. Fishwick, Prentice Hall, 1995  Random Number Generators Discrete-Event System Simulation, 4 th Edition Banks, Carson, Nelson and Nicol, Prentice-Hall, 2005  Random Float Generator Function  Random Distribution Functions