Monte Carlo Simulation

21
Modeling & Simulation(IS331) Tutorial Session 11 Ayman S. Abdelaziz

Transcript of Monte Carlo Simulation

Page 1: Monte Carlo Simulation

Modeling & Simulation(IS331)Tutorial Session 11

Ayman S. Abdelaziz

Page 2: Monte Carlo Simulation

MONTE CARLO SIMULATION

Page 3: Monte Carlo Simulation

What is Monte Carlo ?

▪ From the previous description we can define Monte Carlo methods generally as an experimental mathematical tool that is used to experiment with random numbers to solve or estimate complex problems.

▪ Monte Carlo simulation are usually associated with problems with theoretical interests or optimizing certain values with large amount of variables and restrictions which is otherwise almost impossible to optimize.

▪ Unlike discrete event simulation Monte Carlo simulation are not concerned with the passage of time.

▪ The interesting property of Monte Carlo simulation is that, with the appropriate set up of the problem, it can be used to solve (or estimate) both deterministic and stochastic problems as will be explained in the following examples.

Page 4: Monte Carlo Simulation

Problem 1

Get the average daily demand for a small grocery store selling a fresh bread according to the following table:

Note that: the proportion of balls of a specific color corresponds exactly to the probability of a specific level of daily demand.

Page 5: Monte Carlo Simulation

Solutions

To simulate the daily demand(5 days) Draw one ball at a time, notice its color and then place it back in the bowl. Then translate the outcomes into unique values of demand.

Expected value of simulated demand = 560/5 = 112 units / dayAnalytical solution: Expected daily demand =100(0.2) + 110(0.5) +120(0.3) = 111 units / day

Page 6: Monte Carlo Simulation

Problem 2:

Use the one-digit Random Number (6, 3, 5, 0, 8) to generate random

observations for :

Throwing an unbiased coin,

Throwing a die,

The color of a traffic found by a randomly arriving car when it

is green

40% of the time, yellow 10% of the time, and red 50% of the

time.SolutionTo simulate a coin using one digit R.N.(0-9), let 0 - 4 Represent a Head and 5 – 9 Represent a Tail; so the solution will be: (6, 3, 5, 0, 8) R. Observations (T, H, T, H, T)

Page 7: Monte Carlo Simulation

Solutions

b) To simulate a die using number 0 – 9. Let: 1 – 6 represents the faces of the die; then 0, 7, 8 and 9 are rejected. So the solution will be (6, 3, 5, 0, 8) R. Observations (6, 3, 5, reject, reject)

c) Divide 0 – 9 into 3 classes according to the given probability: Green 40% 0, 1, 2, 3 Yellow 10% 4 Red 50% 5, 6, 7, 8, 9

So (6, 3, 5, 0, 8) R. Observations (Red, Green, Red ,Green, Red)

Page 8: Monte Carlo Simulation

Problem 3: News boy

A news boy buys paper for 15 P.T. each and sells them for 25 P.T. each. Unsold papers have no value in analyzing past sells, it is found that three demand distribution exist, depending on news events in the papers. A good interesting news day yield to many potential customer, typical and poor days yield to less interest. Historically 20% of days have been “good”, 50% “typical”, 30% “Poor”, The demand distributions are summarized :Simulate 10 days period and determine main daily profit, max profit, min profit if he decides to buy 80 papers each day. Use the following R.N :-09 65 69 66 57 64 84 24 92 22 49 50 61 01 45 48 48 45 52 35

Demand Types of new days

Good Typical Poor

40 0.05

50 0.20 0.03

60 0.41 0.07

70 0.26 0.28

80 0.08 0.30 0.02

90 0.25 0.15

100 0.07 0.28

110 0.24

120 0.12

130 0.09

140 0.06

150 0.04

Page 9: Monte Carlo Simulation

Solutions

Page 10: Monte Carlo Simulation

Solutions

1st Day:RN 09 --> GoodRN 65 --> demand = 60Profit = 60*25 – 80*15 = 300 P.T 2nd Day: RN 69 --> TypicalRN 66 --> demand = 80Profit = 80*25 – 80*15 = 800 P.T 3rd Day:RN 57 --> TypicalRN 64 --> demand = 80Profit = 80*25 – 80*15 = 800 P.T4th Day:RN 84 --> poorRN 24 --> demand = 100Profit = 80*25 – 80*15 = 800 P.T ; we calculate with demand 80 NOT 100 as the newsboy buy only 80 news paper each day.

Page 11: Monte Carlo Simulation

Solutions

