14
Juan Pablo Tapia 24/10/2012 SIMULATION HOMEWORK 2 CHAPTER 1 BASIC CONCEPTS OF SIMULATION 1. Consider the following continuously operating job shop. Interarrival times of jobs are distributed as follows: Tiempo entre arribos (horas) Probabilidad 0 0.23 1 0.37 2 0.28 3 0.12 Processing times for jobs are normally distributed, with mean 50 minutes and standard deviation 8 minutes. Construct a simulation table and perform a simulation for 10 new customers. Assume that, when the simulation begins, there is one job being processed (scheduled to be completed in 25 minutes) and there is one job with a 50-minute processing time in the queue. (a) What was the average time in the queue for the 10 new jobs? (b) What was the average processing time of the 10 new jobs? (c) What was the maximum time in the system for the 10 new jobs? Distribution of time between arrivals time between arrivals (min) probabi lity cumulative probability rand digits 0 0,23 0,23 1 n 23 60 0,37 0,6 24 n 60 120 0,28 0,88 61 n 88 180 0,12 1 89 n 100 Service time X=Z((miu+sigma)-(miu-sigma)) + (miu – sigma) X=Z(58-42) + 42 Customer Rand number Service time

Sim

Embed Size (px)

Citation preview

Page 1: Sim

Juan Pablo Tapia 24/10/2012SIMULATION

HOMEWORK 2 CHAPTER 1BASIC CONCEPTS OF SIMULATION

1. Consider the following continuously operating job shop. Interarrival times of jobs are distributed as follows:

Tiempo entre arribos (horas) Probabilidad0 0.231 0.372 0.283 0.12

Processing times for jobs are normally distributed, with mean 50 minutes and standard deviation 8 minutes. Construct a simulation table and perform a simulation for 10 new customers. Assume that, when the simulation begins, there is one job being processed (scheduled to be completed in 25 minutes) and there is one job with a 50-minute processing time in the queue.

(a) What was the average time in the queue for the 10 new jobs?(b) What was the average processing time of the 10 new jobs?(c) What was the maximum time in the system for the 10 new jobs?

Distribution of time between arrivals

time between arrivals (min) probability cumulative probability rand digits0 0,23 0,23 1 n 23

60 0,37 0,6 24 n 60120 0,28 0,88 61 n 88180 0,12 1 89 n 100

Service time

X=Z((miu+sigma)-(miu-sigma)) + (miu – sigma)X=Z(58-42) + 42

Customer Rand number Service time1 0,336038725 472 0,798004489 563 0,17248066 514 0,192844259 525 0,027122267 506 0,83064456 577 0,6069438 558 0,542070991 549 0,841312738 57

10 0,398161296 53

Page 2: Sim

Simulation table

  arrival interarrival arrival service service time wait servicetime spend

customer rand# time (min) time timestart time in queue end time

in system

A given unknown 0 25 0 0 25 25B given unknown 0 50 25 25 75 751 0,50 60 60 47 75 15 122 622 0,60 60 120 56 122 2 178 583 0,66 120 240 51 240 0 291 514 0,11 0 240 52 291 51 343 1035 0,31 60 300 50 343 43 393 936 0,92 180 480 57 480 0 537 577 0,84 120 600 55 600 0 655 558 0,55 60 660 54 660 0 714 549 0,48 60 720 57 720 0 777 57

10 0,23 0 720 53 777 57 830 110

a) Average time in queue= sum of time in queue for all customers / number of customers = 168/10= 16,8 min

b) Average processing time= sum of service time for all customers / number of customers = 532/10= 53,2 min

c) Max time in the system = 110 min

2. Determine the best policy for ordering newspapers form Example 3 in the class material. Do the simulation table for purchase of 60, 70, and 80 newspapers. ¿Must you use the same random numbers for each experiment (60, 70, and 80 newspapers)? ¿Why YES or why NOT?

FIX AMOUNT 60

Page 3: Sim

DAY RANDOM # DAYS

TYPE OF

DAYS

RANDOM #

DEMANDDEMAND

REVENUE FROM SALES

LOST PROFIT FROM EXCESS

DEMAND

SALVAGE FROM

SALE OF RETURNED

PAPERS

DAILY GAIN

