Friday, March 23, 2012

An Introduction to Linear Programming

Motivation for Today's Class

During my previous MIS course on Wednesday, we had a discussion about business process modeling based on students' experience playing IBM's Innov8 game (http://www.ibm.com/innov8).  During that class, we reviewed the basics of Business Process Modeling Notation and discussed some ways business process improvement can build on emerging technologies in supply chain management, call center management, and traffic control.  In the Innov8 simulation game, students were asked to revise business models and then to allocate resources to various paths within that model (e.g., determine the number of expensive high-skill call-center employees versus less expensive low-skill call-center employees. I asked the students how they approached this resource allocation problem, and they said they just kept playing with the numbers in the simulator, making random guesses until they got the desired results.  

I told the students there was a more systematic way of addressing these kinds of problems and asked if any of them had learned about linear programming in their other classes. They had not. So I decided to give them a linear programming introduction tutorial today. 

I had prepared a number of slides with pictures and some example problems, along with a graphing calculator utility on my macbook. However, I had problems getting my laptop to work with the in-room projector.  Thankfully, I understood the material well enough to work through the problems on the board without my slides.  

Linear Programming

I first went to the article, "Linear Programming: Managing with Constraints" from the Marriott Magazine that the students had been assigned to review prior to coming to class. The article is part of a larger set of tutorials to introduce math tools to managers.  The article's author states that linear programming is "arguably the most widely used mathematical tool in business management." I tried to underscore this principle with my students hoping to motivate them to learn this topic for more than just their grade in an IS course. 

Happy Trails

The tutorial begins with a profile of a company Happy Trails that produces a classic trail mix. They're weighing the option to launch a second line of trail mix with a larger proportion of dried fruit than their classic mix.  They need to figure out if it would be profitable to offer the two lines of trail mix and, if so, what proportion of classic mix vs. fruitylicious mix they should produce to maximize their profit. 

I told the students that this and the other example problems we would be looking at today all had the same structure: we are trying to optimize one function while working within a given set of constraints. I said it was like trying to go buy ice cream at Foodland for what seems like $12 a quart when you only have two dollars in your pocket. You need to know what you can and can't do with the resources you have available. 

That's all linear programming is: identifying the equations for the lines (hence the term linear in linear programming) and optimizing (finding the maximum or minimum value depending on the context) of a separate function using the points where the constraint lines intersect / overlap.  

We first set up the variables we'll use in this problem. 

Setup

Let x equal the number of classic packages produced. 
Let y equal the number of fruitilicious packages produced. 

Identify Constraint Equations

In the happy trails example, the constraints we have are the maximum ounces of peanuts we can use to produce trail mix (8x + 4y <= 20,000), the maximum ounces of dried fruit we can use to produce trail mix (6x + 10y <= 30,000), and the fact that we cannot produce a negative packet of either type of trail mix ( x >= 0, y >= 0). We could manually graph each of these lines and then determine the intersection points.  And that's just what I did on the white board.  But, I wanted to help my students see their responsibility is to understand the equations, not to spend all their time performing arithmetic.  On next Wednesday, we'll discuss how to use functions like SOLVER in spreadsheet programs to address these problems.  

Today, I showed the students how they could use Wolfram Alpha to solve these inequality constraints.  By typing in the following into the Wolfram Alpha search box, the students can graph the shape made by overlapping these functions: 

8x + 4y <= 20000, 6x + 10y <= 30000, x >= 0, y >= 0

Adding the profit optimization function to the Wolfram Alpha query, we can generate the coordinates at which we can maximize profit. We know from the article that each bag of classic mix (x) generates $1.50 profit and each back of fruitylicious (y) generates $1.00 of profit. Therefore, P = 1.5x + 1.0y. We, thus, enter the following into the Wolfram Alpha search box: 

8x + 4y <= 20000, 6x + 10y <= 30000, x >= 0, y >= 0, P = 1.5x + 1.0y

Wolfram Alpha generates the following solution: 



We see here three solutions to our inequalities. It's a little hard to read with the Re or the Im preceding each of the P's, but this is just Wolfram Alpha's way of dealing with complex numbers (made up of real and imaginary components).  I'm not sure where in the linear programming algorithm, things turn into complex numbers, but we'll gloss over that in this introduction.  In comparing this output with the solution in the Marriott Magazine article, we can see in this output the numbers included in the solute: 
  • On the first line, we see that P <= 3000.  3,000 is the value of P assuming we produce 0 classic mixes and 3,000 fruitilicious mixes. 
  • On the second line, we see that P <= 3750. This is the value of P assuming we produce 2,500 classic mixes and no fruitilicious mixes.  
  • On the third line, we see that P < 30000 / 7 ( approx 4285). This is the value of P assuming we produce 1428.6 classic mixes and and 2142 fruitiliciouls 
Therefore, our solution is that we should produce 1428.6 classic mixes and 2142 fruitilicious mixes. 

Additional Practice Problems

We worked through additional linear programming exercises from www.purplemath.com.  We also discussed some of the assumptions related to linear programming and it's uses, business principles related to pricing products, selling products at a loss, and disruptive innovation.