LECTURE: INTRO TO LINEAR PROGRAMMING AND THE SIMPLEX METHOD, KEVIN ROSS MARCH 31, 2005 DAVID L. BERNICK dbernick@soe.ucsc.edu 1. Overview Typical Linear Programming problems Standard form and converting to Standard form Geometry of Linear Programming Extreme points, linear independence and bases Optimality conditions The Simplex method 2. Typical Linear programming Problems 2.1. Product Mix problem Problem: How much beer and ale should be produced? available resources = amt. item(pounds) 480 corn 160 hops 1190 malt (1) item corn hops malt required resources = (barrel) (pounds) (ounces) (pounds) Ale 5 4 35 (2) Beer 15 4 20 profit = [ ] Ale $13/barrel Beer $23/barrel (3) 1
2 Analysis: A = Ale(barrels) B = Beer(barrels) Objective f unction Max{P rofit = 13A + 23B} Constraints : Subject to(s.t) 5A + 15B 480 4A + 4B 160 35A + 20B 1190 A, B 0 In general: c i = product i profit x i = product i count b j = resource j availability a i,j = resource j required for product i objective f unction = max{ c i x i } s.t. a i,j x i b j i {products} x i 0 i {products} 2.2. Transportation Problem Problem: Production of computers in Singapore and Oakland Distribution centers in Oakland, Hong Kong and Istanbul
3 Supply, demand and cost summary: ship.cost Oakland HongKong Istanbul Supply Singapore 85 37 119 500 Supply, demand, cost = Hohboken 53 189 94 300 Demand 350 250 200 (4) Objective: meet demand with minimum total cost. Analysis: c i,j = ship.cost from i to j S i = supply from site i D j = demand from site j i {Singapore, Hohboken} j {Oakland, HongKong, Istanbul} x i,j = count shipped from i to j objective = i,j c i,j x i,j s.t. x i,j = S i i(supply) j x i,j = D j j(demand) i x i 0 3. Other LP examples Blending Problem Diet Problem Assignment Problem 3.1. Blending Problem Problem: Consider a constraint where at least 10% of output must be from 1 variable. We then have a constraint of the form: 0.10. This is not a x i i xi linear equation but we can change it to: x i 0.10 i x i and now it is a linear form.
4 4. Key elements of a LP Proportionality - the function depends on a proportion assigned to a variable. Additivity Divisibility 4.1. Steps in building a LP Identify the activities. Identify the items. Identify the Input / Output coefficients. Write the constraints. Identify the coefficients of the objective function. 5. Geometry of a LP Consider the plot of the solution space for the following: objective function : max{x 1 + x 2 } s.t. 3x 1 5x2 15 3x 1 5x2 12 x 1, x2 0 As a quick way to find the regions specificd by the inequality, consider weather (0,0) is a solution for the inequality or not. In this case, (0,0) is part of the solution spacec for all constraints. Geometrically, this problem can be viewed as Fig:??. As can be seen, the solution is at a corner. This is true in general for Linear Programming problems - one of the optimal points will be at a corner. This is the basis of the Simplex method. 6. Standard Form Types of LP descriptors: Objective f unction : max(c 1 x 1 + c 2 x 2 +... c N x N s.t a 1,1 x 1 + a 1,2 x 2 +... + a 1,N x N = b 1 a 2,1 x 1 + a 2,2 x 2 +... + a 2,N x N = b 2 x j 0, j = 1, N
5 Figure 1. Graph of feasible region, bounded by all constraints, with family of curves of x 1 + x 2 and max(x 1 + x 2 ). or consisely: max(c x) s.t. Ax = b x 0 where A is an [m x n] matrix of N variables and m constraints. All LP problems can be converted to standard form. The following situations can arise, and are converted to standard form as follows: inequalities free variables MINimizations 6.1. Handling Inequalities For example, the constraint x 1 + x 2 4 can be handled by introducing a new, surplus variable x 3. This constraint then becomes x 1 + x 2 + x 3 = 4 s.t x 3 0.
6 6.2. Handling Free variables In the case where a variable is free (x 1 is unconstrained), then we once again introduce a new, surplus variable. For example: objective f unction : min(x 1 + x 2 ) x 1 R(free variable) s.t. x 2 0 x 1 + x 2 = 3 replace x 1 = x + 1 x 1 x + 1, x 1 0 rewritten in standard form: objective f unction : min x 1 + x 2 new variable does not appear in the objective function s.t. x 2 0 x + 1 + x 1 + x 2 = 3 x + 1, x 1 0 6.3. Handling MIN objectives (vs. MAX) To convert a MIN to a MAX, negate the terms. For example: min x 1 + 3x 2 = max x 1 3x 2. Remember, any surplus variable that is introduced does not appear in the objective function - only in constraints. 7. Solutions, Extreme points and Basis How many solutions are there to a set of linear equations? Convexity of a feasible region. Extreme Points
7 7.1. How many solutions exist for a set of linear equations How many linearly independent rows and columns exist in the set? matrix notation, the set of equations is described by Ax = b. If A is a square matrix (NxN) and det(a) 0 then x = Ab is unique. In general, A is rectangular (m x N), with many variable and few constraints. In 7.2. Convexity of a feasible region X a convex set iff x 1, x 2 X λx 1 + (1 λ)x 2 X, {0 λ 1} or, for any two points in set X, any point between any point between those 2 points is also in the set. 7.3. Extreme Point of X x is an extreme point iff for distinct x 1, x 2 X if, x = λx 1 + (1 λ)x 2, {0 λ 1} = λ {0, 1} then x is an extreme point or, if x is not between 2 other points in the set, then it is an extreme point. 8. Linear independence of vectors Basis of a matrix A basic solution of an LP Basic Feasible solution (Corner Point Feasible) 8.1. Basic Feasible solution(bfs) x is an extreme point of a solution space iff it is a bfs of Ax = b, {x 0}. Key fact: If an LP has an optimal solution, it exists at a corner of the feasible region.
8 8.2. Basis of a matrix Linear independence Let V 1, V 2,..., V N be vectors. They are linearly independent, if : α 1 V 1 + α 2 V 2... + α N V N = 0 = α 1 = α 2 =... α N = 0 Basis of matrix A is a maximal linearly independent set of columns of A. For example: A = [ ] 1 1 0 1 1 1 (constraints) Basis(A) = 1st and 3rd columns of A, or 2nd and 3rd columns Only a certain number of constraints need to be binding. 8.3. Rank of a Matrix Rank of a matrix = number of independent columns in the matrix. [m x n] matrix A is full rank if rank(a)=m. Or, if there are at least as many idependent columns as there are constraints. A = a 1,1 a 1,2... a1, N.. a m,1 a m,2... a m,n for m constraints and n variables.
9 8.4. Linear Programming Write A = [B, N] where B is a basis of A. [ ] 1 2 0 1 1 A = 0 0 1 1 1 [ ] 1 0 Basis of A = B = 0 1 [ ] 2 1 1 Leftover or Null = N = 0 1 1 Rewrite constraints as: max c T x s.t. Ax = b x 0 ( ) xb [B, N] = b x N set x N = 0 A = [B, N] x B = B 1 b Bx B + Nx N = b Set Nx N = 0 X B = b X B = B 1 b 9. Simplex Method - Overview Checks Corner Points Looks for better solutions at each iteration Simplex Algorithm: Find a starting point - a corner. Test this point for optimality Stop if this point is optimal, otherwise repeat One basic variable is replaced by another. Optimality test identifies the basic variable to replace.