1 / 26

NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly

NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly. Lecture (2) Simulation Examples. Steps in a Simulation Study. Example 1: Coin Tossing Problem. Simulate a sequence of 20 coin tosses The coin is fair Possible outcomes: Head ( H ) or Tail ( T )

avian
Download Presentation

NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly

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. NETW 707 Modeling and Simulation Amr El Mougy Maggie Mashaly

  2. Lecture(2) Simulation Examples

  3. Steps in a Simulation Study

  4. Example 1: Coin Tossing Problem • Simulate a sequence of 20 coin tosses • The coin is fair • Possible outcomes: Head(H) or Tail(T) • Probability of each outcome = 0.5 • The outcome is random • Userandom number generator to simulate the outcome • Run the simulation multiple times and compare with what you expect from real life coin tossing

  5. Each game is 20 tosses • Toss coin 20 times • Excel function RAND() produces random numbers in the range [0,1] • IF(RAND() ≤ 0.4999, “H”, “T”) • COUNTIF(range, “H”)

  6. Play the game 20 times

  7. Conclusions • This is a Monte-Carlo simulation because there are no events or clock times being tracked • The model is the idea. In our model we assume that if the generated random number is less that 0.5 we got a Head and otherwise we got a Tail • The translation is the statement: IF(RAND() ≤ 0.4999, “H”, “T”) • The measure of performance may be the frequency of occurrence as in the coin simulation table or the average of occurrence as in the game replication table

  8. Example 2 : Simulating Random Service Times • An automated telephone information service spends either 3, 6, or 10 minutes with each caller. The proportion of calls for each service length is 30%, 45%, and 25%, respectively • Simulate these service times for 10 callers in a spreadsheet

  9. Recall that: In a discretedistribution, the length of an interval is proportional to its probability of occurrence Probabilities 0.30 0.45 0.25 Cumulative Probabilities 1 0.75 0.30 6 10 Service Times (minutes) 3

  10. Solution using (IF) Function in MS-EXCEL IF(N9≤0.3,3,IF(N9≤0.75,6,10))

  11. Solution using Random Number Generator (RNG) • From Excel data tab  data analysis  random number generation  discrete • Generation of discrete random numbers requires the probability of each value

  12. Example 3: Simulation Random Arrival Times • Telephone calls to the telephone information service occur at random times defined by a discrete distribution for which the inter-arrival times have values 1, 2, 3, or 4 minutes, all with equal probability • Generate inter-arrival times and arrival times for 25 callers

  13. Solution • The example has one event, the arrival event, it is an event-based model • The model tracks the progression of events over time; the model is dynamic • The model is dynamic event-based • This problem can be solved in the same manner as the random service times are generated

  14. Solution: Method (1) • Go to Excel  data tab  data analysis  random number generation  uniform • Specify the range 1 to 4 • Use the Excel function ROUND to obtain discrete values • Construct the table as shown in the following slide • Note: simulating 25 callers requires 24 inter-arrival times • Obtain statistical outputs

  15. Solution: Method (1)

  16. Solution: Method (2) • Go to Excel  data tab  data analysis  random number generation  discrete • Specify the values and corresponding probabilities • Construct the table as shown in the following slide • Obtain statistical outputs

  17. Solution: Method (2)

  18. A Coin Tossing Game • Ahmed tosses a coin for his friends, Sara and Mai, exactly 100 times. Sara loses $1 when a head lands up, and Mai loses $1. Mai wins $1 when a coin lands up on tails, with Sara paying $1. Ahmed tracks their respective wins and losses as they play the game • Which of the following is more likely and by how much: • Sara and Mai are each ahead on about ½ the tosses; i.e. Sara is ahead on about 45 to 55 tosses and Mai is ahead on about 45 to 55 tosses • Sara is ahead on 95 or more tosses • Sara is ahead on 5 or fewer tosses

  19. Solution:1- Create Spreadsheet Simulation

  20. Solution:2- Extract Results from the Simulation Be careful!! The outcome of the simulation must match the objectives of the study

  21. Solution:3- Run the Simulation for Sufficient Times The accuracy of the results, and hence the correctness of your decision, depends on the number of simulations

  22. Solution:4- Perform Statistical Analysis

  23. Solution:5- Results • When the game was run 20 times, it was found that: • Sara and Mai were each ahead on about ½ the tosses for 4 games. (probability = 1/20 = 5%) • Sara is ahead on 95 or more tosses for 7 games. (Probability = 35%) • Sara is ahead on 5 or fewer tosses for 10 games. (Probability = 50%) Note: the game was played 20 times only. For accurate results more runs are needed

  24. Guidelines for the Development of Simulations • Determine the characteristics of each input to the simulation, e.g.: constants, probability distributions • Determine the events, activities, and states relevant to the problem • Determine model responses or summary performance measures, depending on objectives • Determine model outputs needed for obtaining model responses

  25. Guidelines for the Development of Simulations 5. Construct a simulation table a shown. Initialize the table for the first step if necessary Activities and System States Outputs Step xi1 xi2 … xij … xipyi • There are p activities and system states, xij , j = 1, 2, ……., n • There is one output yifor each simulation step 1 2 3 . . . n

  26. Guidelines for the Development of Simulations 6. For each step (i), generate an output for each of the activities, then compute the system states and the outputs yi. Random input values may be computed by sampling values from the distributions chosen in Step 1. 7. When the simulation is finished, use the outputs to compute the model responses or measures of performance

More Related