1 51 FAIR 74 70 30 1,70 0,00 8,502 50 FAIR 73 70 30 0,00 0,00 10,203 81 POOR 56 50 25 0,00 0,50 5,704 47 FAIR 45 60 30 1,70 0,00 8,505 55 FAIR 30 60 30 0,00 0,00 10,206 71 FAIR 21 50 25 0,51 0,50 5,197 27 GOOD 37 70 30 2,55 0,00 7,658 13 GOOD 91 90 30 3,23 0,00 6,979 73 FAIR 22 50 25 3,91 0,50 1,7910 18 GOOD 61 80 30 11,39 0,00 -1,1911 0 POOR 37 40 20 0,00 1,00 1,2012 40 FAIR 86 70 30 8,84 0,00 1,3613 12 GOOD 50 80 30 13,60 0,00 -3,4014 82 POOR 2 40 20 0,00 1,00 1,2015 13 GOOD 96 100 30 14,96 0,00 -4,7616 63 FAIR 56 60 30 0,00 0,00 10,2017 52 FAIR 95 90 30 13,09 0,00 -2,8918 59 FAIR 19 60 30 0,00 0,00 10,2019 85 POOR 19 40 20 0,00 1,00 1,2020 82 POOR 14 40 20 0,00 1,00 1,20

TOTAL     545 75,48 5,5 79,02

FIX AMOUNT 70

DAY RANDOM # DAYS

TYPE OF

DAYS

RANDOM #

DEMANDDEMAND

REVENUE FROM SALES

LOST PROFIT FROM EXCESS

DEMAND

SALVAGE FROM

SALE OF RETURNED

PAPERS

DAILY GAIN

1 51 FAIR 74 70 35 0,00 0,00 11,902 50 FAIR 73 70 35 0,00 0,00 11,903 81 POOR 56 50 25 0,00 1,00 2,904 47 FAIR 45 60 30 1,70 0,50 5,705 55 FAIR 30 60 30 0,00 0,50 7,406 71 FAIR 21 50 25 0,51 1,00 2,39

Page 4: Sim

7 27 GOOD 37 70 35 2,55 0,00 9,358 13 GOOD 91 90 35 3,23 0,00 8,679 73 FAIR 22 50 25 3,91 1,00 -1,0110 18 GOOD 61 80 35 11,39 0,00 0,5111 0 POOR 37 40 20 0,00 1,50 -1,6012 40 FAIR 86 70 35 8,84 0,00 3,0613 12 GOOD 50 80 35 13,60 0,00 -1,7014 82 POOR 2 40 20 0,00 1,50 -1,6015 13 GOOD 96 100 35 14,96 0,00 -3,0616 63 FAIR 56 60 30 0,00 0,50 7,4017 52 FAIR 95 90 35 13,09 0,00 -1,1918 59 FAIR 19 60 30 0,00 0,50 7,4019 85 POOR 19 40 20 0,00 1,50 -1,6020 82 POOR 14 40 20 0,00 1,50 -1,60

TOTAL     590 73,78 11 65,22

FIX AMOUNT 80

DAY RANDOM # DAYS

TYPE OF

DAYS

RANDOM #

DEMANDDEMAND

REVENUE FROM SALES

LOST PROFIT FROM EXCESS

DEMAND

SALVAGE FROM

SALE OF RETURNED

PAPERS

DAILY GAIN

1 51 FAIR 74 70 35 0,00 0,50 9,102 50 FAIR 73 70 35 0,00 0,50 9,103 81 POOR 56 50 25 0,00 1,50 0,104 47 FAIR 45 60 30 1,70 1,00 2,905 55 FAIR 30 60 30 0,00 1,00 4,606 71 FAIR 21 50 25 0,51 1,50 -0,417 27 GOOD 37 70 35 2,55 0,50 6,558 13 GOOD 91 90 40 3,23 0,00 10,379 73 FAIR 22 50 25 3,91 1,50 -3,8110 18 GOOD 61 80 40 11,39 0,00 2,2111 0 POOR 37 40 20 0,00 2,00 -4,4012 40 FAIR 86 70 35 8,84 0,50 0,2613 12 GOOD 50 80 40 13,60 0,00 0,0014 82 POOR 2 40 20 0,00 2,00 -4,4015 13 GOOD 96 100 40 14,96 0,00 -1,3616 63 FAIR 56 60 30 0,00 1,00 4,6017 52 FAIR 95 90 40 13,09 0,00 0,51

Page 5: Sim

18 59 FAIR 19 60 30 0,00 1,00 4,6019 85 POOR 19 40 20 0,00 2,00 -4,4020 82 POOR 14 40 20 0,00 2,00 -4,40

TOTAL     615 73,78 18,5 31,72

YES, I must have to use the same random numbers for this comparison to find out what would be the gain of the month if the newspaper seller buys different amount of newspapers in the same conditions.

3. Smalltown Taxi operates one vehicle during the 9:00 A.M. to 5:00 P.M. period. Currently, consideration is being given to the addition of a second vehicle to the fleet. The demand for taxis follows the distribution shown:

