 Let us just do a couple of examples of linear programming and so this is a popular example it is called the problem is called the diet problem. So imagine the Ministry of Human Resource Development that it provides mid-day meals to children in school it is suppose mandates that a certain nutritional requirement for the meal. So it says you have a list of nutrients such as say vitamin A, vitamin C, suppose fiber carbohydrates, carbohydrates, proteins etc these are nutrients that you must that your foods must have and the Ministry specifies what is the amount of nutrients that you need to have. So for example it says that say vitamin A should be in every meal in every dish that you create it must have say half a milligram of vitamin A. So the requirements here are all in so in milligrams per kg of the dish vitamin C suppose in a similar way is say 15 milligrams per kg of the dish say fiber suppose similarly is say 4 milligrams per kg etc. Now what you the choice you have is to look at the is to look at food stuff that are on offer ingredients that are on offer and to see what sort of dishes you can create out of this. Say for example you have three food ingredients you can say one is carrot suppose other is cabbage and say cucumber or this does not complete a meal but I am just for illustrative purpose. So these are the last column here are the required amount of these nutrients. Now what we know is say carrot has 35 milligrams of vitamin A per kg of the carrot, cabbage has 0.5 milligrams per kg of vitamin A per kg of the cabbage, cucumber has also 0.5 milligrams per kg, vitamin C is say similarly 60 here say 300 suppose and say 10, fiber carrot has say 30, this is 20 and this is supposed to ignore the carb and proteins for the moment. So question to the school is to now say well this is what the ministry mandates that the children should be fed at least 0.5 milligrams per kg of vitamin A they must be fed 15 milligrams of vitamin C per kg, 4 milligrams of fiber per kg and you have these three ingredients on offer which is a carrot, cabbage and cucumber. What you need to do is come up with decide what should be the fractions of all of these in order to meet these requirements. Now what is the objective? The objective is say suppose these are these all have some prices. So suppose the price, let me erase this for the moment, let me look at the price. Let us say the price of carrot is say 75 rupees per kg, this is 50 rupees per kg, this is 15 rupees per kg, these are the prices. So if you the question for the school is to now say what is the cheapest combination that it can make so that the requirements are satisfied. So what are the variables here and what are the constraints? What are the decision variables? The decision variables are how much, how many kgs of, how many kgs of carrot would you add, how many kgs of cabbage would you add, how many kgs of cucumber would you add. So suppose let us say x1 is the amount of carrot, x2 is the amount of cabbage, x3 is the and this is the amount of cucumber. So we can write this as a linear program. So the objective is to come up with the cheapest combination. So the cost if you have x1 amount of carrot, x2 amount of cabbage and x3 amount of cucumber, the cost that you will encounter, you will accrue is 75 into x1 plus 50 into x2 plus 15 into x3. This will be the cost that you will have, this would be the cost of, this would be the cost that you will encounter for per kg of the dish that you create. And now what does, how do, what are my constraints? My constraints are that my nutritional requirement should be satisfied. Now if I have x1 amount of carrot, then I know that it is going to give me 35 milligrams, 35 milligrams of vitamin A. So 35 into x1 is the amount of vitamin A that I get plus 0.5 into x2 is the amount of vitamin A I get from cabbage plus 0.5 into x3 is the amount of vitamin A I get from cucumber. All of this, this should be greater than equal to the nutritional requirement which is 0.5. Similarly I have an additional requirement which is 60 into x1, this is for, so this here was for vitamin A. I have similarly for vitamin C. So 60 into x1 plus 300 into x2 plus say 10 into x3 and this should be greater than equal to 15. Finally 30 into x1 plus 20 into x2 plus 10 into x3, this should be greater than equal to 4. Any constraints that I am missing in this? Yeah. So all these, these are, these is the amount of cabbage, etcetera, etcetera per kg of the dish. So consequently they have, these all have to be greater than equal to 0. So I need x1 greater than equal to 0, x2 greater than equal to 0 and x3 greater than equal to 0. You can see this is now a linear program in the variables x1, x2, x3. Now this does not tell you a recipe, this just tells you the proportion. You can now using this proportion you devise the actual, the actual thing that you want to create out of this. So I will give you, let us do one. So this was actually remarkably, this was a very simple problem but is a famous problem because this was actually one of the early problems studied. So I told you this in the, in the, as a story about midday meals for school children. It was actually studied as nutritional requirements for, for soldiers about what, what should they be, you know what sort of meals should they be having in order to meet their, meet their nutritional requirements. So this was one of the early problems that was actually formulated and studied as a linear program. So here is another, here is another example. This is a slightly more complex example. So suppose you have, you have, you have an old computer, an old computer O here, old computer and you want to, you are going to migrate yourself to a new computer. This, so this is O and this is N. So this is your, a new computer. Now when you want to migrate from old to new, suppose it is so, you need to now move your data from old to new and now the computer man, you do not have say, you do not have a, it is a huge amount of data, you do not have a pen drive or something that can, that can carry all of it. What you can do is transfer the data over the, over a network. So the data can be moved around like this. So suppose here is, you have a network like this comprising of these various computers. So here is A, here is B, here is C and then there is B and then there is E. And the network is connected like this, O is connected to A, O is connected also to B, A is connected to B, B is connected, sorry, O is connected to C, C is connected to D. So C is connected to D like this, A is connected to D, B is connected to E, C is connected to E and E is finally connected to N and D is also connected to N. So your data starts from O here and has to get to N. Now it can flow over any of these linkages that are present between the computers. So imagine these are some fiber optic cables or whatever and it can flow over any of these linkages. There are limitations in the sense that you cannot pump more data through a link than its capacity. So the capacities of these links is given, is written like this. So here is the capacity of O to A is 3, capacity of O to B is 1, capacity of O to C is 1, capacity of C to E is 4, capacity of C to D is 4, capacity of B to E is 3, A to B is 1, A to D is also 1 and D to N is 4, all right. Now the way we interpret these capacities, this is the capacity for flow in either direction. So you can send data when I say that the capacity of CD link is 4, it means that 4 MB per second can move from C to D or from D to C, okay. That is what we mean by, that is the meaning of this capacity, all right. Let us also assume for simplicity that although these are computers, let us also assume that they do not have any local storage. So whatever data that comes in has to be then transferred, has to be sent out through the same node instantaneously to another, whatever data that comes into the node has to be also shipped out to another node, all right. So question now is what is the, what is the maximum flow that, what should be the, how should you send this data, so through this network so that you get the maximum data rate, E to N is 1, sorry, right. So what are the variables in this? Yeah, so the variables, the variables here are the, the variables are the, these variables are xij, where xij just talks of what is the MBs per second of data that is flowing on link i to j. Now we do not, we will not make any assumptions about the direction, let the direction get determined on its own, all right. So what we will, we will just have these variables, let us declare them. So xoA is from all to A, xob, xoc, then xab, xad, then xbe, then xcd, xce, xdn, and xen, these are the variables. Now what do you want to, what do you want to maximize? You would like to maximize the flow that goes out of, the flow that goes out of A, out of O. Now the flow that goes out of O because nothing is stored anywhere on the network, the flow that goes out of O is also equal to the flow that reaches n per, the MBs per second that flows out of O is also equal to the MBs per second that will reach n because nothing is stored in between, whatever comes in must go out, okay. So let us say we want to maximize xoA plus xob plus xoc, this is the flow that is, that is going from, that is going out of O, right. Now what are the constraints? The variables are, this whatever be the direction of the flow, you are constrained by the capacity, which means that the, if you look at xoA in absolute value, it must be less than equal to 3, xob in absolute value must be less than equal to 1, xoc likewise in absolute value should be less than equal to 1, etc. I can write, I can write all of these, so let us maybe just, let us just write them out. So xab has to be less than equal to 1, xad has to be less than equal to 1, xbe, absolutely less than equal to 3, xcd less than equal to 4, xce less than equal to 4, xdn less than equal to 4 and xen is less than equal to 1. These variables, so these constraints encapsulate that your capacity of the network of every link in the network must be respected. Now we need to also use the fact that the network does not store anything, right. So whatever comes into A is also what goes out of A. Now let us, the way we have, the way this is all written, we have a convention here about that xoA when I am saying I am maximizing this oA plus oB plus oC, it means its flow that is going from o to A, o to B and o to C. So xij is flow from i, from i to j, right. So let us, so if I, so the flow that comes into A then is, flow that comes into A, there is only one, in terms of the variables that I have defined, in terms of the variables that I have defined, there is only one variable that stands for flow that comes into A and that is xoA, right. So xoA is the flow that comes into A. That should be equal to the flow that goes out of A. What are the flows that go out of A? The flow that goes out of A is ab plus ad, right. So xoA is equal to xab plus xad. Now likewise, let us do say xob. This is the flow that goes in, what is the flow that comes into B? It is ob plus ab, right. So remember xij is flow that goes from i to j, right. So xob plus xab. This should be equal to the flow that goes out of B, which is xbe. What is the flow that comes into C? It is xoc. That should be equal to xcd plus xce. Flow that comes into D, what is the flow that comes into D? Ad plus cd, xad plus xce. And that should be equal to the flow that goes out of D, which is xd, dn. And finally, for e, the flow that comes into e is xce plus xbe. And that should be equal to the flow that goes out of e, which is xen. Now if you look at these equations, the ones that are written here in this box, look at these 5 equations. You will see that if I just add them all up, what would I get? What I get on the left hand side is xoA plus xob plus xoc. Several terms are going to cancel when I add them up. xoA plus xob is going, so this plus this, when I add, for example, xab will cancel with xab here. So xab and xab will cancel here, xad here will cancel with this, xad, xbe will cancel with this, xce will cancel with this, xcd will cancel with this. So eventually, on the left hand side, all I will be left with is xoA, xob and xoc, which is my objective, xoA plus ob plus oc. What will be left on the right hand side? It will be xdn plus xen. These are the only terms that do not have a corresponding thing on the left hand side. Everything else is going to get cancelled. So that is what I said at the start that this is this here is the flow that goes out of O and that will be equal to the flow that enters n. So you can model this problem in either way. So long as you have written your flow constraints correctly, both will give you the same answer. You can model it as flow leaving O or you can model it as flow entering n. Now this is still not a linear program. Why is this not a linear program? It is not a linear program because my constraints here, these constraints are all nonlinear because I have an absolute value here. But I can write these in a linear form in a very easy way. So any of these let us say for example, if I take this one, this mod absolute value of this less than equal to 3 is the same as saying xoA greater than equal to minus 3 less than equal to 3. And similarly, say let us do one more x mod of xad less than equal to 1 that is equivalent to minus 1 less than equal to xad less than equal to 1. Link capacity is not negative. So it is xoA greater than equal to minus 3 means just the flow from the flow from A to O can be at most 3. So this by doing this I can convert this to a linear program. Am I missing any constraint? Do I need to put x greater than equal to 0 xoA greater than equal to 0 xab greater than equal to 0 etc. Yes or no? So if you put that then you are already presuming a certain direction for the flow. The advantage of not of keeping all this unsigned is that you let the program determine the sign of the direction of the flow. So long what you fix is only the convention of for interpreting the variable not the not the direction to begin with. If you wanted to put a direction for xoA and as greater than equal to 0 then you need to declare another variable because there could be a possibility for flow in the opposite direction also. So you would have to then declare another variable for flow in the opposite direction. Is it clear? So since we are not keeping any we are letting the sign of x get determined on its own we do not need to do that. So this completes the problem formulation. All of these linear constraints this and the corresponding one for these absolute value constraints and these linear equations. So this is an example of what is called a transportation problem. So they have this particular transportation problem always has this particular feature that if you add up all the rows you would get back on the left hand side or on the right hand side the objective of your problem. So you can of course use this to model not just data flow you can use this to model material flow flow of you know flow of troops flow of cargo etc etc ok. So we will stop here and next time we will continue with duality theory of linear problem.