You are on page 1of 11

LINEAR PROGRAMMING

Linear programming, sometimes known as linear optimization, is the problem of maximizing or minimizing a linear function over a convex polyhedron specified by linear and non-negativity constraints. Simplistically, linear programming is the optimization of an outcome based on some set of constraints using a linear mathematical model. Linear programming is the process of taking various linear inequalities relating to some situation, and finding the "best" value obtainable under those conditions. A typical example would be taking the limitations of materials and labor, and then determining the "best" production levels for maximal profits under those conditions. In "real life", linear programming is part of a very important area of mathematics called "optimization techniques". This field of study (or at least the applied results of it) is used every day in the organization and allocation of resources. These "real life" systems can have dozens or hundreds of variables, or more. In algebra, though, you'll only work with the simple (and graphable) two-variable linear case. The general process for solving linear-programming exercises is to graph the inequalities (called the "constraints") to form a walled-off area on the x,y-plane (called the "feasibility region"). Then you figure out the coordinates of the corners of this feasibility region (that is, you find the intersection points of the various pairs of lines), and test these corner points in the formula (called the "optimization equation") for which you're trying to find the highest or lowest value.

SAMPLE PROBLEM & SOLUTION A building supply has two locations in town. The office receives orders from two customers, each requiring 3/4-inch plywood. Customer A needs fifty sheets and Customer B needs seventy sheets. The warehouse on the east side of town has eighty sheets in stock; the west-side warehouse has forty-five sheets in stock. Delivery costs per sheet are as follows: $0.50 from the eastern warehouse to Customer A, $0.60 from the eastern warehouse to Customer B, $0.40 from the western warehouse to Customer A, and $0.55 from the western warehouse to Customer B. Find the shipping arrangement which minimizes costs. Hmm... I've got four things to consider: east warehouse to Customer A east warehouse to Customer B west warehouse to Customer A west warehouse to Customer B But I only have two variables. How can I handle this?

The variables obviously need to stand for the number of sheets being shipped, but I have four different sets of sheets. This calls for subscripts and explicit labelling: shipped from east warehouse to Customer A: Ae shipped from west warehouse to Customer A: Aw shipped from east warehouse to Customer B: Be shipped from west warehouse to Customer B: Bw Since Customer A wants 50 sheets and Customer B wants 70 sheets, then: Ae + Aw = 50, so Aw = 50 Ae (I'll call this Equation I) Be + Bw = 70, so Bw = 70 Be (I'll call this Equation II) Since the eastern warehouse can ship no more than eighty sheets and the western warehouse can ship no more than forty-five sheets, then: 0 < Ae + Be < 80 0 < Aw + Bw < 45 And the optimization equation will be the shipping cost: C = 0.5Ae + 0.6Be + 0.4Aw + 0.55Bw Where does this leave me? The equations (labelled as Equations I and II above) allow me to substitute and get rid of two of the variables in the second inequality above, so: 0 < Ae + Be < 80 0 < (50 Ae) + (70 Be) < 45

Simplifying the second inequality above gives me: 0 < Ae + Be < 80 0 < 120 Ae Be < 45 Multiplying through by 1 (thereby flipping the inequality signs) and adding 120 to all three "sides" of the second inequality, I get: 0 < Ae + Be < 80 120 > Ae + Be > 75 Since Ae + Be is no less than 75 and is no more than 80, then these two inequalities reduce to one:

75 < Ae + Be < 80 I can also simplify the optimization equation:

C = 0.5Ae + 0.6Be + 0.4Aw + 0.55Bw = 0.5Ae + 0.6Be + 0.4(50 Ae) + 0.55(70 Be) = 0.1Ae + 0.05Be + 58.50 Due to the size of the orders, I have: 0 < Ae < 50 0 < Be < 70 Since I have only two variables now, and since I'll be graphing with x and y, I'll rename the variables: Copyright Elizabeth Stapel 2006-2011 All Rights Reserved x = Ae y = Be Then entire system is as follows: Minimize C = 0.1x + 0.05y + 58.50, subject to the following: x>0 x < 50 y>0 y < 70 y > x + 75 y < x + 80 The feasibility region graphs as:

When you test the corner points, (5, 70), (10, 70), (50, 30), and (50, 25), you should get the minimum cost when you ship as follows: 5 sheets from the eastern warehouse to Customer A 70 sheets from the eastern warehouse to Customer B 45 sheets from the western warehouse to Customer A 0 sheets from the western warehouse to Customer B

SIMPLEX METHOD
Simplex Method is an iterative procedure that allows improving the solution at each step. This procedure is finished when isn't possible to improve the solution. Starting from random vertex value of the objective function, Simplex Method try to find repeatedly another vertex value that improve the one you have before. The search is done throughout the side of the polygon (or the edges of the polyhedron, if the number of variables is higher). As the number of vertex (and of edges) is finite, it will always be able to find the result. (See Graphical Method) Simplex Method is based on the following property: If objective function, f, doesn't take the max value in the A vertex, then there is a edge starting at A, along which the value of the function grows. You should take care about Simplex Method only works with "" type inequality and independent coefficients higher or equal to zero, and you will have to standardize the restrictions for the algorithm. Case after this procedure "" o "=" type restrictions appears (or not modified) you should try other ways, being Two-Phase Simplex Method the best choice.

PREPARING THE MODEL TO ADAPT IT TO THE SIMPLEX METHOD This is the standard way of the model: Objective function: Subject to: c1x1 + c2x2 + ... + cnxn a11x1 + a12x2 + ... + a1nxn = b1 a21x1 + a22x2 + ... + a2nxn = b2 ... am1x1 + am2x2 + ... + amnxn = bm x1,..., xn 0

To do this you must follow these rules: 1. 2. 3. 4. The objective must be maximize or minimize the function. All restrictions must be equal. All variables are not negatives. The independent terms are not negatives.

Changing the optimization type. If we want to minimize our model, we can keep it, but we must consider the new criteria for the halt condition (stop iterations when all coefficients in the value objective function row are less or equal to zero), and the leaving condition row. In order to not change criteria, we can convert the minimize objective function F to maximize objective F(-1).

Advantages: We will not have to worry about halting criteria, or exit condition of rows, since they keep on. Inconveniences: In the event of the function have his entire basic variables positive, and further the restrictions are inequality "", they become negatives when doing the change and plus signs remain in the row of the value of the objective function, then Simplex Method obeys the halting condition, and the optimal value that would be obtained is 0, by default. Solution: In fact this kind of problem does not exist, since so that the solution is greater than 0, any restriction should have the condition "", and then we would go into a model for the TwoPhase Simplex Method.

Converting the independent term sign (constants to the right of restrictions) We will have to arrange our model so that the independent terms of restrictions will be greater or equal to 0, if not, Simplex Method cannot be used. The only thing that would be necessary to do is multiply by "-1" the restrictions where independent terms be less than 0. Advantages: With this simple modification of signs in restriction we can use Simplex Method. Inconveniences: It can work out in restrictions where we have to modify the signs of constants, the signs of inequalities be ("=", ""), becoming ("=","") what in any event we will have to develop the Two-Phase Simplex Method. This inconvenience is not controllable, although it would be able to benefit us only if terms of inequality exist ("",""), and terms "" coincide with restrictions where the independent term is negative.

All restrictions become of equality. If an inequality of the type "", appears in our model, will we have to add a new variable, called surplus variable si, with restriction si 0. The new variable appears with coefficient equal to zero in the objective function , and subtracting in inequalities. A problem appears to us, let's see how to solve inequalities that contains an inequality type "" : a11x1 + a12x2 b1 a11x1 + a12x2 - 1xs = b1