Time Between Calls (Minutes) 15 20 25 30 35Probability 0.14 0.22 0.43 0.17 0.04

Time Between

Calls (Hours)

Probability Cumulative Probability

Random Digits

0,25 0,14 0,14 1 -- 140,33 0,22 0,36 15 -- 360,42 0,43 0,79 37 -- 790,50 0,17 0,96 80 -- 960,58 0,04 1 97 -- 00

The distribution of time to complete a service is as follows:

Service Time (Minutes) 5 15 25 35 45Probability 0.12 0.35 0.43 0.06 0.04

Service Time

(Hours)Probability Cumulative

ProbabilityRandom

Digits

0,08 0,12 0,12 1 -- 120,25 0,35 0,47 13 -- 470,42 0,43 0,90 48 -- 900,58 0,06 0,96 91 -- 960,75 0,04 1,00 97 -- 00

Simulate 1 individual days of operation of the current system and of the system with an additional taxicab. Compare the two systems with respect to the waiting times of the customers and any other measures that might help on the situation.

ONE SERVER INTERARRIVAL CALLS SERVICE TIME

Page 6: Sim

CUSTOMER RANDOM #

INTERARRIVAL TIME

TIME CUSTOMER

ARRIVES

TIME SERVICE STARTS

RANDOM #

SERVICE TIME

TIME SERVICE

ENDS

WAITING TIME FOR

CUSTOMER

TIME INSIDE

OF SYSTEM

IDLE TIME

OF SERVER

1 58 0,42 0,42 0,42 28 0,25 0,67 0 0,25 02 30 0,33 0,75 0,75 92 0,58 1,33 0 0,58 0,083 3 0,25 1 1,33 21 0,47 1,8 0,33 0,8 04 39 0,42 1,42 1,8 61 0,42 2,22 0,38 0,8 05 64 0,42 1,84 2,22 52 0,42 2,64 0,38 0,8 06 71 0,42 2,26 2,64 17 0,25 2,89 0,38 0,63 07 30 0,33 2,59 2,89 75 0,42 3,31 0,3 0,72 08 8 0,25 2,84 3,31 14 0,25 3,56 0,47 0,72 09 14 0,25 3,09 3,56 40 0,25 3,81 0,47 0,72 010 71 0,42 3,51 3,81 90 0,58 4,39 0,3 0,88 011 6 0,25 3,76 4,39 80 0,42 4,81 0,63 1,05 012 95 0,5 4,26 4,81 98 0,75 5,56 0,55 1,3 013 59 0,42 4,68 5,56 29 0,25 5,81 0,88 1,13 014 62 0,42 5,1 5,81 5 0,08 5,89 0,71 0,79 015 26 0,33 5,43 5,89 31 0,25 6,14 0,46 0,71 016 31 0,33 5,76 6,14 26 0,25 6,39 0,38 0,63 017 47 0,42 6,18 6,39 62 0,42 6,81 0,21 0,63 018 64 0,42 6,6 6,81 43 0,25 7,06 0,21 0,46 019 42 0,42 7,02 7,06 53 0,42 7,48 0,04 0,46 020 18 0,33 7,35 7,48 89 0,42 7,9 0,13 0,55 021 8 0,25 7,6 7,9 9 0,08 7,98 0,3 0,38 022 14 0,25 7,85 7,98 82 0,42 8,4 0,13 0,55 023 43 0,42 8,27 8,4 39 0,25 8,65 0,13 0,38 0

TOTAL 7,77PROM 0,34

TWO SERVERS INTERARRIVAL CALLS S1 SERVICE TIME S2 SERVICE TIME

CUSTOMER RANDOM #

INTERARRIVAL TIME

TIME CUSTOMER

ARRIVES

RANDOM #

TIME SERVICE STARTS

SERVICE TIME

TIME SERVICE

ENDS

TIME SERVICE STARTS

SERVICE TIME

TIME SERVICE

ENDS

WAITING TIME FOR

CUSTOMER

TIME INSIDE

OF SYSTEM

1 7 0,25 0,25 77 0,25 0,42 0,67   0,42   0 0,422 15 0,33 0,58 19 0 0,25 0 0,58 0,25 0,83 0 0,253 52 0,42 1 21 1 0,25 1,25 0 0,25 0 0 0,254 49 0,42 1,42 51 1,42 0,42 1,84 0 0,42 0 0 0,425 34 0,33 1,75 99 0 0,75 0 1,75 0,75 2,5 0 0,756 72 0,42 2,17 33 2,17 0,25 2,42 0 0,25 0 0 0,257 43 0,42 2,59 85 2,59 0,42 3,01 0 0,42 0 0 0,428 23 0,33 2,92 84 0 0,42 0 2,92 0,42 3,34 0 0,429 80 0,5 3,42 56 3,42 0,42 3,84 0 0,42 0 0 0,4210 77 0,42 3,84 65 0 0,42 0 3,84 0,42 4,26 0 0,4211 98 0,58 4,42 38 4,42 0,25 4,67 0 0,25 0 0 0,25

