 So, today's class we will take a look at how to model non-linear relations. So, we have been looking mainly at linear models till now, though the behavior could be non-linear, the relations we have been pretty much using at linear models. Simply define a process is linear, if process response is proportional to the input, stimulus is given right, like savings bank account that we modeled or some concepts like you know putting 10 percent more effort may get 10 percent more results coming in. So, those kind of things are expected to be linear and we can model it as a and linear systems are extensively studied, since mathematical modeling of it is quite straight forward. In fact, so much so that many times your non-linearities in actual systems is linearized so that we can effectively analyze it, though it may not be an accurate model, it does give valuable insight. So, many times we end up approximating real-life scenarios into linear systems so that we can analyze it. So, today's class we will take a look at how to model simple, too little more complicated non-linear relations between any two variables ok. The non-linear relations are fundamental to many systems, can you think of some examples where the relation between the two variables could be non-linear, when you purchase things what do we do, when you purchase vegetables or purchase anything, bargain or even if whatever you buy clothes or something you do not expect the same price right, you do not say ok one whatever, you always bargain, meaning the relation is non-linear, it is not linear then when people start giving offers saying ok if you buy one pant it is or one jeans it is thousand, but if you buy three you get it at a price of two. So, there is a non-linear relationship right there which are using in everyday decision making right. So, if I am going to model that it has to be non-linear relationship that has to be captured. So, now like that can you think of some more examples, we always want volume discounts as we increase in volume you always say that right you know instead of buying whatever 1 kg if I am buying 5 kg so, give me a discount instead of buying one set I am buying three sets. So, can I reduce the price that means the relation between the price and quantity is non-linear right. So, like that can you think of some other scenarios where you will end up such kind of relations. Price per unit reduces when you purchase in bulk, company can manufacture desired rate unless capacity is inadequate that is a non-linear relationship. When you assume you can produce whatever you are assuming it is well within your capacity if it exceeds your capacity then it cannot produce at the same rate or I cannot keep selling as much as I can I can only sell as up to the inventory or stock I have once I exhaust it I cannot sell anymore right. That relationship right there is a non-linear relationship or health care boost life expectancy but up to a point health care spending is or only it will go only up to a point it cannot extend life infinitely. Product sale must tend to zero's availability or quality falls to zero no matter how cheap it is. So, it is not just only the price that drives it the inventory also should be available just because you reduce the price but does not mean, but if inventory is zero does not mean that you can keep selling right, but that is a non-linear relation right there in reality. A parking charges at malls it is not linear it goes in jumps in jumps in there are break points and you get for so many duration that many hours of based on the hours you get charged around it to the nearest break point fuel consumption speed of vehicle again non-linear relationships. Yeah like that there are many such scenarios which we may want to capture in our simulation models so that it can better represent the real system. When we look at linear systems what we are trying to do is linearize the model so that we can analyze it better, but when we when we move into simulation modeling we tend to make it more closer to reality because we are not doing any mathematical analysis we are actually doing the simulation of it. So, it can handle non-linearities in simulation because of that we want to capture reality as close as possible which will result in capturing all these non-linearities more explicitly so that we can better represent the real processes. So, let us look at some simple examples first to understand how to you know use these or represent these non-linearities in our simulation models, but as soon as you start doing these non-linearities build some functions you will hit the limits of using linear systems analysis whatever methods that we have used and for some scenarios simulation to be the only resort to analyze it or if you simplify the model we can apply we can analyze it analytically. So, let us take a simple inventory example a small production unit has a fairly stable process with 1000 of 100 SKU per unit per day of production. So, it makes 100 SKUs per day the finished goods are added to the end inventory the demand is satisfied from the end inventory the production continues independent of the actual demand. So, whatever the demand they keep producing things at this constant rate of 100 the initial inventory is 200 units the average demand is 110 SKU per day we need to build a valid SD model of the above scenario. So, how many stocks are here in the system finished goods inventory that is the only stock in the system. So, what will be the flows that affects this stock production rate and sales rate will be the two flows that affects the stock production rate will add to the stock and the sales rate will reduce the stock. So, in this what you are going to do is have the demand as a third variable. So, we will have production rate affecting my inventory and inventory is reduced by sales rate and let us model demand separately as 110 units which affects the sales rate. So, I want you all to model the system. So, what you see here is the documentation has provided by Wensom. So, when you build a model and you click the document all button and Wensom it represents what are the underling equations along with the variable names units etcetera are all captured in this slide. You may have may not have tried it before, but does not matter just use your common sense read this and create the appropriate variables within your model and build the model. So, in this what is the stock here which row number is the stock? 4, how do you identify it? 1 for example, you see the word intake whenever there is intake that means, whatever variable name next to it is the stock that is it and whatever affects through intake production rate sales rate that must be the flows. Then the equation of flows are given the units for each is also given initial time final time goes from the model settings, time units are also specified and whichever is not the rates that must be an auxiliary variable right. So, you can build this model. Once you finish it do units check if you get an error fix it, if you observe for each variable name is written this is just an output directly from Wensom and it is sorted alphabetically. That is why you get demand first then final time initial time inventory etcetera. If I ask you to document probably you will write the inventory first and then the flow rates then the other variables it is just sorting it alphabetically. Final time initial time time step comes in your model settings others come in your model kindly become familiar with such interfaces so that you can understand what the model is presented. When you simulate it what happens to the inventory at what point does it cross 0? At time 20 and just keeps falling which is intuitive because demand is 110 and production is 100. So, minus 10 is removed from at every time step and initially I have 200 is a stock so it takes 20 time units for it to hit 0 right. So, with this simple model if you take it and show it to your production manager suppose you have a consultant you will see what nonsense how can inventory be negative. You can explain no this is just approximation but he is not going to listen. This is just in represent reality make my model realistic first it is not capturing my actual system that we have. This is a simple example imagine if said demand itself was randomly varying and production was even if it is constant some period it will be negative some period it will be positive still people will not cannot comprehend whether what happens to do inventory is actually negative what does it even mean? You cannot convey such things to managers as analyst you can think of a negative inventory is called backlog then you should have an explicit variable called backlog and how will you respond to that why did not you have model backlog separately and you may say I do not represent backlog at all if there is no inventory my this thing is lost. So, why did you assume there is backlog? You go ask for chai if you say chai katam okai you do not measure it as a negative inventory right. He does not wait you that you will come back and I have chai again that demand is lost. So, whether you are assuming as lost demand or not it has to become more explicit idea is to make the model more clear. So, in this case is quite simple suppose the demand is lost right. So, we have to make it clear inventory should not be negative let us say although model shows no error it does not seem to be realistic say factory manager unhappy that the stock of finished goods goes negative. So, how do we fix it logically how will you fix it? How do you want to do? If demand is there and inventory sufficient meet the demand then I give it. If demand is not there I mean demand is more than inventory then I give whatever inventory available to meet the demand. If demand is lesser inventory then I give the full demand right. So, it is a simple if then else statement a simple way to fix it is use an if then else construct or a min function where sales equals the demand only if you have enough inventory. Can you model this? I mean I am sure you can model this model it. So, now sales rate will be a function of what? Inventory and demand. So, why do not you have a link from that and complete the model then simulate it then after time 20 your inventory should be 0, but a sales rate should be there should be at least 100 unit sales rate. Sales rate need to follow fall from. So, the previous model if you simulate it you will find that sales rates continue to be 110 production continues to be 100 inventory became negative. If sales is a function of inventory and demand then inventory has to fall to 0 sales rate will be initially 110 after sometime it will become 100 which will balance the production rate. Why do not you simulate it and see if that happens? Model it and simulate it. Go to sales rate if you want to know how if then else works you just click if then else it will give the help you can read it and model it. Did you do this? And sales rate you can either have two functions one it could be just if then else I think it should be inventory less than or equal to demand then inventory else demand or you could use a min function minimum of inventory or demand. This was sales rate. See as soon as introduce this model became non-linear right you do not need to have explicitly 2 power x or x into y even a simple min or max function makes your model non-linear. So, does it work? Did you simulate it? Did you units check? Units are not ok. What is it error say? Inventory units is SKU demand is SKU per day. How do we fix this? So, to do that so this is a very common phenomenon we are because many times we use these terms analytically many times we end up multiplying or dividing by 1. So, we do not usually represent it explicitly and it does not affect analytical result, but simulation validity it will affect. So, to make it proper let us define from inventory another variable called as max sales then define something called as average sales delay. So, in our equations we will do max sales is equal to obviously its inventory divided by average delay. The units of max sales is SKU by day simply keep average delay equal to 1 per day I am just writing the units right there. Now, your sales rate equation is equal to minimum of this max sales possible or max sales comma demand. Now, units match so it becomes more apparent. It is just good programming or modeling practice to not multiply inside the equation any constant numbers then it becomes very difficult. So, now we have brought the average delay as a constant right. So, you could have just divided we do not need to define max sales itself, but making it explicit gives us handle here. Suppose, average delay to move inventory is 3 days then all I have to do is come and change this into 3. That means, though I have inventory only one-third I can sell at any time period. So, those gets captured if I you know make all my parameters explicit and there is a physical meaning to each of it like this average delay could be the average time taken to move inventory right or instead of delay you can call it average fraction of inventory I would like to sell. So, I might have policy where I can only sell 90 percent of the inventory at any point in time. So, 10 percent I am not willing to sell or I just cannot get it all the way to the end. So, I might just put some limit or I might want to model say some fraction is being lost or there are defects in the system etcetera. So, usable inventory could be only 90 percent that is a variety of scenarios. So, it is good to explicitly bring out the parameters. Why do not you add this component? So, we will be removing this line, this causal link rather and including the one in the top. Hopefully, when you run it you should get the same behavior, but without the units error check, units error when you check the units it should not give you any more errors it should say all units are ok. Please check that. Oh sorry, this is not average delay is one day sorry not one per day. Having shown this please use all these non-linear constructs like if then else min there is a min there will be a max with caution it is very tempting when you start modeling systems ok if this scenario happens this is the behavior this is the behavior etcetera ensure model does not become too fuzzy because once you start putting this it is little more difficult to do sensitivity analysis of the models when you start doing that, but where it is unavoidable we have to use it. So, we just we just figured out how to use it let us just keep it there. Ok we did there were errors and we improved the model to ensure there are no unit errors.