 Hello everyone, welcome to the session of simulation modeling and risk analytics. This is the last module of this course of business forecasting and here we will study different type of business problem using the concept of simulation. How you can analyze the data behavior and you can make the forecast for the future and analyze the business problem using simulation specifically the Monte Carlo simulation. We will study that and also we will using a software called address software. We will study the different type of risk analytics aspects of business cases through this simulation modeling. So, in the first session of this module we will concentrate the basic understanding of simulation and the modeling process and what is Monte Carlo simulation and how does it work, the mechanism of Monte Carlo simulation and its application in two different aspect. One will be discrete different simulation or discrete case with basic problem will not go the software part now. First we will understand the basic examples, the understanding of Monte Carlo simulation through discrete case of situation and then we will extend the concept to continuous case of situation of probability distribution. So, both we illustrate with examples and the conceptual understanding and then we will open the excel and we will understand how this model works and then we will go to a software through which we will study different type of practical cases or business problem where you know the Monte Carlo simulation and risk analytics can be covered. So, now what is business simulation? Simulation is nothing but a actually mimicking process or iterative process you replicate the same experiment again and again and again and you generate for a different set of input data you generate the output data. So, it is nothing but you know there is a process and every iteration you generate your input and you get your output. So, this process will be repeated it is a mimicking process will be repeated again and again by generating different instances of the input data or say random instances. So, that which can happen in the future or based on the past data you are generating this random input data into your model through a simulation process or through a computer system and you are getting the output of the problem or the case or the you know objective whatever you have and that once you get the list of output for a given set of input data like if you generate a thousands of 1 lakh iteration right. You are mimicking the process, repeating the process and through dynamic nature of the problem you will get different output. So, if you analyze this output and get statistical inference or the insights of the data of the problem effectively you are actually addressing the problem and getting insights through inferences of the problem. So, this entire process is nothing but the simulations. When it comes to the business problem and you are predicting the future of the problem through analyzing the past data and the system behavior and you are making a decision or the management decision of the problem then that situation is called the business simulation. That is it. The model can be you know dynamic in nature, it can be interactive, it can be you know like you know causal loop effect also the system behavior and that you have to analyze through data and through the inter-relations between the variables involved in the problem and then you generate the random input data and you get the output. This overall process is nothing but the simulation. I will discuss more concept now. Now, if you think that what I have discussed now here I have summarized. It is nothing but a strategic thinking and decision modeling of business problem using simulation. And then it is nothing but the study the dynamic nature of the problem or the system behavior. Immediately you know sometimes what happens if you have a analytical model or you know theoretical problem or optimization structure or say you know different type of complex business problem. It is very difficult to get insights or that to understand the dynamic nature of the problem. So, through simulations what you do actually since you generate thousands of iteration or like you know thousands of input data and you get the output data for a given set of input and output combination you actually understand the system behavior effectively. And once you generate thousands of output I will show you today through the software that over a like say minute you may generate thousands of lakhs of output of the system. So, effectively you are getting huge data sets of the system, how the system is behaving. Not only one instance since you have thousands of instances what advantage you get is that you analyze the data, get the statistical inference, get the insights, do the sensitivity, do the what if analysis. Through that you will understand the system behavior and the dynamic nature of the problem. And if you know the system behavior and the dynamic nature of the problem perhaps your problem is resolved you will be able to get insights of it and you can take the managerial decision. It helps in understanding the uncertainty and the risk modeling also by analyzing the data sets or analyzing the problem insights. And also you know once you do the statistical inferences with using the data you excel spreadsheet or the software whatever or you know say mad lab or you know using say Python you will get entire insights of the problem. So, this overall three four steps are the summary of business simulation. What simulation is? What is the advantage of it? What do you get from it? And what inference you can draw from it? So, this slide is a very important slide. And now if you go more deeper of it this entire module of simulation aspects in the context of business simulation or business problem I have categorized that into two part. In part one we will be focusing on Monte Carlo simulation how does it work which we have started. First I am giving the definition of simulation look at simulation is a process of designing a model of a real system and contacting the experiment how to design the model I will tell you through example and conducting the experiment again and again like in a mimicking process to understand the behavior of the problem and critical insights of it as well as the operation of the system in manufacturing system it is very popular. Anyway, so this will be the first part which we are discussing the basic simulation and the application of it and then we will focus more on risk analytics part. In simulation you can really handle the risk analytics part very effectively. So, in the business setting how the risk part can be addressed or can be modeled can be designed and using simulations you can analyze the uncertainty and the risk part of different business cases. At least a 5, 6 examples of business cases we will try to cover and or maybe more than that I will try to cover as much as possible in the forthcoming sessions of this module of simulation and you will get to know how risk analytics can be incorporated or it can be you know designed through this simulation software of at risk or say decision tool switch. This will be the second part of this model and applications when it comes to the applications whether logistics or manufacturing as I told there is a ample application of simulation computer systems manufacturing and business system also like finance and business cases also and the government telecommunication system everywhere you will find the application of simulations. Couple of examples I will try to share with you through different slides or different situations you will get to know in marketing pricing policies in everywhere you know network design you can use simulation and you may get insights of it. Now as I talked about the system behavior through simulations you actually get the system behavior effectively and you understand the insights of the system. So, before I go to that type of aspects and the understanding of simulation with the Monte Carlo aspects let us see a sample problem that how the system behavior work like what is system behavior or can we get to know in depth of it little bit about this example of system behavior how does it work here I have bought a example. Suppose a simple supply chain simple supply chain that has been in a steady state for some time steady state. That means the retailer's inventory say you know like a 2 HLM supply chain. So, the retailer's inventory has been constant at some level for long time retailer's inventory is constant for a period of time right it is steady state now. So, that means whatever the demand are coming the retailer is immediately passing the you know the same demand to the supplier and over a period of time suppliers is also you know steady in delivering the product without any delay. So, system become steady. So, demand is also known supply capacity is also known both are in a known situation steady state situation. So, therefore, your inventory level is also steady right the starting of the problem. Suppose in the middle of your business you see that you know every day system or every week system is getting settled and you know it says to some extent steady state situation. Then here are the in a description that what I talked of the retailer maintains the inventory of the product that is shipped to the customers on demand. They have the safety stocks and they maintain the demand and maintain the inventory level and meet the customer demand as and when it comes. Upon shipping the retailer always order the immediately for a supplier on the same amount of the product that is shipped. The supplier is also regular, but the point is that the supplier takes 7 days to deliver the product. That means, if you give a order today after 7 days the suppliers will deliver that product, but since it is steady state system become steady now because first order will come after 7 days, but second day onwards or second week onwards whatever the period you have automatically it will be a like you know steady state right in the middle of like suppose you are at say 20th period or say 30th period you can understand that also 15th period you can understand that you know retailer is steady now and the supplier is also steady because every day interval now it is coming. So, everything is steady now right remember the point that that supplier deliver the products to the retailer 7 days after the order is placed, but in a intermediate of the situation it is a steady state right it is a steady state. So, now the supplier has never been stocked out and also no products will be damaged or you know will be defective etcetera or lost in the transit. So, this is a steady state now. So, now suppose all of a sudden there is a high volume of demand and demand jump and it remain there look at suppose all of a sudden the volume of demand from the customers coming to the retailer step up and to a new high and it remains there that means suppose demand situation are like that suppose this is the demand function suppose demand you know say suddenly suppose demand was also steady suddenly there is a step. So, it gone up and it remain there. So, this step function it is been there for the demand say right suppose demand is been like this now at that period suddenly high demand with a big volume has come. Suppose your competitor has closed the store and the entire demand has come to use. So, this situation occurs now suppose since the demand jump as a step function suddenly remain there steady what will happen to the inventory level. The question is that what will be the situation of the retailer's inventory can you study the behavior of that look at that sketch the new behavior of the retailer's inventory that is the question of this example that on this axis provided the figure in a sketch the pattern of the retailer's inventory what could be the retailer's inventory can you draw it the point here is that remember the entire story of this example that whatever the demand comes from the customer retailer immediately pass that demand the same amount to the supplier, but supplier takes 7 days to meet that demand. But in the middle earlier it was a steady state now what happened big jump has come in the demand. So, therefore, the retailer has already passed the demand to the you know the same amount to the customer the order, but supplier will submit inventory after 7 days. So, this 7 days in the middle of 7 days what happens you have a high demand every day because it is steady now it has gone up and it is steady now every day the customer demand will consume the your safety stock your inventory level and it will take to become steady again after 7 days because whatever the demand you have given suppose let me go to the next slides you will get to know whatever the demand you have given the demand it has gone up right it was like this and then suddenly gone up. So, this additional demand the retailer has passed to the supplier no doubt about it retailer has passed that to the supplier, but what happens you know suppose in that particular day that peak of demand has come and demand has gone up, but how will meet the inventory meet the demand through your safety stock right or your go down inventory. So, you are meeting that, but you have already passed, but the supplier will take 7 days to meet that demand to the retailer. So, therefore, first 7 days look at here from here say to here say 7 days it will take you can say from 7 days to say 14 days say it will take 14 days it will take the adjustment of inventory from your safety stock. So, effectively whatever the additional demand has come that will be consumed from your safety stock, but every day the retailer is passing the same demand to the supplier, but that will come after 7 days after 7 days of gap the first order will come here and then it will become steady now. So, this will be the you know graph of the retailers. So, this is the system behavior the inventory behavior you are studying of the retailer imagine that how it fall down suppose again the you know if the demand of the customer fall down probably you know it may also you know it may go up again say and then it may go again become steady etc. So, depending on the question further questions you will be able to draw the graph of the inventory level of the retailer. So, this is what the system behavior, but interestingly it is small example that I have given in practice there were many complex subsystem of a problem and then you know every subsystem will have a complex behavior and if you interconnect the sub problem if you interconnect the sub problem what happens your overall system become very complex and it is very difficult to understand the overall system behavior over a period of time. So, in that case if you use simulation and each subsystem if you study and if you connect them and if you study the entire system behavior over a period of time you will be able to see how the system is moving and behaving over a period of time. This helps through simulation process that we are going to study through simulation process how system behavior are being captured and you can make a future prediction of the you know of the companies earning companies demand planning and the inventory level or manufacturing process wherever you want to sales wherever you want to use you can study the complex behavior of a system using simulation. Now, let us come to the steps of simulation. Here I have mentioned the importance eight steps first identify the problem the problem context the first slide that I have talked about the four steps business case and the modeling process that get a solution of it and the implement the problem or the solution to the company's problem. So, address the case similarly here also identify the problem identify the decision variable performance criteria and the decision rules that the complex behavior you are studying you are getting insights of the problem and then you know construct the simulation model which are going to do now look at the modify the model in case once the input data are done and the decision variables are done that and the steps will be repeated construct the simulation model validate the model within some trial data and then you know and then what you do you do your once that testing are done you know design of experiment is ready what you do you run the simulation, but this is for you know this is once construct the model this is for only one one step of iteration right, but you have to repeat it either simulation process completed what you can do that you know if not if you do not reach to your desired point of threshold level or in number of instances that you want from your simulations. So, that you can take a good decision of the inferences of your problem you repeat the iteration process repeat the simulation process this is what your simulation you will not be able to get only one output you may get thousands of output now. So, this process you repeat until you reach your desired level of instances or the inferences you will be able to draw and then you know examine the results and the select the best course of action that is it this process of its process we are going to discuss through the Monte Carlo simulation. So, these steps will remain same for Monte Carlo simulation also as well as for you know discrete event case of say as well as continuous case of system dynamics also. Now, let us see what is Monte Carlo simulation so far I have discussed about the basic steps of simulation right. Now, we are going in deeper of Monte Carlo simulation it is nothing but a iterative process or you know repetitive process that you know your mimicking process, but here the main concept is that you generate some random number through a probability distribution look at that through a known probability distribution you generate some random sample using random number this is the main crux of simulation. So, what is the definition Monte Carlo simulation technique involves in contacting the repeated experiment of any system to study the system behavior by generating the random sample or random number through a sample of using the probability distribution of that particular event. For example, you will get to know suppose suppose you have a system here right you want to study the behavior of that system and here is suppose your some say demand say or sales say or production planning say these are suppose your input data right which are following say some distribution say suppose you are thinking of demand say which is following some distribution say continuous version of distribution also discrete say say exponential distribution it is following or say normal distribution it is following and then the system behavior you need to study. So, this demand since it is uncertain parameter or you know risk is involved over here what you do you define the distribution by looking at the histogram of the data and once you define the distribution you generate random samples through random number and these random numbers of demand is nothing, but the input data of your demand. So, this connection you need to prepare that how through random number you can generate in a reverse function formula you can generate different demand or of input of your system which are nothing, but risk or you know uncertainty in nature and then you know you get the output of the problem over a period of time or you know for different instances. Remember one part I am talking about that like risk and uncertainty I am talking about makes sure that both are not same in general what happen uncertainty comes fast and then risk appears that means when you do not have pass data to understand the situation of the case in that case you cannot create your histogram or frequency distribution. In that case what you do you consider the event as a say uncertain event and then once you create instances you have couple of sample data and through that if you can create say histogram and frequency distribution you convert the problem the event with chance factor. So, once the chance are been associated with the event that event becomes or that situation problem becomes a risky event. So, first uncertainty and then risk remember it I can give one example suppose you know when corona came in India initially if somebody get affected with corona whether the persons will alive or not we do not know because you do not have any data. So, that situation was uncertain decision making and uncertainty. But once say after couple of months when the vaccination comes then a different type of you know protocols comes like use the mask etcetera. So, what happens now we get to know whether the persons will alive or not even if it is getting affected then vaccine comes and then people started taking the vaccine and over a one year or two year period of time at the last stage of corona cases what we realize is that even if somebody is getting affected with corona we know whether the persons will as per the immunity and the vaccine aspects we get to know that the persons will alive or will die. So, that next event after couple of months say once you get the vaccination and all these situations you have sample of data and huge sample of data now. Now, that event become a risky event that is not uncertainty because it is a risky you have the data you can create a histogram you can create the generate the distribution function all these things and then you can analyze that situation. So, that is risk, but initially when corona came you do not have data everything was uncertain. So, uncertain event comes and then it is convert into risk. So, this way you know you have to remember the basic differences about these two event here we will be focusing more on risk event simulation in the context of risk because uncertainty if there you can generate your histogram you can generate by the sample data or experts opinion you can generate it no doubt about it, but generally we will focus more on risk event of simulation right. The Monte Carlo simulation techniques is defined in selecting a random number and you generate through a trial of iteration in a computer run. I will show you and also how to generate the random number you generally follow the Rolte wheel method of Monte Carlo simulation. So, it is generally following if you roll the wheel every time you will get stuck with some point. So, that point will be your random number. So, this way you can generate generally we do not go for that because in excel you can generate the random number through random function I will show you later. Look at here this is what I am talking about you can follow random work like you know also one more point of Monte Carlo simulation like the concept of Markov chain is forget the past event whatever the random number is instant generated or the situation happened it does not memorize that it actually forget it and in the next event also same thing can occur also. So, it does not have any influence of the prior event. So, this conditional case does not come here here always you assume that the samples or random number you are generating follow uniform distribution and anytime any event any random number can be generated. So, it does not have any impact of previous event what has happened in the past event it will not have any impact to the forthcoming period same event can occur also or anything can happen it will not have any correlation with that. So, now choosing of the probability distribution through a random sample I will show you that and the random number generation there are many way to generate this random number we will follow that remember that is a random number follow uniform distribution this is very crucial steps. So, and the random number generally follow between 0 to 1 suppose if you generate a random number 2 digit random number. So, you can take 0 0 to 99 and you can use the rand function and you can generate the different random number which will be input to your simulation model or the experiment if your data sets suppose if you want to take a 3 digit random number then you can take this number and you can generate the random number from here like through the rand function. So, it is up to you which range but generally they follow uniform distribution that means whatever the data you take not a matter but effectively the the range of the data you take not a matter, but it will follow uniform distribution that means suppose if you keep the data say 100 data say in a bucket and in the back side if you note down each number and if you draw the number random number from this bucket every time whether 10 will come or 11 will come or 99 will come they follow uniform distribution they are equally likely the chance of occurring of any number from the bucket if you follow the replacement concept the chance of occurring of any number from the bucket will follow uniform distribution like that means in the first instance if I picked up 10 number from the you know bucket and if you put it back again next generation also 10 may come the chance is 1 by 100. Suppose in case if you put 100 numbers here so all follow uniform distribution any number of occurrence from this bucket or picking up number from the bucket if you have 100 numbers over there all will follow uniform distribution because the chance of occurrence are equally likely that is the major concept of random number generation in Monte Carlo simulation. Now what are the steps the steps here are remember the important steps the first step is that read the case and understand who are risk parameter like demand or you know manufacturing process the simulation or the sales set up the probability distribution of that particular variable based on the past data I will show you example based on past data you set up the probability distribution it can be discrete it can be continuous both case we will discuss and then build a cumulative probability distribution of that particular variable suppose if you are considering demand say let us take example of demand you will be able to understand and then construct the cumulative distribution of that particular variable demand it will help you in generating your random sample through inverse function I will tell you the example and then establish the interval of random sample random number based on the data or histogram you have right how to do that the interval creation and the random number generation I will tell you then generate the random number through computer simulation or through run number generation so this you do these two steps are you know interconnected both are same almost get the interval and generate the random number this is the most important part once you do that you know you conduct the simulation experiment and until you reach your optimum level or you know threshold level you repeat this process of simulations and you generate thousands of iterations and then once you get the iteration you get the insights and take the management decision the action course of action maintaining the model is very important once you get the more data your model may change right once you generate more data from your like real situations suppose initially you have thousands say 100 sample of demand if you have a thousand sample of demand you might say the situation the system behavior may change or you know the production planning may need to be modified so therefore you have to maintain the system every time so this four-fives process let us illustrate through example suppose remember these slides this is very crucial slide right first set up the probability distribution then construct the cumulative probability distribution and then generate the interval and set the random number generation interval setting and then you generate the sample to run the simulation so how does it work let us take these examples so here suppose you have a function say objective function as I told about suppose here y equals to fx here a function and x is the input say suppose which suppose demand say and you have to get the y output right suppose x is following some random distribution which is stochastic in nature and y can be stochastic or deterministic depending on the situation say suppose x is following suppose the demand say x is following four event four instances so 1 2 3 4 right with probability 0.2 0.1 0.4 0.3 how come you got it I will show you through illustration at a later stage first understand the simulation scheme molecular simulation scheme now suppose x is following this four type of pattern with the probability and if you look at their sum if you look at their sum of them it is nothing but 1 so cumulative you can set also here I have created the cumulative step 2 this is actually say step 1 step 1 if you say and then this is nothing but step 2 step 2 so what is step 2 construct your cumulative here I have construct the cumulative it helps you in excel or in coding it helps you to generate your random sample here you would not be able to understand but in coding or in excel you will be able to get insights of the advantage of constructing the cumulative distribution function so this is step 2 now step 3 this is step 3 what is step 3 what I am talking about actually these slides look at this step 3 construct the random interval right random interval so here we have done the random interval let us see here how come we have formed this random interval look at what is the chance of x equals to 1 the demand could be 1 say 0.2 so 20 percent probability is there for 1 right x can consider 1 based on the past data past data histogram we realize that say you know say 20 percent chance for 1 10 percent chance for 2 say 20 percent 10 percent and for 3 for 3 say it is almost 40 percent say and for 4 it is say 30 percent say 30 percent 30 so this you know histogram you have right data histogram you have based on the past data and that we are capturing here so 20 percent chance for x so 20 number from the bucket I talked about the bucket right from the bucket where you have 20 numbers say 2 digits say 2 digits say 00 to 99 you do not take 100 then it will be 101 so we are considering this 100 number from the bucket so how many number I have kept like you know in the back side of the each paper white paper I have in the back side I have written that you know everybody from 00 to 99 means it is 1 say in the back side of the paper I have written of each 100 number that 00 to 99 means 19 means it is 1 so 20 number I have allotted 20 number because you know frequency is 20 percent so 20 number I have allotted then for 2 x is 2 look at the chance is 10 percent the frequency ratio say the 10 percent so next 10 numbers I have allotted it is not mandatory that you have to follow this sequence of the number you can rearrange it also any number you can take but make sure that that number should not be overlapped while assigning the number and the random interval the number should not be overlapping right make sure of it so for 2 10 percent so remaining 10 numbers I have allotted but if you want you can allot 10 20 30 so this way total 10 number you can allot 2 also only 10 percent 10 number you can allot from the bucket and this 10 number should not be occurring in any other interval for any other number right so make sure of it now for the next step next step is that suppose for 2 we have created the random samples say 2 to 29 20 to 29 10 numbers and then 3 40 numbers total 40 numbers right because it is 40 percent to 40 in a sequential make because you have created the cumulative distribution function so throw that in excel also you can create the scheme but suppose here you have created for 3 40 percent next 40 numbers you have allotted for 4 30 percent so next remaining 30 numbers you have allotted you can change the order also you can start from 99 and this way you can go down or you can rearrange the data set not a matter what makes sure that whatever the frequency they have same number of number you allot to that particular the interval or the data set to that particular event say 1 2 3 4 here say demand so we follow interval because you know through cumulative function we follow interval it helps us to generate the number through random function in excel or in coding also so therefore we follow the cumulative value function and the corresponding interval in a sequential manner so done now the interval setting are done now so here we have only one variable and for that for each event we have created the interval now so from the bucket all numbers we have generated now from the bucket suppose the number are being generated say now 4 step generate the random number from this interval or from the bucket say now if you generate say 60 say 50 if you generate 50 from the bucket suppose if you pick a paper from the 100 papers of the paper and you found that 50 say random number you found through excel you can generate it but suppose you picked 50 and this 50 means what in which interval it is following it is following this 50 is following in this third interval so therefore effectively you have generated 3 actually but you have generated 50 from that interval but you have generated 3 these 3 will go to your input data of y equals to fx as x input x equals to 3 now but you are not generating x equals to 3 here you are actually generating some random sample from your random function in excel or from the bucket through this interval since it is belonging in this particular interval so corresponding in a reverse function it is discreet it is easy to understand but when you go to the continuous you will get to know the in a magic of this let us see one illustration here now suppose the scheme is ready now now step 4 so generate the random number suppose initially you generate 17 17 means in suppose I should have kept it here in a sequential manner anyway so suppose if you generate say you know 17 so 17 falls under which interval 17 falls under first interval so effectively you generated 1 in your system as I mentioned y equals to say fx effectively you generated 1 here 1 right because 17 you have generated first simulations output you will get but you have not generated 1 you have generated only in the excel or in your calculation of coding you have generated only 17 random sample from your bucket remember from your bucket you have generated 17 only effectively in a reverse manner you got one one will go here you will get the output first instance of simulations are being recorded now next iteration so you generate a 67 suppose from the bucket you have picked 67 67 falls under which interval 67 falls under third interval look at third interval so you actually generated 3 so 3 will come here and we will get the output second instance are being stored simulations you are doing actually Monte Carlo simulation the experiment are going on now next instance suppose you have generated 34 so from the bucket you have generated 34 I more detail I will show you in excel don't worry suppose you generate 34 so 34 belongs to in which interval 34 also falls under third interval so again you are generating 3 so that's what I told you know it's a follow markup chain process so you forget the previous event what happened in the previous event it does not have any influence to the forthcoming event so therefore next in third iteration also you have generated see so 34 means third number so 3 has gone inside and you get the output your third instances of the system we have noted now now similarly suppose you generate say 54 so 54 also again belonging to that third so again you generate 3 look at here and then 20 suppose you have generated from the bucket you have generated 20 say 20 means it's a second interval so you generated 2 here now suppose you picked one or through excel you found one so one means one means here it's falling on the first interval so you actually generate one one means is the random sample one random number one but effectively you are generating one of your event look at here the event or one two three four it can be you know blue red black this type of you know event can be also so you can generate that also as input to your system it can be any other aspects laramsam jodhumudu you can make that also so so one means Ram will come 98 means 98 means here 90 when they say last person will go to the system or whatever everywhere you can apply this concept of Monte Carlo simulation so this is the overall scheme of Monte Carlo simulation and effectively we have understood the inter steps look at that all the steps that I have talked about here all the steps the steps are actually been illustrated now through the example set of the probability distribution construct the cumulative distribution function establish the interval of random number and generate the random number from the bucket or from the interval in a reverse function in your inverse manner you put the input of your data or variable risk parameter into your system that you want to study the behavior of the system and you get the output of the system you have the manufacturing system supply chain sales marketing wherever you want to apply right and you can get the forecast and the overall planning everything you can get to know through the simulation process