Okay, so our next example is about production and some kind of storing or inventory decision. So, when we are making decisions in many cases we may also consider what will happen in the future? This is going to create some mount high period problems. Okay. So in many cases, for example, when we are making products, those products produced today may be used to be sold in the future if we carefully store them as inventory. Okay. And we may do that with several reasons. So first daily capacity may not be enough. Okay, so many products they have peak season and the off peak seasons. So maybe your products they are more popular during for example weekends. So weekdays no one wants to buy but for weekends I mean people wants to buy your product, then you may need to produce more during weekdays and then make inventories. Maybe production cost is different from day to day. So in cheaper days you want to produce more, maybe the price is higher in the future. So there can be all kinds of reasons for us to consider inventory. So now that's considered an example where the production decision is jointly considered with inventory decisions. So the decision is here, we now again produce and the sale that make it easier let's consider just one product for the coming four days. The marketing manager has promised the customers to fulfill the following amount of demands. So for day 1, 2, 3, and 4, for each of the day, you need to produce and sell 100 units, 150 units, 200 units, and 170 units. So more precisely, these are their sales quantity to be realized, okay? And once we do that, then we are able to earn some money, of course, but the thing is that we need to satisfy these demands, we need to realize these sales. And of course, we don't need to produce that product to be sold in that day, why is that? Because the production costs are different for the four days. Okay, making things in the first day seems to be cheaper, in the second day somehow is going to be more expensive. For example, maybe this particular day is a holiday. If you ask your employees to come you need to pay more something like that. So that creates some, chances for you to optimize your decision, by considering inventory. For consider inventory somehow, that requires us to connect these periods. We want to maximize profits. And because we assume all the prices to sell your products are all fixed. So profit maximization is the same as cost minimization. So for this problem, we're going to try to minimize our costs. So now that's considered inventory. We may store a product and then sell it later. And if we pay $1 per unit per day, we will be able to do that. So that $1 per unit per day, that forms the inventory cost or sometimes it's also called holding cost. Okay? Or some people call it inventory holding cost all, but anyway, that's the cost you need to pay to carry one unit of product from today to tomorrow. So very quickly, you may evaluate several solutions. For example, you may say, okay, I want to have a lot of inventory. So I'm going to produce the 620 units. Why 620 because of the sound of all these demands is 620. I want to produce everything on day 1, and then carry inventory to fulfill future demands. So if I do that, then my cost would be the following. I need to pay $9 for all the production, and then for 150 units I need to pay $1 of inventory holding cost because I need to carry 150 units by one day. For these 200 units, I need to pay $2 of inventory cost for each unit because I carry each unit by two days, okay? Because I produce these among 200 and then carried two days, to be sold on day two. So for the last batch 170 units, each of them, I need to pay $3. So overall, the total cost maybe calculated, which is the 6,640. So you may consider that as one candidate. There are of course other candidate plans, for example, the other extreme is that you will pay $9 to produce 100 units. You will pay $12 to produce 150 units, $10 for 200, $12 for 170 you may get another cost, but either one may not be optimal because they are just too extreme. There may be some other ways to do the inventory decision. Okay. So now that see how to do that, let's make it more precise. So for each day that say at the beginning, we have some beginning inventory on day T and T may be 123 or 4. Okay? So every day when you wake up, there are some ending inventory you have, okay. And then you are going to make some production and for that day you may quickly make some products and then you may sell them. Okay. And then lastly you have your ending inventory when you go to sleep. So pretty much we have this equation. Your beginning inventory plus the amount you produce, minus the amount you sell becomes your ending inventory. And we follow the convention to say that inventory costs are calculated according to your ending inventory. So whatever amount you have for tonight, you carry them to the next day you pay inventory. So if you produce 150 units for the day, and then you sell those 150 units on that day, there is no inventory cost to occur. So now we are ready to formulate our problem. We're going to decide the production quantity for each day. Right? And of course now we also need to decide how much how many to leave to the next day, so that say this is our ending inventory for each day. Yt is our ending inventory for day t. So here it's very important to say we are talking about ending inventory, because if we don't specify anything, we don't know whether it's beginning inventory or ending inventory. All right. So it's important to make your formulation to make your product description precise. So with that the objective function can be easily obtained. This first part is our production cost for each day, and we collect of them, that's the total production cost. And then according to our inventory amount for each day, we have the total inventory cost. Here we don't have coefficient because that's $1 per day. And then now we need to keep an eye on our inventory we need to calculate the amount of y according to our decision, x, so that's not too difficult because we already have that equation, right? So pretty much for day one, initially you have nothing. So your y1, your ending inventory is x1 minus 100. All right, so that's the first thing. And then for the second day, the second day is that your y1 plus x2 minus 150 becomes your y2. Whatever amount you have at the beginning plus the amount you add, add into your inventory minus the amount you sell becomes the ending amount you have for the other two days. That's the same thing. Okay? These are typically called the inventory balancing constraints. So we are calculating our inventory levels according to lease equations. Of course, we need to satisfy all the demands, right? So for day one, x1 is the only source of inventory. So x1 must be at least 100, that's fine. For day two, we need to have enough amount to be sold. That's why 1 plus x2 that should be at least 150. And so on and so on, and then all the numbers should be non negative. So, collectively we have our formulation. This is our objective function. These are inventory balancing constraints. And then we have four inequalities. They are demand fulfillment constraints. And then finally, we have non negativity constraints. So this is pretty much our first version formulation for this particular problem. The interesting thing is that we want to go through this example more deeply to give you the idea of simplification. May we simplify the formulation, actually we can, as long as we do some more deeper observations. The interesting thing is that inventory balancing and none negativity actually implied demand fulfillment. Why does that for example, in day one, we already know that your y1 is calculated based on x1 minus 100. It also tells you that y1 must be non negative right the ending inventory among must be non negative. So if that's the case, directly it says x1 minus 100 must be non negative. Right. And that just means demand fulfillment. And if you take a look at each day, that's the same thing. As strong as to our ending inventory is non-negative, then you fulfill all the demands. So actually, you only need inventory balancing, and the non-negativity constraints. You don't really need those demand fulfillment constraints. It's fine to conclude that they are redundant. And then redundant constraint means if we remove those the redundant constraints, the feasible region remain identical. So if we are able to find redundant constraints and remove them, that of course reduce the complexity of the programme. And if eventually we input our motto into a computer solver, that's may help us save some time to make the solution easier to be obtained. In fact, you may have one additional observation. You may argue that there's no reason to have ending inventory ii period 4, right, because we will stop our plenty in period 4. So if we have something left over at the end of period 4, it cost us some money but it is useless. So once we see that there is no reason to have y4. Or you may say y4 may be set to 0 directly. So that's also a correct observation. So this formulation here is also correct and the somehow is equivalent to previous ones. However here I need to tell you another thing. This is good but this is not always suggested. This is not always encouraged, at least at this stage, at least beginning stage. Why is that? Whatever programme we have, eventually we will input them into a solver to try to have the solver solve it. If we observe that in an optimal solution, y4 will be zero, your solver will also see it. So it doesn't really matter whether you see it by yourself. Okay. If you do a lot of observation and then just remove one single variable that does not help too much, especially if eventually you work on practical problems. All your practical problems their skill would be very large, thousands of file constraints, thousands of variables. Typically, there's no way for you to use your human judgment to use your careful observation to see something is not necessary. So I would say in general simplification is very good, but in most cases, it is not so necessary. So if you want to do some simplification of your programme, you may try, but I won't say is necessary. I won't say it's necessary.