As all our models based on that all his variables are greater or equal than zero, when we do the first iteration in the Simplex's model, the basic variables will not be in the base and they will take value zero, and all others will maintain their values. In this case our variable xs, after doing zero to x1 and x2, will take the value - b1. The condition of not negativeness will not come true, so it will be necessary to add a new variable, xr that will appear in the objective function with zero coefficients, and adding in the inequality of correspondent restriction. Would be left of the following way: a11x1 + a12x2 b1 a11x1 + a12x2 - 1xs + 1 xr = b1

This type of variables are called artificial variables, and they will appear when there are inequalities with inequality ("=",""). This will take us compulsorily to accomplish the Two-Phase Simplex Method that will explain later on. Itself mode, if inequality has "" type, we will have to add a new variable, called slack variable si, with restriction si "" 0. The new variable appears with zero coefficients in the objective function, and adding up in the inequalities. To sum up we can let this board, according to the inequality that appears, and with the value that the new variables must be with. Type of inequality = Type of variable - surplus + artificial + artificial + slack

STARTING THE SIMPLEX METHOD Once we have standardized our model, it can happen to go into the Simplex Method or TwoPhase Simplex Method. See yourself in the figure as we must perform on for reach the solution of our problem.

SAMPLE PROBLEM & SOLUTION

A store sells three brands of of stereo systems, brands A, B, and C. It can sell a total of 100 stereo systems per month. First constraint: a + b + c <= 100 (Note <= means less than or equal to.) Brands A, B, and C take up, respectively, 5, 4, and 4 cubic feet of warehouse space and a maximum of 480 cubic feet of warehouse space is available. Second constraint: 5a + 4b + 4c <= 480 Brands A, B, and C generate sales commissions of $40, $20, and $30, respectively, and $3200 is available to pay the sale commissions. Third constraint: 40a + 20b + 30c <= 3200 The profit generated from the sale of each brand is $70, $210, and $140, respectively. How many of each brand of stereo system should be sold to maximize profit? Objective function: 70a + 210b + 140c Lets go through an entire problem from start to finish. These are the constraints. Note Each variable has to be positive. 70a + 210b + 140c is the objective function to be maximized.

Construct the SIMPLEX TABLEAU (table). The top row identifies the variables. u, v, w and M are slack variables The numbers in bold are from the original constraints. The bottom row comes from setting the equation M = 70a + 210b + 140c to 0, i.e, -70a - 210b - 140c + M = 0

Choosing the PIVOT COLUMN. Determine if the left part of the bottom row contains negative entries. If none, problem solved. If yes, the pivot column is the column with the most negative entry in the last row. In this case it is column b. The left part is columns a, b or c. Choosing the PIVOT ROW. Divide the last column by the entries in each pivot column. The pivot row is the row with the least nonnegative ratio. Negative values or undefined values are ignored The pivot row is the row in bold (100 is least).

Choosing the PIVOT ELEMENT. The pivot element is the entry where the pivot column and pivot row intersect. The pivot element is the number in bold (1).

PIVOT around selected element Make all the numbers above or below the pivot element 0. The entry directly below pivot element is already 0. We need to make the other entries 0.

Pivot around selected element (contd...) Multiply -20 times ROW 1 and add it to ROW 3. ROW 1 is the first row containing numbers.

Pivot around selected element (contd...) Multiply 210 times ROW 1 and add it to ROW 4. ROW 1 is the first row containing numbers. Pivoting this element is complete.

Are we done yet? Determine if the left part of the bottom row contains negative entries. If none, problem solved. If yes, the pivot column is the column with the most negative entry in the last row. In this case it is column z. The left part is columns a, b or c

The left part of the bottom row contains no negative entries. So we are done pivoting. Let's write the solution. The solution. a = 0, b = 100, c = 0, u = 0 v = 80, w = 1200, M = 21,000 The only columns of interest to us are a, b, c, and M. Columns b,v,w,and M are the only columns pivoted. Columns not pivoted are set equal to 0.

What does this solution mean? The maximum profit is $21,000 when 100 brand B systems are sold (no brand A or C). We ignore the slack variables, except for M, but they are useful in determining other information not covered in these sections.