Page 7: Sim

12 38 0,42 4,84 37 4,84 0,25 5,09 0 0,25 0 0 0,2513 78 0,42 5,26 97 5,26 0,75 6,01 0 0,75 0 0 0,7514 52 0,42 5,68 21 0 0,25 0 5,68 0,25 5,93 0 0,2515 2 0,25 5,93 73 5,93 0,42 6,35 0 0,42 0 0 0,4216 94 0,5 6,43 7 6,43 0,08 6,51 0 0,08 0 0 0,0817 55 0,42 6,85 60 6,85 0,42 7,27 0 0,42 0 0 0,4218 98 0,58 7,43 89 7,43 0,42 7,85 0 0,42 0 0 0,4219 62 0,42 7,85 10 0 0,08 0 7,85 0,08 7,93 0 0,0820 67 0,42 8,27 39 8,27 0,25 8,52 0 0,25 0 0 0,2521 31 0,33 8,6 82 8,6 0,42 9,02 0 0,42 0 0 0,42

PROM TOTAL 0PROM 0,00

With 2 servers any client has to wait to be served but the amount of clients decrease.

4. Given A, B, and C, which are uncorrelated random variables, Variable A is normally distributed with = 100 and ² = 400. Variable B is discrete uniformly distributed with a probability distribution given by p(b)=1/5 with b = 0, 1, 2, 3, and 4. Variable C is distributed in accordance with the following table:

Value of C Probability10 0.1020 0.2530 0.5040 0.15

Use simulation to estimate the mean of a new variable D, that is defined as

Use a sample of size 30. Prepare a histogram of the resulting values, using class intervals of width equal to 3

VARIABLE A= 400Z+100

VARIABLE C

VALUE PROBABILITY CUMULATIVE PROBAILITY

RANDOM DIGITS

10 0,10 0,10 1 -- 1020 0,25 0,35 11 -- 3530 0,50 0,85 36 -- 8540 0,15 1,00 86 -- 00

VARIABLE A VARIABLE B VARIABLE C 

No, Random # A= 400Z+100 Random # VALUE Random # VALUE

1 0,19529021 178 7 4 99 40 0,982 0,39334054 257 5 3 55 30 3,043 0,22893181 192 3 2 96 40 1,77

VARIABLE B

VALUE PROBABILITY CUMULATIVE PROBAILITY

RANDOM DIGITS

 1 0,2 0,2 1 -- 22 0,2 0,4 3 -- 43 0,2 0,6 5 -- 64 0,2 0,8 7 -- 85 0,2 1 9 -- 0

CBAD 2/25

Page 8: Sim

4 0,00161558 101 3 2 83 30 0,845 0,74499521 398 2 1 31 20 9,326 0,27940734 212 8 4 62 30 1,867 0,96297225 485 8 4 53 30 6,428 0,79287938 417 4 2 52 30 6,129 0,6346319 354 9 5 41 30 3,8110 0,09562737 138 1 1 70 30 1,8911 0,10513288 142 6 3 69 30 1,1212 0,04753644 119 4 2 77 30 1,1513 0,92373621 469 4 2 71 30 6,9914 0,97245358 489 2 1 28 20 11,6015 0,20348779 181 7 4 30 20 2,0316 0,02772287 111 5 3 74 30 0,6017 0,73624255 394 9 5 81 30 4,4918 0,60815797 343 8 4 97 40 3,0419 0,29968795 220 3 2 81 30 2,8320 0,79085832 416 8 4 42 30 5,2721 0,59188292 337 7 4 43 30 3,9522 0,71611796 386 8 4 86 40 3,5823 0,16732452 167 3 2 7 10 5,8524 0,38668292 255 7 4 30 20 3,8725 0,9714819 489 7 4 34 20 9,7126 0,61626406 347 1 1 49 30 5,3627 0,98042981 492 5 3 52 30 6,9528 0,76738413 407 4 2 15 20 8,9229 0,31902419 228 3 2 7 10 8,8830 0,96840157 487 7 4 79 30 6,46

MEAN 4,62

Page 9: Sim

5. Estimate, by simulation, the average number of lost sales per week for an inventory system that functions as follows:

