 so far we have discussed the technical part or the scheme of Monte Carlo simulation in discrete case now we are going to discuss couple of practical examples or say how the Monte Carlo scheme can be applied in discrete event simulation cases so let's see couple of examples if you see the first example here I have bought a very basic illustration then we will go to little extended version of or complexities of you know examples of or say application of Monte Carlo simulation see the first example here we have taken the Harry's autos of example here would like to simulate the monthly demand for tires for the company and we have last 60 months data so we have the last 60 months data would like to predict the future sales or say no monthly demand for Harry's autos of throw Monte Carlo simulation the basic application let's see so what we have we have the last 60 months data here you can see the frequency the the historical data and the frequency is given to you suppose you have the data and the demand of 300 tires has occurred three times out of last 60 months the maximum demand pattern is 360 it's a discrete cluster you can see and the frequency is 18 out of 60 you can see it has the maximum frequency here you can see 30% chance or frequency distribution if you develop your histogram you can see this data say you know 360 could be 1 2 3 say 300 and then 360 could be here say as per the data pattern so it has the highest frequency almost 30 percent right 30 percent frequency are there you can you know draw the data pattern based on this frequency distribution and the histogram you can design so we have this now so first step is there then you construct the second step that is called the cumulative distribution here you can see the cumulative distribution data so thus frequency is been ready now then the cumulative you can see and you generate the random interval through bucket through bucket or say you know rand function also in excel later stage also you can generate rand function every time you can generate some rand function between 00 to 99 say 2 digit numbers say in excel using rand function or through bucket the example that I have given you can generate random number interval for that here 5% so total 5 number have been allotted out of 100 number here 15% the remaining in a sequential manner you can re-enage the order but the overlapping of number random number should not come to each other so here I have created a sequential arrangement of the data in excel also you can do it so that in a from excel you can generate the data so here for 15% here the remaining 15 data we have allotted to 320 similarly for 360 you can see 30% so 30 data in a sequential manner is 30 data we have allotted to 360 remember suppose 300 has 5% so any 5 data you can from the random number interval you can allocate to 300 but make sure that these numbers should not come to other demand but order it is better to develop the random number in a sequential manner in order so that excel can also understand that otherwise all are equally likely which is for uniform distribution so any number you can assign but overlapping should not be there or repetition should not be there so this interval scheme are done what is the next step next step you generate some random number from your bucket or say from your run function randomly and it is a replacement concept so any number can re-occur again so all has the chance of 1 by 100 equally likely so random number you are generating and the corresponding random number you can take from the reverse flow like the steps I have explained and you generate the demand suppose first random number we have generated from the bucket 36 so 36 comes in which interval 36 36 comes in this interval so 36 will be the demand here you can see 36 is the demand next from the bucket in the next experiment we have generated 667 randomly we are generating it is not in your hand in excel you can generate it or say in simulation process I will show you all this through software and the analysis also in excel so here you can see 67 we have generated so 67 falls in which interval 67 falls in this interval second last so 380 will be the demand you are coming back to the scheme inverse function scheme so 380 is the next demand next trend function has come as 12 so go back to the scheme and see 12 comes in which interval 12 comes in this interval so 320 will be the next demand say through simulation we are generating so this way you can say here 10 sample I have generated based on that you can see the average monthly demand will be we can see the average monthly demand would be 350 for the next month through simulation we are generating through simulation you might say sir this is not accurate because you know it could change because you have taken 10 sample it is true you increase the iteration sample size you do the simulation process for say 100 or say 1000 simulations probably from this frequency you will be able to cover all the data sets and you can get a better accurate forecast of monthly demand of this one basic examples thus illustration of the basic Monte Carlo simulation scheme let us go to some deeper example and you will get better insights of practical illustration now here you have another application in the waiting line system or king theory say you know a dentist schedule all his patients just understand the problem then you will get to know deeper application of Monte Carlo simulation a dentist schedule all his patients for 30 minutes appointments let me say you know assistant of the doctor or giving appointment previous day suppose to each patients when they are calling to the chamber that give me appointment and that assistant is giving appointment of 30 minutes interval some of the patients take more than more or less than 30 minutes somebody may take look at here somebody may take one hour also somebody may complete the check up or say you know to some extensive cleaning part within 15 minutes if it is a crown type of you know filling type of patient then they may take up to so there are different type of patients may come but they are taking appointment but the assistant does not know what kind of patient it is just the she is giving say 30 minutes interval of appointment to everybody in the next day doctor will see it in the chamber and the patients will come say and depending on the type of dental or work that on an average 30 minutes you know interval gap that appointments are given the following summary shows the various category of work and their probability needed to complete the work look at their filling will take 45 minutes on an average past data says that the time required to complete the service by the doctor but the type of filling customers are quite high look at 40% out of 100% almost 40% frequency look at almost 40 patients are following on that you know filling type then crown also 15% look at extraction type patients are very less only 10% only 10% so this is the total you know 100% patient category based on the past data you can see that what type of patients comes to this particular doctor where the doctor is more specialized whatever you can see the probability distribution of that this frequency we have already calculated or it's been given to us so the step one is already given to us say step one is already given to us of your simulation scheme look at here step one setting up the probability distribution see it already there because it's a discrete case in continuous case you will see the difference and the concept also but suppose it is given now you start the simulation and get to know that what would be the general waiting time for the patient and also ideal time for the doctor if any because you know if some patients take extra time like you know 60 minutes etc. so the second patient may need to wait so we'll check that through simulations so suppose start your simulation from next day 8 o'clock morning onwards and for the sake of illustration let us see this particular how many 1, 2, 3, 4, 5, 6, 7, 8 sample random sample you can generate thousands of sample but here first is this 8 initial sample I am going to show you how the simulation scheme can be applied or Monte Carlo simulations can be applied and this practical problem can be solved so let us start the simulation process now so from 8 o'clock onwards we'll start our simulation and then let's see the scheme first the first couple of steps so this is your service time the information are been given to you information are given to you will utilize later but let us see the simulation scheme first step the distribution function here we already been given this a discrete case from the frequency you have calculated the past data you have already calculated look at the Harry star example I have shown you from that way you can calculate this frequency and then cumulative you can calculate you add on 1 by 1 and you get the cumulative so total is 1 you can see at the end you get 1 so cumulative value we will be able to find it so now here you focus that your random interval so first one what is the probability for the first case the probability is say you know 40% so you allot from the bucket remember the example from the bucket or from the random function interval say 00299 out of 100 number out of 100 numbers say you are allocating 40 numbers from this bucket 40 number to this interval so 00299 if you start from 1 then it may go to 100 and then random function I have already shown you but here just one illustration I am showing you now next probability is 15% so remaining 15 number you have allotted this order is helpful through cumulative distribution to generate the illustration in excel or coding part in python but effectively you can allocate any random number to this you know out of 100 here out of 100 to 99 this 99 out of any 100 number from your bucket you can allocate any number to this interval but the repetition should not be there only one number should be allotted to a particular integral so here total how many number you need to allocate 15 number so 15 number you have allocated here 14 number you have allocated here I mean 15 number you have allocated here you have allocated 10 number and here you have allocated 20 number so total 100 numbers you have allocated now so interval allocation are done now correct interval allocation are done now so what we will do this step are done now next part interval allocation are ready now start the simulation so first steps are ready first step 1, step 2, step 3 are done now look at here come here step 1 step 2 cumulative distribution accordingly in a sequential manner you construct your confidence like you know random interval that is done now now generate the random number and this two you do it now generate your random number through this interval or through bucket or through excel and conduct your simulation only for 8 instances or you know mimicking process or you can say you know simulation experiment will do so let's see so this 8 number random number I have generated only 8 sample I have generated here you can generate thousands of sample now your simulation first random number you have generated 40 so 8 o'clock your first patient has come and doctor is sitting idle so immediately that patient will go inside the chamber and doctor can start giving service so first patient in random number from the bucket you have generated 40 so what type of patient it is 40 means here you can see 40 means this one 40 falls in this particular 40 has come from here like from the bucket you have generated random number and 40 belongs to this interval so effectively if you go back effectively it is a crown type of patient and it will take 60 minutes so 8 o'clock first patient has come immediately he got the service and he will leave the chamber at 9 o'clock but second patients will come at 8.30 because the assistant has given appointment of 30 minutes interval second patients will come at 8.30 but he has to get the service at 9 o'clock because first patient will take 30 minutes extra because 60 minutes service time is there for him and once he leave then only second patients will enter to the chamber to the doctor so therefore the second patients will have to wait for 30 minutes so here you can see the simulations of first patients is of crown type because 40 numbers belongs to that interval and the service time will take 60 second patient has come at 8.30 but he is waiting he is waiting say 30 minutes now he have written in the next slides so he will wait 30 minutes now and then what happens look at here what is the type of customer 82 random number we have generated from the bucket 82 means here 82 means this one from the bucket we have generated 82 now 82 means what it means checkup type customers how much time he will take or she will take 15 minutes that means the customer has come this customer has come at 8.30 the checkup type customer has come at 8.30 but he will get the appointment at 9 o'clock and he will leave at 9.15 but third customer will come at 9 o'clock and then that customers will get the service at 9.15 because second customer will leave at 9.15 because so the service time for the second customer is at 15 minutes because in random sample we realize that second customer is of you know 82 means checkup type so 82 means checkup type so therefore the second customers will leave at 9.15 and third customers will get the service at 9.50 the waiting time for third customers will be 15 minutes so come here so waiting time for third customers will be 15 minutes imagine  OFFICER IS 0 GREAT ઊ Patrick is 0เตร்boro ઊ ઊ జ વ ં ઓ ઓ ર ઙ ઙ દ ગ ર ખ ખ ર ઇ ઙ ષ જ ર ર ર જ ર ખ ર ર ર ર ર ર ર ર, ર ર ર ર ર, ર ર . the actual appointment at 9 o'clock but 9.15 he has or he has left and the third customer who has come at 9 o'clock he will get the appointment at 9.15 right at 9.15 but how much time he will take 45 minutes so he will leave at 10 o'clock but 9.30 the fourth customer has come fourth customers will also wait for now almost 30 minutes so this way you can illustrate the simulation scheme and here you can see so who is departing at what time 8 o'clock it has come arrived and then the second has come at 8.30 third has come like you know 9 o'clock and you can see the data and the event what happened and who is taking how much time and who is waiting in the queue and here is the data sets you can see the first customer has come at 8 o'clock final summary and service starts at 8 o'clock but he leaves at 9 o'clock so waiting time is 0 second customer has come at 8.30 but he will get at 9 o'clock he will leave at 9.30 he is waiting time is 30 minutes third customer has come 9 o'clock for third customer the service time is start at 9.15 but he will take 45 minutes 45 minutes service so therefore he will leave at 10 o'clock so fourth customer who has come 9.30 he will get the appointment at 10 o'clock so he is waiting 30 minutes similarly you can see the data you can generate the random sample not only 8 say 800 or 8000 and you will get overall data and the process of the simulation you can get the average this is 35 minutes average time may not be the best because only 8 sample based on the 8 sample we have got this you know average waiting time which is too high but once you generate the sample probably you will get to know more sample probably you will get to know on an average good you know waiting time that will help you or doctor and the doctor to assess that whether you know he should extend his service time or not or you know give another appointment schedule so all this planning can be done also you know patients can also take a decision that how much waiting time is there on an average in the chamber of the doctor so they can plan accordingly to reach and then all these things can be done and many insights analysis can be done also but what how we have done it through simulations this type of application through molecular simulations this is a very sample example I have illustrated here you can take this data set and you can generate in rexel the way I have shown you in the previous sessions and you can generate more sample and you can actually get insights of this you know waiting time and idle time of the doctor you can calculate the idle time of the doctor and also you can see whether doctor is sitting idle also on and this couple of data says that there is no idle time for the doctor but to generate 8000 simulations probably you will get the doctor might be sitting idle also so overall insights you will get from this particular application of molecular simulation in the waiting line analysis this is sample examples this can be applied to you know say you know burgers of this can be applied to say pizza hard this can be applied to railway counter this can be applied to any waiting line analysis or telecommunication system everywhere you can use this concept of simulation or and molecular simulation and you can get deeper insights in manufacturing sector also people use this very frequently the application of molecular simulations like the previous example we have discussed here I am showing one more application of molecular simulation you can see here this example is very interesting you can also practice at home here you can see using excel you can try but here I have given the illustration just follow it as a basic application but it is very interesting here what the example that a company manufactures around 200 mopeds every day depending upon the availability of raw materials and other conditions the daily production has been varying from 196 mopeds to 204 so the production capacity changes or say production quantity changes on an average company produce 200 mopeds per day but because of the availability of raw materials and the human resource and the electricity all this you know machine availability the production changes with the range from 196 to 204 in between that the production happens in general based on the past data and the past data are been given here you can see which production has the maximum frequency 200 you can see which production has the lowest frequency you can see 196 and 204 so it is ranges in between you can say it is ranges in between you can say right with 200 maximum 196 with the lower bound you can say and 204 204 is the upper bound so to some extent data follow this pattern but we are not considering continuous case the next session I will discuss detail of continuous version of simulation and the application here we are thinking about the discrete case to understand the basic ingredients or basic features of Monte Carlo simulation simulation with practically illustration and here you can see the company transport that production quantity the mopeds they produce every day through lorry right and the lorry capacity is also to some extent 200 say in that case what happens there might be if there is excess production you cannot shift that product in the next day through lorry because lorry capacity is 200 what will happen you will have some inventory storage right but the excess inventory which you can carry in the next day if the there is a empty space in the truck or lorry in a similar manner if you produce some less quantity of mopeds in a day because production is varying in that case if you do not have any past inventory on that particular production quantity will go by lorry or by truck with little empty space suppose if you send 196 mopeds but truck capacity is 200 so you actually you are not able to send 4 additional inventory because there is a space in the truck but you are not utilizing it effectively because your production quantity is less unless you have excess inventory so this is the situation the question here is that simulate the entire process for next couple of days say through simulation data I will show you and you see what is the general waiting time of the factory the mopeds in the factory in case if you produce more the higher side quantity and lorry size is 200 so you may not be able to send the inventory effectively through transport the inventory effectively so what will happen you will have a excess inventory so inventory will be piled up but so what is the on an average waiting number of mopeds are been waited or been waiting in the factory say we would like to simulate it the other side the overstocking and understocking cases here so in the other side if you produce less quantity in a daily manner say it is uncertain in that case your lorry will not be used effectively so what is the on an average empty spaces in the lorry in your transportation system both the side understocking and overstocking would like to study through simulation same logic like the previous example I have discussed here you can see here first based on the frequency and the production of mopeds you create your cumulative data sets and then generate the random interval based on the weightage histogram and the frequency distribution in excel I have done just I have taken the snippet of it but you can try at home so here you have the scheme of Monte Carlo so random number interval are been generated range has been assigned now you can see for example one such illustration I am showing suppose here 203 has the 8% chance so 8 number have been allotted random number are been allotted through random function or through bucket whatever uniform distribution whatever you can consider are been allotted to 203 right so the scheme is ready now now we will generate some random sample and in which interval is falling from the bucket or say rank function will generate some rank function in every simulation every iteration of our simulation and we will see in which range it is falling and then in the reverse manner through reverse function we will see which demand will occur in my production system and that will go through lorry so let us see the situation through different simulation iteration here you can see we have generated couple of random sample randomly you have generated right through in between function between 00 to 99 and these steps are been mentioned here couple of illustration I have mentioned here but I believe you understood it and here you can see 8 you have generated so 8 falls in which interval first random number we have generated 8 so which point it will come 8 means it will be here here you can see here 8 falls between 5 to 13 so in that interval the corresponding production quantity will be 197 you can see we have generated 197 think about one example another example 91 suppose in rank function we have generated 91 random interval random number is 91 falls in which interval 91 falls in this interval second last so we will be producing through simulations we could see that the company will be producing the plant will be producing 203 number of moped so 203 here you can see so it is a higher than inventory level track capacity so 3 inventory will be stored will be kept in the factory to shift in the next day so this way you will have some waiting time waiting number of inventory and say empty space in the lorry also let's see this illustration based on this interval at 200 is the capacity you can see in which day whether there is empty space or the excess inventory that you can illustrate based on this production quantity based on this random number generation this illustration we have done the waiting of moped in a particular day or empty space in the lorry here in the first day we have generated 197 the lorry size is 200 you can see there is no waiting but there is excess inventory so this we have noted here if you do this simulation for say you know 220 or say now hundreds of samples and if you can take the average or you can calculate the confidence interval mean in India standardization all these things you'll be able to get a statistical inference or managerial insights of this practical problem of manufacturing system here you can see we found almost on an average based on this 20 samples a couple of sample you can count here and you can see on an average the waiting number of moped will be 6.35 based on the sample data if you increase the samples it will change and you will get a better confidence interval mean median all these things will be able to get similarly you can see the number of empty space in the lorry will be differ also daily basis and here based on this data we found around 0.25 as the empty space in the lorry because most of the we are producing the good amount of moped based on this data sample so this what you know the scheme the random number interval the generation of actual production based on simulation and the inference of your problem this what one example of manufacturing system I thought of sharing with you but you can practice this couple of example that I have discussed in excel or in different softwares or you can bring more case studies with a large problem with more data sets and you can analyze the managerial insights of the company data through Monte Carlo simulation after the break we will focus the continuous version of simulation and in excel how can create the scheme because the scheme that I have discussed today now is all manually right now will go to excel we understand in excel how can you create the entire scheme and if you drag it in a second you can actually generate thousands of simulations and you can get insights of that part and also continuous version of simulation like for triangular distribution for uniform distribution for normal distribution if the data follow like that then how will make this simulation scheme and you can solve practical problem that we will discuss after the break