1 / 17

Discrete Event Simulation

Discrete Event Simulation. How to generate RV according to a specified distribution? geometric Poisson etc. Example of a DEVS: repair problem. Outline. What is discrete event simulation? Events Probability Probability distributions Sample application.

wmilligan
Download Presentation

Discrete Event Simulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Discrete Event Simulation • How to generate RV according to a specified distribution? • geometric • Poisson etc. • Example of a DEVS: • repair problem

  2. Outline What is discrete event simulation? Events Probability Probability distributions Sample application

  3. What is discrete event simulation? “Simulation is the process of designing a model of a real system and conducting experiments with this model for the purpose either of understanding the behavior of the system or of evaluating various strategies (within the limits imposed by a criterion or set of criteria) for the operation of a system.” -Robert E Shannon 1975 “Simulation is the process of designing a dynamic model of an actual dynamic system for the purpose either of understanding the behavior of the system or of evaluating various strategies (within the limits imposed by a criterion or set of criteria) for the operation of a system.” -Ricki G Ingalls 2002 Definitions from http://staff.unak.is/not/andy/Year%203%2Simulation/Lectures/SIMLec2.pdf

  4. What is discrete event simulation? • A simulation is a dynamic model that replicates the behavior a real system. • Simulations may be deterministic or stochastic, static or dynamic, continuous or discrete. • Discrete event simulation (DEVS) is stochastic, dynamic, and discrete. • DEVS is not necessarily spatial – it usually isn’t, but the ideas are applicable to many spatial simulations

  5. What is discrete event simulation? • DEVS has been around for decades, and is supported by a large set of supporting tools, programming languages, conventional practices, etc. • Like other kinds of simulation, offers an alternative, often simple way of solving a problem – simulate system and observe results, instead of coming up with analytical model. • Many other benefits like repeatability, ability to use multiple parameter sets, experimental treatment of what may be unique system, cheap compared to physical experiment, etc. • Usually involves posing a question. The simulation estimates an answer.

  6. What is discrete event simulation? • Stochastic = probabilistic • Dynamic = changes over time • Discrete = instantaneous events are separated by intervals of time Time may be modeled in a variety of ways within the simulation.

  7. Alternate treatments of time Time divided into equal increments: Unequal increments: Cyclical:

  8. Termination • Simulation may terminate when a terminating condition is met. • May also be periodic. • Can also be conceptually endless, like weather, terminated at some arbitrary time. • Usually converges or stabilizes on particular result.

  9. Events • May change the state of the system. • Have no duration. • If time is event-based, events happen when time advances. • Canonical example: flipping a coin. • Events usually have a value associated with them (e.g. coin: true/false). • The definition of an event depends on the subject of the model.

  10. Random Variables • A random variable (“X”) is numerical value associated with a random event. • X can have different values: • X1, X2, X3…Xn • In a stochastic DEVS, the value associated with event is probablistic, that is it occurs with a given probability. • That probability is what allows us to use DEVS to estimate results when we don’t know the precise value of input parameters to our model.

  11. Pseudorandom Number Generators • A stochastic simulation depends on a pseudorandom number generator to generate usable random numbers. • These generators can vary significantly in quality. • For practical purposes, it may be important to check the random number generator you are using to make sure it behaves as expected. Example: Using matlab’s rand(), let us simulate a coin toss and test how good the random number generator is.

  12. Probability distributions • In a DEVS, you need to decide what probability distribution functions best model the events. • Pseudorandom number generators generate numbers in a uniform distribution • One basic trick is to transform that uniform distribution into other distributions. • There are many basic probability distributions are convenient to represent mathematically. • They may or may not represent reality, but can be useful simplifications.

  13. Normal or Gaussian distribution • Ubiquitous in statistics • Many phenomena follow this distribution • When an experiment is repeated, the results tend to be normally distributed.

  14. Simulating a Probability distribution Sampling values from an observational distribution with a given set of probabilities (“discrete inverse transform method”). Generate a random number U If U < p0 return X1 If U < p0 + p1 return X2 If U < p0 + p1 + p2 return X3 etc. This can be speeded up by sorting p so that the larger intervals are processed first, reducing the number of steps.

  15. Poisson distribution • Example of algorithm to sample from a distribution. • X follows a Poisson distribution if: An algorithm for sampling from a Poisson distribution: 1. Generate a random number U 2. If i=0, p=e-l, F=p 3. If U < F, return I 4. P = l * p / (i + 1), F = F + p, i = i + 1 5. Go to 3 There are similar tricks to sampling from other probability distributions. Some tools like Matlab have these built in.

  16. A repair problem n machines are needed to keep an operation. There are s spare machines. The machines in operation fail according to some known distribution (e.g. exponential, Poisson, uniform etc. with a known mean). When a machine fails, it is sent to repair shop and the time to fix is a random variable that follows a known distribution. Question: What is the expected time for the system to crash? System crashes when fewer than n machines are available.

  17. Plotting outcome of experiments • The expected value (mean) will converge after a number of repetitions. • We can demonstrate the process of flipping coins…with a simulation. Here are two runs of a simulated sequences of 1000 coin flips (see code), displaying the average result (sum of Xi / n): Note that the variance is high initially and diminishes with time.

More Related