Presentation on theme: "February 14, 2002 Putting Linear Programs into standard form"— Presentation transcript:
115.053 February 14, 2002 Putting Linear Programs into standard form Introduction to Simplex AlgorithmNote: this presentation is designed with animation to be viewed as a slide show.
2Linear Programs in Standard Form Non-negativity constraints for all variables.All remaining constraints are expressed as equality constraints.The right hand side vector, b, is non-negative.An LP not in Standard Formmaximize x1 + 2x2 - x3 + x4x1 + 2x2 + x3 - x4 ≤ 5;-2x1 - 4x2 + x3 + x4 ≤ -1;x1 ≥ 0, x2 ≥ 0not equalitynot equalityx3 may be negative
3Converting Inequalities into Equalities Plus Non-negatives Afterx1 + 2x2 + x3 - x4 +s = 5s ≥ 0Beforex1 + 2x2 + x3 - x4 ≤ 5s is called a slack variable, which measures theamount of “unused resource.”Note that s = 5 - x1 - 2x2 - x3 + x4.To covert a “≤” constraint to anequality, add a slack variable.
4Converting “≥” constraints Consider the inequality -2x1 - 4x2 + x3 + x4 ≤ -1;Step 1. Eliminate the negative RHS2x1 + 4x2 - x3 - x4 ≥ 1Step 2. Convert to an equality2x1 + 4x2 - x3 - x4 - s = 1s ≥ 0The variable added will be called a “surplus variable.”To covert a “≥” constraint to an equality,subtract a surplus variable.
5More TransformationsHow can one convert a maximization problem to a minimization problem?Example: Maximize 3W + 2PSubject to “constraints”Has the same optimum solution(s) asMinimize -3W -2P
6The Last Transformations (for now) Transforming variables that may take on negative values.maximize 3x1 + 4x2 + 5 x3subject to 2x1 - 5x2 + 2x3 = 17other constraintsx1 ≤ 0, x2 is unconstrained in sign, x3 ≥ 0Transforming x1: replace x1 by y1 = -x1; y1 ≥ 0.max -3 y1 + 4x2 +5 x3-2 y1 -5 x2 +2 x3 =17y1 ≥ 0, x2 is unconstrained in sign, x3 ≥ 0One can recover x1 from y1.
7Transforming variables that may take on negative values. max -3 y1 + 4x2 +5 x3-2 y1 -5 x2 +2 x3 =17y1 ≥ 0, x2 is unconstrained in sign, x3 ≥ 0Transforming x2: replace x2 by x2 = y3 - y2; y2 ≥ 0, y3 ≥ 0.max -3 y1 + 4(y3 - y2) +5 x3-2 y1 -5 y3 +5 y2 +2 x3 =17all vars ≥ 0One can recover x2 from y2, y3.
8Another ExampleExercise: transform the following to standard form (maximization):Minimize x1 + 3x2Subject to x1 + 5x2 ≤ 12x1 + x2 ≥ 1x1 ≥ 0Perform the transformation with your partner
9Preview of the Simplex Algorithm maximizesubject to
10LP Canonical Form = LP Standard Form + Jordan Canonical Form z is not adecisionvariableThe basic variables are x3 and x4.The non-basic variables are x1 and x2.The basic feasible solution is x1 = 0, x2 = 0, x3 = 6, x4 = 2
11For each constraint there is a basic variable Constraint 1: basic variable is x3Constraint 2: basic variable is x4The basis consists of variables x3 and x4
12Optimality Conditions Preview Note:z = -3x1 + 2x2Obvious Fact: If one can improve the current basic feasiblesolution x, then x is not optimal.Idea: assign a small value to just one of the non-basicvariables, and then adjust the basic variables.
13The current basic feasible solution (bfs) is not optimal! If there is apositivecoefficient inthe z row, thebasis is notoptimal**Recall: z = -3x1 + 2x2Increase x2 to ∆ > 0. Let x1 stay at 0.What happens to x3, x4 and z? .
14Optimality Conditions (note that the data is different here) ImportantFact. If thereis no positivecoefficient inthe z row, thebasic feasiblesolution isoptimal!z = -2x1 - 4x2 + 8.Therefore z ≤ 8 for all feasible solutions.But z = 8 in the current basic feasible solutionThis basic feasible solution is optimal!
15Let x2 = ∆. How large can ∆ be? What is the solution after changing x2? What is the value of ∆ that maximizes z, butleaves a feasible solution?Fact. The resulting solution is a basicfeasible solution for a different basis.∆ = 1.
16Pivoting to obtain a better solution New Solution: basicvariables are x2 and x3.Nonbasics: x1 and x4.If we pivot on the coefficient 2, we obtain the newbasic feasible solution.
17Summary of Simplex Algorithm Start in canonical form with a basic feasible solutionCheck for optimality conditionsIf not optimal, determine a non-basic variable that should be made positiveIncrease that non-basic variable, and perform a pivot, obtaining a new bfsContinue until optimal (or unbounded).
18OK. Let’s iterate again. z = x1 - x2 + 2 The cost coefficient of x1 is positive.Set x1 = ∆ and x4 = 0.How large can ∆ be?
19A Digression: What if we had a problem in which ∆ could increase to infinity? Suppose we change the 3 to a –3.Set x1 = ∆ and x4 = 0.How large can ∆ be?If the non-costcoefficients in theentering column are≤ 0, then the solutionis unbounded
20End Digression: Perform another pivot What is the largest value of ∆ ? ∆ = 1Variable x1 becomes basis, x3 becomes nonbasic.Pivot on the coefficient with a 3.
21Check for optimality There is no positive coefficient in the z-row. The current basic feasible solution is optimal!
22Summary of Simplex Algorithm Again Start in canonical form with a basic feasible solution1Check for optimality conditionsIs there a positive coefficient in the cost row?If not optimal, determine a non-basic variable that should be made positiveChoose a variable with a positive coef. in the cost row.increase that non-basic variable, and perform a pivot, obtaining a new bfsWe will review this step, and show a shortcutContinue until optimal (or unbounded).
23Performing a “Pivot”. Towards a shortcut. z = 2x1 + 3Exercise: to do withyour partner.1. Determine how large ∆ can be.2. Determine the next solution.3. Determine what coefficient should be pivoted on.4. See if there is a shortcut for finding the coefficient.
24More on performing a pivot To determine the column to pivot on, select a variable with a positive cost coefficientTo determine a row to pivot on, select a coefficient according to a minimum ratio ruleCarry out a pivot as one does in solving a system of equations.
25Next Lecture Review of the simplex algorithm Formalizing the simplex algorithmHow to find an initial basic feasible solution, if one existsA proof that the simplex algorithm is finite (assuming non-degeneracy)