Simulation

Embed Size (px)

DESCRIPTION

Simulation Basic Information

Citation preview

  • SIMULATIONSimulation is to imitate reality to represent reality.

    Simulation is a technique for conducting experimentsSimulation is descriptive and not optimizing techniqueSimulation is a process often consists of repetition of an experiment in many, many timesto obtain an estimate of the overall effect of certain actions.Simulation is usually called for only when the problem under investigation is toocomplex to be treated by analytical models or by numerical optimization techniques.

    In a simulation, a given system is copied and the variables and constants associated withit are manipulated in that artificial environment to examine the behaviour of the system.

    In general terms, Simulation involves developing a model of some real life phenomenonand then performing experiments on the model evolved.

    Often we do not find a mathematical technique that; a model once constructed maypermit us to predict what will be the consequences of taking a certain action. In particularwe could experiment on the model by trying alternative actions or parameters and

    compare their consequences. This experimentation allow us to answer what if

    questions relating the effects of your assumption on the model response.The availability of the computers makes it possible for us to deal with an extraordinarylarge quantity of details which can be incorporated into a model and the ability tomanipulate the model over many experiments (i.e. replicating all the possibilities thatmay be imbedded in the external world and events would seem to recur).For example,

    Testing of an aircraft model in a wind tunnel to test the aerodynamic properties ofan the model

    A model of a traffic signal system

    Military war games

    Business games for training

    Planetarium etc.

  • Simulation definedA simulation of a system or an organism is the operation of a model or simulator which isa representation of the system or organism. The model is amenable to manipulationwhich would be impossible, too expensive or unpractical to perform on the entity itportrays. The operation of the model can be studied and for it, properties concerning thebehaviour of the actual system can be inferred.-ShubikSimulation is the process of designing a model of a real system and conducting theexperiments with this model for the purpose of understanding the behaviour (within thelimits imposed by a criterion or set of criterion) for the operation of the system.

    - ShannonSteps of Simulation process

    Step 1: Identify the problem.If an inventory system is being simulated, then the problem may concern thedetermination of the size of the order (number of units to be ordered) when the inventoryfalls up to the reorder level (point).Step 2: Identify the decision variables, performance criterion (objective) and the decisionrules.

    In the context of the above defined inventory problem, the demand (consumption rate),lead time and safety stock are identified as the decision variable. These variables shall beresponsible to measure the performance of the system in terms of total inventory costunder the decision rule- when to order.Step 3: Construct a numerical model.Numerical model is constructed to be analyzed on the computer. Some times the model iswritten in a particular simulation language which is suited for the problem under theanalysis.

    Step 4: Validate the modelValidation is necessary to ensure whether it is truly representing the system beinganalyzed and the results will be reliable.Step 5: Design the experiments

  • Conduct experiments with the simulation model by listing specific values of variables tobe tested (i.e. list courses of action for testing) at each trail (run).Step 6: Run the simulation model.Run the model on the computer to get the results in form of operating characteristics.Step 7: Examine the results.Examine the results of the problem as well as their reliability and correctness. If thesimulation is complete, then select the best course of action (or alternative) otherwisemake the desired changes in the model decision variables, parameters or design andreturn to step 3.

    Advantages of simulation1. Simulation is a straight forward and simple technique2. The technique is very useful to analyze large and complex problems which are not

    amenable to mathematical or quantitative methods.3. It is an interactive method, which enables the decision maker to study the changes andtheir effects on the performance of the system.

    4. The experiments in a simulation are run on the model and not on the system itself.

    Limitations of simulation1. At times simulation models can be very costly and expensive2. It is trail and error technique to produce different solutions in repeated runs.3. The solution obtained from the simulation may not be optimal.4. The simulation model needs to be examined and analyzed for decision making. It only

    creates an alternative and not an optimal solution by itself.

    Monte-Carlo techniques or Monte-Carlo simulation.The Monte-Carlo method is a simulation technique in which statistical distributionfunctions are created by using series of random numbersRandom numbers.The underlying theory in random number is that, each number has an equal opportunityof being selected.

  • There are various ways in which random numbers may be generated. These could be:result of some device like coin or die; published table of random numbers, mid-squaremethod, or some other sophisticated method.It may be mentioned here that random numbers generated by some method may not bereally random in nature. In fact such numbers are called pseudo-random-numbers.Rand corporation (of USA): A million random digits, is a random number table used insimulation situations. The numbers in these tables are in random arrangement.The Monte-Carlo simulation technique consists of the following steps.

    1. Setting up a probability distribution for variables to be analyzed.2. Building a cumulative probability distribution for each random variable.3. Generating random numbers. Assign an appropriate set of random numbers to

    represent value or range (interval) of values for each random variable.4. Conduct the simulation experiment by means of random sampling5. Repeat Step 4 until the required number of simulation runs has been generated.6. Design and implement a course of action and maintain control.

    Example 1.A bakery keeps stock of popular brand of cake. Previous experience shows the dailydemand pattern for the item with associated probabilities, as given below:

    Daily demand(number) 0 10 20 30 40 50Probability 0.01 0.20 0.15 0.50 0.12 0.02

    Use the following sequence of random numbers to simulate the demand for next 10 days.

    Random Numbers 40 19 87 83 73 84 29 09 02 20

    Also estimate the daily average demand for the cakes on the basis of simulated data.Solution:

    Using the daily demand distribution, we obtain a probability distribution as shown in thefollowing Table.

  • Daily demand distribution

    Daily Demand Probability Cumulative Probability Random Number Interval

    0 0.01 0.01 00

    10 0.20 0.21 01-20

    20 0.15 0.36 21-35

    30 0.50 0.86 36-85

    40 0.12 0.98 86-97

    50 0.02 1.00 98-99

    By conducting the simulation experiment for demand by taking a sample of 10 randomnumbers from the table of random numbers we get,

    Days Random Number Demand

    1 40 30 Because 0.36 < 0.40 < 0.85

    2 19 10 Because 0.01 < 0.19 < 0.20

    3 87 40 and so on

    4 83 30

    5 73 30

    6 84 30

    7 29 20

    8 09 10

    9 02 10

    10 20 10

    Total = 220

    Expected demand = 220/10 = 22 units per day.

  • Example 2.XYZ spare parts company wishes to determine the level of stock it should carry for itemsin its range. Demand is not certain and there is a lead time for stock replenishment. Forone item X, the following information is obtained.

    Demand(Units/day)

    3 4 5 6 7

    Probability 0.10 0.20 0.30 0.30 0.10

    Carrying

    cost(Per unitper day)

    Rs.2

    Orderingcost(perorder)

    Rs.50

    Lead time forreplenishment

    3 days

    Stock on hand at the beginning of the simulation exercise was 20 units.Carry out a simulation run over a period of 10 days with the objective of evaluating theinventory rule:

    Order 15 units when present inventory plus outstanding falls below 15 units.The sequence of random numbers to be used is :0,9,1,1,5,1,8,6,3,5,7,1,1,2,9 using thefirst number for day one.Solution:Let us begin the simulation by assuming thati) orders are placed at the end of the day and received after 3 days at the end of the day.ii) back orders are accumulated in case of short supply and are supplied when stock isavailable.The cumulative probability distribution and the random number range for daily demand isshown in the table.

  • Daily Demand Distribution

    Daily Demand Probability CumulativeProbability

    Random NumberRange

    3 0.10 0.10 00

    4 0.20 0.30 01-02

    5 0.30 0.60 03-05

    6 0.30 0.90 06-08

    7 0.10 1.00 09

    The results of the simulation experiment conducted are as shown below.

    Days OpeningStock

    RandomNumber

    Resulting

    DemandClosingStock

    OrderPlaced

    OrderDelivered

    Average stock

    in the evening

    1 20 0 3 17 - - 18.5

    2 17 9 7 10 15 - 13.5

    3 10 1 4 6 - - 8

    4 6 1 4 2 - - 4

    5 2 5 5 0(-3)* 15 15 16 12 1 4 8 - - 10

    7 8 8 6 2 - - 5

    8 2 6 6 0(-4)* 15 15 19 11 3 5 6 - - 8.5

    10 6 5 5 1 - - 3.5

    *Negative figure indicates back orders.

    Average ending stock = 73/10 = 7.3 units/dayDaily ordering cost = (Cost of placing one order) x (Number of orders placed perday)

    = 50 x 0.3 = Rs.15Daily carrying cost = (Cost of carrying one unit per day) x (Average ending stock)

    = 2 x 7.3 = Rs.14.6Total daily inventory cost = Daily ordering cost + Daily carrying cost

    = 15 + 14.6= Rs.29.6

  • Example 3.A small retailer deals in a perishable commodity, the daily demand and supply of whichare random variables. The past 500 days data show the following:

    Supply Demand

    Available ( kg ) Number of Days Demand (kg ) Number of Days10 40 10 50

    20 50 20 110

    30 190 30 200

    40 150 40 100

    50 70 50 40

    The retailer buys the commodity at Rs.20 per kg and sells at Rs.30 per kg. If anycommodity remains at the end the day it has no resale value and is a dead loss. Moreover,the loss on any unsatisfied demand is Rs.8 per kgGiven the following random numbers. Simulate six day sales.

    31 18 63 84 15 79 07 32 43 75 81 27

    Using the random numbers alternatively, for example, first pair (31) to simulate supplyand second pair (18) to simulate demand, etc.Solution:

    Probability and Random Number Interval for Daily Demand and Supply

    Available(kg)

    Probability RandomNumber

    Demand(kg)

    Probability RandomNumber

    10 40/500=0.08 00-07 10 50/500=0.10 00-09

    20 50/500=0.10 08-17 20 110/500=0.22 10-31

    30 190/500=0.38 18-55 30 200/500=0.40 32-71

    40 150/500=0.30 56-85 40 100/500=0.20 72-91

    50 70/500=0.14 85-99 50 40/500=0.08 92-99

  • Simulation Experimentation Sheet

    Day RandomNumber

    Supply(kg)

    RandomNumber

    Demand(kg)

    Cost(Rs)

    Revenue

    (Rs)Shortage(Loss)

    Profit

    1 31 30 18 20 600 600 - -

    2 63 40 84 40 800 1,200 - 400

    3 15 20 79 40 400 600 160 40

    4 07 10 32 30 200 300 160 -60

    5 43 30 75 40 600 900 80 220

    6 81 40 27 20 800 600 - -200

    The above table shows that during these six days period retailer makes a net profit

    of Rs.400.

    Example 4.A sample of 100 arrivals of a customer at a retail sales depot is according to the followingdistribution.

    Time between arrival(Minutes) Frequency0.5 2

    1.0 6

    1.5 10

    2.0 25

    2.5 20

    3.0 14

    3.5 10

    4.0 7

    4.5 4

    5.0 2

  • A study of the time required to service customers by adding up the bills, receivingpayments and placing packages, yields the following distribution

    Time between service(Minutes) Frequency0.5 12

    1.0 21

    1.5 36

    2.0 19

    2.5 7

    3.0 5

    Estimate the average percentage of customer waiting time and average percentage of idletime of the server by simulation for the next 10 arrivals.Solution:Arrival

    Arrivals Frequency Probability CumulativeProbability

    Random No.Interval

    0.5 2 0.02 0.02 00-01

    1.0 6 0.06 0.08 02-07

    1.5 10 0.10 0.18 08-17

    2.0 25 0.25 0.43 18-42

    2.5 20 0.20 0.63 43-62

    3.0 14 0.14 0.77 63-76

    3.5 10 0.10 0.87 77-86

    4.0 7 0.07 0.94 87-93

    4.5 4 0.04 0.98 94-97

    5.0 2 0.02 1.00 98-99

  • Service

    Time betweenservice(Minutes)

    Frequency Probability CumulativeProbability

    Random No.Interval

    0.5 12 0.12 0.12 00-11

    1.0 21 0.21 0.33 12-32

    1.5 36 0.36 0.69 33-68

    2.0 19 0.19 0.88 69-87

    2.5 7 0.07 0.95 88-94

    3.0 5 0.05 1.00 95-99

    Arrival

    No.

    RandomNo.

    Inter

    Arrival

    Time

    (Mins.)

    Arrival

    Time

    (Mins)

    RandomNo.

    ServiceTime

    (Mins)

    ServiceStart

    ServiceEnd

    Wt.time

    of the

    endcustomer

    Wt.time

    of the

    Server

    1 93 4.0 4.0 78 2.0 4 6 - 4.0

    2 22 2.0 6.0 76 2.0 6 8 - -

    3 53 2.5 8.5 58 1.5 8.5 10.0 - 0.5

    4 64 3.0 11.5 54 1.5 11.5 13 - 1.5

    5 39 2.0 13.5 74 2.0 13.5 15.5 - 0.5

    6 07 1.0 14.5 92 2.5 15.5 18 1.0 -

    7 10 1.5 16.0 38 1.5 18.0 19.5 2.0 -

    8 63 3.0 19.0 70 2.0 19.5 21.5 0.5 -

    9 76 3.0 22.0 96 3.0 22.0 25.0 - 0.5

    10 35 2.0 24.0 92 2.5 25.0 27.5 1.0 -

    Total 4.5 7.0Average waiting time per customer is 4.5/10 = 0.45 minutesAverage waiting time or idle time of the server = 7.0/10 = 0.7 minutes.

  • Example 5.

    A tourist car operator finds that during the past few months the cars use has varied somuch that the cost of maintaining the car varied considerably. During the past 200 daysthe demand for the car fluctuated as below.

    Trips per week Frequency

    0 16

    1 24

    2 30

    3 60

    4 40

    5 30

    Using the random numbers simulate the demand for a 10 week period.Solution:

    Trips per

    week/

    Demand perweek

    Frequency Probability CumulativeProbability

    RandomNumberInterval

    0 16 0.08 0.08 00-07

    1 24 0.12 0.20 08-19

    2 30 0.15 0.35 20-34

    3 60 0.30 0.65 35-64

    4 40 0.20 0.85 65-84

    5 30 0.15 1.00 85-99

  • The simulated demand for the cars for the next 10 weeks period is given in the tablebelow

    Week Random Number Demand

    1 82 4

    2 96 5

    3 18 1

    4 96 5

    5 20 2

    6 84 4

    7 56 3

    8 11 1

    9 52 3

    10 03 0

    Total 28

    Average Demand = 28/10 = 2.8 cars per week

  • Example 6.An automobile production line turns out about 100 cars a day, but deviations occur owingto many causes. The production is more accurately described by the probabilitydistribution given below.

    Production per day Probability

    95 0.03

    96 0.05

    97 0.07

    98 0.10

    99 0.15

    100 0.20

    101 0.15

    102 0.10

    103 0.07

    104 0.05

    105 0.03

    Finished cars are transported across the bay at the end of each day by the ferry. If theferry has space for only 101 cars, what will be the average numbers of waiting to beshipped and what will be the average number of empty space on the ship?Solution:

    Production per day Probability CumulativeProbability

    Random NumberInterval

    95 0.03 0.03 00-02

    96 0.05 0.08 03-07

    97 0.07 0.15 08-14

    98 0.10 0.25 15-24

    99 0.15 0.40 25-39

    100 0.20 0.60 40-59

    101 0.15 0.75 60-74

    102 0.10 0.85 75-84

  • 103 0.07 0.92 85-91

    104 0.05 0.97 92-96

    105 0.03 1.00 97-99

    The simulated production of cars for the next 15 days is given in the following table.

    Day RandomNumber

    Production perday

    No. of cars

    waiting

    No. of empty

    space in the

    ship

    1 97 105 4 -

    2 02 95 - 6

    3 80 102 1 -

    4 66 101 - -

    5 96 104 3 -

    6 55 100 - 1

    7 50 100 - 1

    8 29 99 - 2

    9 58 100 - 1

    10 51 100 - 1

    11 04 96 - 5

    12 86 103 2 -

    13 24 98 - 3

    14 39 99 - 2

    15 47 100 - 1

    Total 10 23

    Average number of cars waiting to be shipped = 10/15 = 0.67 per dayAverage number of empty space on the ship = 23/15 = 1.53 per day

  • Example 7.

    A company manufactures 30 units per product. The sale of these items depends upondemand which has the following distribution.

    Sale (units) Probability27 0.10

    28 0.15

    29 0.20

    30 0.35

    31 0.15

    32 0.05

    The production cost and sale price of each unit are Rs.40 and Rs.50 respectively. Anyunsold product is to be disposed off at a loss of Rs.15 per unit. There is a penalty of Rs.5per unit if the demand is not met. Using the following random numbers, estimate the totalprofit/loss for the company for the next 10 days.Random Numbers: 10, 99, 65,99,95,01,79,11,16 and 20.If the company decides to produce 29 units per day, what is the advantage ordisadvantage to the company?

    Sale (units) Probability CumulativeProbability

    Random NumberInterval

    27 0.10 0.10 00-09

    28 0.15 0.25 10-24

    29 0.20 0.45 25-44

    30 0.35 0.80 45-79

    31 0.15 0.95 80-94

    32 0.05 1.00 95-99

  • Set up the simulation for next 10 days

    Day RandomNumber

    SimulatedSales

    Number ofunits Unsold

    Number ofunits short

    1 10 28 30-28=2 0

    2 99 32 0 32-30=2

    3 65 30 0 0

    4 99 32 0 2

    5 95 32 0 2

    6 01 27 30-27=3 0

    7 79 30 0 0

    8 11 28 30-28=2 0

    9 16 28 2 0

    10 20 28 2 0

    Total 11 6

    At the production rate of 30 per day, total number of units produced in 10 days = 30 X 10= 300 Nos, since the production cost is Rs.40 and the sales price is Rs.50, the per unitprofit is Rs.10

    Day Demand Actual Sales Profit onActual sales

    Loss due tothe unsold

    units

    Loss due topenalty for

    shortage

    1 10 28 280 2 X 15 = 30 -

    2 99 30 300 - 2 X 5 = 10

    3 65 30 300 - -

    4 99 30 300 - 2 X 5 = 10

    5 95 30 300 - 2 X 5 = 10

    6 01 27 270 3 X 15 = 45 0

    7 79 30 300 0 0

    8 11 28 280 2 X 15 = 30 0

  • 9 16 28 280 2 X 15 = 30 0

    10 20 28 280 2 X 15 = 30 0

    289 Rs.2890 Rs.165 Rs.30

    (a) Total profit for next 10 days when production is 30 units per day = (2890) (165 +30)= 2890-195= 2695

    (b) If the company decides to produce 29 units per day. The calculation of profit and lossis as shown below.

    Day Demand Productionunits

    Actual

    Sales

    Profit on

    Actual

    sales

    Loss due tothe unsold

    units

    Loss due topenalty for

    shortage

    1 28 29 28 280 1 X 15 = 15 0

    2 32 29 29 290 0 3 X 5= 15

    3 30 29 29 290 0 1 X 5 = 5

    4 32 29 29 290 0 3 X 5= 15

    5 32 29 29 290 0 3 X 5= 15

    6 27 29 27 270 1 X 15 = 15 0

    7 30 29 29 290 0 1 X 5 = 5

    8 28 29 28 280 1 X 15 = 15 0

    9 28 29 28 280 1 X 15 = 15 0

    10 28 29 28 280 1 X 15 = 15 0

    Total 284 Rs.2840 Rs.90 Rs.55

    Total profit for next 10 days when production is 29 units per day = (2840) (90 + 55)= Rs.2695

    Since the profit is same for both the cases there is no disadvantage to the company.