5th Day:RN 92 --> poorRN 22 --> demand = 100Profit = 80*25 – 80*15 = 800 P.T6th Day:RN 49 --> TypicalRN 50 --> demand = 80Profit = 80*25 – 80*15 = 800 P.T 7th Day:RN 61 --> TypicalRN 01 --> demand = 50Profit = 50*25 – 80*15 = 50 P.T8th Day:RN 45 --> TypicalRN 48 --> demand = 80Profit = 80*25 – 80*15 = 800 P.T

9th Day:RN 48 --> TypicalRN 45 --> demand = 80Profit = 80*25 – 80*15 = 800 P.T10th Day:RN 52 --> TypicalRN 35 --> demand = 70Profit = 70*25 – 80*15 = 550 P.T MIN profit: in 7th day which is 50 P.TMAX profit: is 800 P.T Main daily profit:300+800+800+800+800+800+50+800+800+550/10=650 PT

Page 12: Monte Carlo Simulation

Problem 4: The owner of car renting company, pays a penalty for each accident according to the following distribution:

The accidents occur with the probability of 30% (number of accidents per day is up to 6). Number of accidents per day has the following distribution:

Page 13: Monte Carlo Simulation

Problem 4:

Simulate 12 days. Based on your simulation what is the minimum money the owner must have to cover the penalties occurred per day. Use the following R.N: 44 99 15 97 21 47 80 28 87 13 33 42 84 27 64 59 33 84 00 10 50 51 09 31 12 94 96 97 77

Page 14: Monte Carlo Simulation

Solutions

The probability accidents occur is 30% 00 --> 29The probability accidents don’t occur is 70% 30 --> 99

Page 15: Monte Carlo Simulation

Solutions

1st Day:RN: 92 --> NO ACCIDENT2ND Day:RN: 44 --> NO ACCIDENT 3RD Day: RN: 99 --> NO ACCIDENT 4TH Day:RN: 15 --> ACCIDENTRN: 97 --> Number of accidents = 6 accidents. 1th Accident:RN: 21 --> Amount of money paid= 50 L.E 2ND Accident:RN: 47 --> Amount of money paid= 100 L.E3rd Accident:RN: 80 --> Amount of money paid= 150 L.E 4th Accident:RN: 28 --> Amount of money paid = 50 L.E 5th Accident:RN: 87 --> Amount of money paid = 200 L.E6th Accident:RN: 13 --> Amount of money paid= 50 L.EThen the total paid in this day = 50 + 100 + 150 + 50 + 200 + 50 = 600 L.E

Page 16: Monte Carlo Simulation

Solutins:

▪ 5th Day:▪ RN: 33 --> NO ACCIDENT▪ 6TH Day: ▪ RN: 42 --> NO ACCIDENT▪ 7th Day:▪ RN: 84 --> NO ACCIDENT ▪ 8th Day: ▪ RN: 27 --> ACCIDENT.▪ RN: 64 --> Number of accidents = 5 accidents.▪ 1st Accident:▪ RN: 59 --> Amount of money paid = 100 L.E▪ 2nd Accident:▪ RN: 33 --> Amount of money paid = 100 L.E▪ 3rd Accident:▪ RN: 84 --> Amount of money paid = 150 L.E▪ 4th Accident:▪ RN: 00 --> Amount of money paid = 50 L.E ▪ 5th Accident:▪ RN: 10 --> Amount of money paid = 50 L.E ▪ Then the total paid in this day = 100 + 100 + 150 + 50 + 50 =

450 L.E

Page 17: Monte Carlo Simulation

Solutins:

9TH Day:RN: 50 --> NO ACCIDENT. 10TH Day:RN: 51 --> NO ACCIDENT.11TH Day:RN: 09 --> ACCIDENT.RN: 31 --> Number of accidents = 4 accidents1st Accident:RN: 12 --> Amount of money paid= 50 L.E2nd Accident:RN: 94 --> Amount of money paid= 200 L.E3rd Accident:RN: 96 --> Amount of money paid= 200 L.E4th Accident:RN: 97 --> Amount of money paid= 200 L.EThen the total paid in this day = 50 + 200 + 200 + 200 = 650 L.E12th Day:RN: 77 --> NO ACCIDENT

Based on the above simulation :- The minimum money the owner must have to cover the penalties occurred per day (The maximum paid money in all days) = 650 L.E

Page 18: Monte Carlo Simulation

References

▪ “Simulation modeling and analysis, Fourth edition” Averill M. Law, McGraw-Hill.

Page 19: Monte Carlo Simulation

How to find your course materials?

Via Facebook:

Join this group:https://www.fb.com/groups/IS331.MUST

Page 20: Monte Carlo Simulation

How to contact me?

▪ Office hourso TUE: 03:00 to 05:00 P.M

▪ You can also contact me through:o http://fb.com/ayman.shamel

Page 21: Monte Carlo Simulation

Thanks!ANY QUESTIONS?You can find me at:[email protected]/ayman.shamel