(a) Whenever the inventory level falls to or below 10 units, an order is placed. Only one order can be outstanding at a time.

(b) The size of each order is equal to 20 – I, where I is the inventory level when the order is placed(c) If a demand occurs during a period when the inventory level is zero, the sale is lost.(d) Daily demand is normally distributed, with a mean of 5 units and a standard deviation of 1.5

units. (Round off demands to the closest integer during the simulation and, if a negative value results, give it a demand of zero.)

(e) Lead time is distributed uniformly between zero and 5 days—integers only.(f) The simulation will start with 18 units in inventory.(g) For simplicity, assume that orders are placed at the close of the business day and received

after the lead time has occurred. Thus, if lead time is one day, the order is available for distribution on the morning of the second day of business following the placement of the order.

(h) Let the simulation run for 2 weeks.

Daily demand D= 1.5Z+5 Lead-time

Lead Time Probability Cumulative Probability

Random Digits

0 0,167 0,167 1 -- 1671 0,167 0,333 168 -- 3332 0,167 0,500 334 -- 5003 0,167 0,667 501 -- 6674 0,167 0,833 668 -- 8335 0,167 1,000 834 -- 000

Page 10: Sim

DAILY DEMAND LEAD-TIME

DAYS No. Random # Z

STOCK AVIABLE

DEMAND D=

1.5Z+5LOST

SALESSTOCK END OF THE DAY

AMOUNT OF ORDER

Random # Lead-time

LUNES 1 0,074 18 5   13 0    MARTES 2 0,800 13 6   7 13 415 2

MIÉRCOLES 3 0,441 7 6   1 0    JUEVES 4 0,264 1 5 4 -4 0    VIERNES 5 0,134 13 5   8 12 34 0SÁBADO 6 0,933 20 6   13 0    DOMINGO 7 0,386 13 6   8 12 43 0LUNES 8 0,479 20 6   14 0    MARTES 9 0,213 14 5   9 11 880 5

MIÉRCOLES 10 0,144 9 5   4 0    JUEVES 11 0,253 4 5 2 -2 0    VIERNES 12 0,422 0 6 7 -6 0    SÁBADO 13 0,470 0 6 13 -6 0    DOMINGO 14 0,784 0 6 19 -6 0    

LOST SALES W1 4LOST SALES W2 41

MEAN: 22,5

6. A bank has one drive-in teller and room for one additional customer to wait. Customers arriving when the queue is full park and go inside the bank to transact business. The between arrivals and the service- time distribution follow:

Distribution of time between arrivalstime between arrivals

(min) probability cumulative probability rand digit0 0,09 0,09 01 n 091 0,17 0,26 10 n 262 0,27 0,53 27 n 533 0,2 0,73 54 n 734 0,15 0,88 74 n 885 0,12 1 89 n 00

Service time distributionservice time (min) probability cumulative probability rand digit

Time Between Arrivals (Minutes) Probability Service Time

(minutes) Probability

0 0.09 1 0.201 0.17 2 0.402 0.27 3 0.283 0.20 4 0.124 0.155 0.12

Page 11: Sim

1 0,20 0,20 01 n 202 0,40 0,60 21 n 603 0,28 0,88 61 n 884 0,12 1,00 89 n 00

Simulate the operation of the drive-in teller for 10 new customers. The first of the 10 new customers arrives at a time determined at random. Start the simulation with one customer being served, leaving at time 3, and one in the queue. How many customers went into the bank to transact business?

customer#

arrivalrand#

interarrival T

arrival T

servicerand#

service T

in queu

ebefor

e arriv

in queu

eafter arriv

service

starts

service

ends

Go inbank

?  A given unknown 0 given 3 0 0 0 3 no 0B given unknown 0 0,0780073 1 0 1 3 6 no 0

10,3544758

4 2 20,6457322

1 3 1 1 -99 -99 yes 1

20,5594707

3 3 50,4733137

5 2 1 1 -99 -99 yes 1

30,2343534

5 1 60,6841928

5 3 0 1 7 9 no 0

40,8029364

7 4 10 0,2390902 2 0 1 11 14 no 0

50,8050905

6 4 140,3066131

5 2 1 1 -99 -99 yes 1

60,5485942

4 3 170,0693864

7 1 0 1 15 18 no 0

70,2632238

1 1 180,2565438

3 2 0 1 18 19 no 0

80,5426760

3 3 210,2427383

3 2 0 1 20 21 no 0

90,3307631

4 2 230,0604016

3 1 0 1 25 27 no 0

100,5694972

1 3 260,7356141

2 3 0 1 30 34 no 0

4 customers went into the bank.