Linear Programming — Multiperiod Inventory Problem

Ryan Howe
5 min readJul 31, 2021


The following is meant to continue some of the work I had been doing in these two articles I wrote ( and


In these articles I introduced some basic ideas about linear programming models using some fictional water plant. The original problems are in block quotes below.

Problem 1

Geg table water factory produces types of water, namely, MG and HJ. Products are produced and sold on a weekly basis. The weekly production cannot exceed 50 for MG. And 70 for HJ because of limitations within factory. The company employed 120 workers. MG water production requires 2 man hour weeks of labor while HJ requires 1 man hour week of labor. Profit margin on MG is $120 and on HJ is $80.

Problem 2

In this case we’ll be looking at a company which has two factories, factory A and factory B. The company makes bearings and produces two products which we’ll call grade I and grade II. Each of these produces a different profit, grade I makes $10 and grade II makes $12. The company gets a certain amount of raw material every week (here we’ll say 100 lbs) and splits it between the plants.

Factory A will get 60 units and factory B gets 40 units. Now it takes 4 lbs to produce each bearing. They grind the bearings and then polish them. Factory A has a grinding capacity of 80 hours per week and has a polishing capacity of 60 hours per week. Now it takes factory A four hours to grind the grade I bearings and two hours of labor to polish them. In contrast it takes them only two hours to grind the grade II bearings but five hours to polish them.

In these I spent some time talking about how to formulate a linear programming model from a word problem and think about these problems. In each case the entire optimization problem took place in one time frame. Earlier periods of time were irrelevant and we just wanted to optimize the total profit. Most people would rightly point out that real world companies typically face the following challenges

  • The demand for the product is not even throughout the year. Many goods have demand that fluctuates over a given time period due to production schedules and consumer interest. For instance people this shouldn’t be a revelation but people are more likely to buy sunscreen in the summer.
  • They can store manufactured goods for later however they have storage costs and the goods may depreciate in value.
  • They have a limited labor supply but may pay more to exceed their normal supply. In other words a company may plan to pay for a given number of overtime work hours at a higher rate when there is additional demand.

To address some of these issues I will show how to take a problem like this and formulate it into a linear programming model.


The following problem is meant to cover some of this is based on basic examples you’d see. Suppose company X is planning their production for widgets for the next three months and they want to minimize the total costs.

  • There is a fixed level of demand for each months 1,2,3 which we’ll call M1,M2,M3. The demand for each month is 200,400,150 respectively.
  • The cost per unit for regular labor is $2000, the cost per unit for overtime labor is $3000.
  • It costs $250 for storage costs per unit at the end of the month.
  • It has a maximum production capacity of 200 units with regular labor but it is unlimited with overtime labor.
  • The company initially has 150 units with no initial costs for these.

Ok, now we have enough information to formulate this alright. To do this we’ll use some notation. Medium is kind of annoying with LaTeX so this may look odd. Our decision variables will be the following.

Decision variables for our problem

Now we can use these to formulate an expression for the costs. The cost per month is the cost of the all of these combined so we could write this as

The total costs of labor and inventory for production

After this finally we can write the constraints which are made from the production capacities combined with the inventory capacities. So the production capacity each month is 200 units for regular labor. You can write this as the following

Regular labor production constraints

After this we can get our monthly inventory. The inventory for month t is equal the previous months inventory plus the production minus the demand. You can write this as

inventory in month t

From this we get the following inventory based on the initial inventory and the demands (200,400,150) we get.

Inventory during month t

Now we can formulate the whole problem and we’d have this nice looking problem.

So now we’ve formulated the problem. I may add some code later for solving this.