Linear Programming: Simplex

Similar documents
Optimality, Duality, Complementarity for Constrained Optimization

The dual simplex method with bounds

Lecture: Algorithms for LP, SOCP and SDP

3 The Simplex Method. 3.1 Basic Solutions

Yinyu Ye, MS&E, Stanford MS&E310 Lecture Note #06. The Simplex Method

Chapter 3, Operations Research (OR)

1 Review Session. 1.1 Lecture 2

2.098/6.255/ Optimization Methods Practice True/False Questions

Constrained Optimization Theory

Review Solutions, Exam 2, Operations Research

Ω R n is called the constraint set or feasible set. x 1

The Dual Simplex Algorithm

COT 6936: Topics in Algorithms! Giri Narasimhan. ECS 254A / EC 2443; Phone: x3748

A Review of Linear Programming

Motivating examples Introduction to algorithms Simplex algorithm. On a particular example General algorithm. Duality An application to game theory

Chapter 5 Linear Programming (LP)

Lecture Notes for CAAM 378 A Quick Introduction to Linear Programming (DRAFT) Yin Zhang

Linear Programming Redux

1. Algebraic and geometric treatments Consider an LP problem in the standard form. x 0. Solutions to the system of linear equations

A Parametric Simplex Algorithm for Linear Vector Optimization Problems

Linear Programming The Simplex Algorithm: Part II Chapter 5

Simplex method(s) for solving LPs in standard form

Introduction to optimization

4.5 Simplex method. LP in standard form: min z = c T x s.t. Ax = b

Summary of the simplex method

Linear programs Optimization Geoff Gordon Ryan Tibshirani

"SYMMETRIC" PRIMAL-DUAL PAIR

AM 205: lecture 19. Last time: Conditions for optimality Today: Newton s method for optimization, survey of optimization methods

Chapter 1: Linear Programming

Lecture 2: The Simplex method

The Simplex Algorithm

LP Duality: outline. Duality theory for Linear Programming. alternatives. optimization I Idea: polyhedra

Distributed Real-Time Control Systems. Lecture Distributed Control Linear Programming

Revised Simplex Method

LINEAR PROGRAMMING I. a refreshing example standard form fundamental questions geometry linear algebra simplex algorithm

CO 250 Final Exam Guide

9.1 Linear Programs in canonical form

Lecture slides by Kevin Wayne

CS 6820 Fall 2014 Lectures, October 3-20, 2014

Applications. Stephen J. Stoyan, Maged M. Dessouky*, and Xiaoqing Wang

Chap6 Duality Theory and Sensitivity Analysis

TIM 206 Lecture 3: The Simplex Method

Part 4: Active-set methods for linearly constrained optimization. Nick Gould (RAL)

56:270 Final Exam - May

Math 273a: Optimization The Simplex method

Multicommodity Flows and Column Generation

15-780: LinearProgramming

Lectures 6, 7 and part of 8

Introduction to linear programming using LEGO.

Note 3: LP Duality. If the primal problem (P) in the canonical form is min Z = n (1) then the dual problem (D) in the canonical form is max W = m (2)

CSCI 1951-G Optimization Methods in Finance Part 01: Linear Programming

1 Seidel s LP algorithm

Novel update techniques for the revised simplex method (and their application)

min 4x 1 5x 2 + 3x 3 s.t. x 1 + 2x 2 + x 3 = 10 x 1 x 2 6 x 1 + 3x 2 + x 3 14

Linear Programming. Linear Programming I. Lecture 1. Linear Programming. Linear Programming

The simplex algorithm

MVE165/MMG631 Linear and integer optimization with applications Lecture 5 Linear programming duality and sensitivity analysis

Farkas Lemma, Dual Simplex and Sensitivity Analysis

OPTIMISATION 3: NOTES ON THE SIMPLEX ALGORITHM

Section Notes 9. IP: Cutting Planes. Applied Math 121. Week of April 12, 2010

An upper bound for the number of different solutions generated by the primal simplex method with any selection rule of entering variables

4. The Dual Simplex Method

21. Solve the LP given in Exercise 19 using the big-m method discussed in Exercise 20.

Midterm Review. Yinyu Ye Department of Management Science and Engineering Stanford University Stanford, CA 94305, U.S.A.

Simplex Method: More Details

1 Column Generation and the Cutting Stock Problem

AM 205: lecture 19. Last time: Conditions for optimality, Newton s method for optimization Today: survey of optimization methods

Introduction to Mathematical Programming IE406. Lecture 10. Dr. Ted Ralphs

DEPARTMENT OF STATISTICS AND OPERATIONS RESEARCH OPERATIONS RESEARCH DETERMINISTIC QUALIFYING EXAMINATION. Part I: Short Questions

A primal-simplex based Tardos algorithm

Advanced Linear Programming: The Exercises

I.3. LMI DUALITY. Didier HENRION EECI Graduate School on Control Supélec - Spring 2010

Optimization (168) Lecture 7-8-9

Chapter 33 MSMYM1 Mathematical Linear Programming

3. THE SIMPLEX ALGORITHM

Linear Programming: Chapter 5 Duality

CS Algorithms and Complexity

Lecture notes on the ellipsoid algorithm

Appendix PRELIMINARIES 1. THEOREMS OF ALTERNATIVES FOR SYSTEMS OF LINEAR CONSTRAINTS

Dual Basic Solutions. Observation 5.7. Consider LP in standard form with A 2 R m n,rank(a) =m, and dual LP:

7. Lecture notes on the ellipsoid algorithm

OPRE 6201 : 3. Special Cases

DM545 Linear and Integer Programming. Lecture 7 Revised Simplex Method. Marco Chiarandini

Part 1. The Review of Linear Programming

Sensitivity Analysis

Lesson 27 Linear Programming; The Simplex Method

Developing an Algorithm for LP Preamble to Section 3 (Simplex Method)

The use of shadow price is an example of sensitivity analysis. Duality theory can be applied to do other kind of sensitivity analysis:

Standard Form An LP is in standard form when: All variables are non-negativenegative All constraints are equalities Putting an LP formulation into sta

Appendix A Taylor Approximations and Definite Matrices

Optimization WS 13/14:, by Y. Goldstein/K. Reinert, 9. Dezember 2013, 16: Linear programming. Optimization Problems

that nds a basis which is optimal for both the primal and the dual problems, given

Interior Point Methods. We ll discuss linear programming first, followed by three nonlinear problems. Algorithms for Linear Programming Problems

Summary of the simplex method

1 Overview. 2 Extreme Points. AM 221: Advanced Optimization Spring 2016

Notes taken by Graham Taylor. January 22, 2005

Discrete Optimization

4.5 Simplex method. min z = c T x s.v. Ax = b. LP in standard form

- Well-characterized problems, min-max relations, approximate certificates. - LP problems in the standard form, primal and dual linear programs

Chapter 1. Preliminaries

Transcription:

Linear Programming: Simplex Stephen J. Wright 1 2 Computer Sciences Department, University of Wisconsin-Madison. IMA, August 2016 Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 1 / 23

Linear Programming Vector of continuous variables x R n, linear objective, linear constraints. Standard form: min c T x s.t. Ax = b, x 0. We assume that A R m n (with m < n) has full row rank. Any problem with linear objective and linear constraints can be converted to this form by adding / subtracting slacks, splitting variables. Note: All variables are continuous readl numbers! Problems in which some components x i are required to be binary or integer are not covered. These binary linear programs or integer linear programs are much harder and require much different methodology (though simplex is a part of this methodology). Main ref: (Nocedal and Wright, 2006, Chapter 13). Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 2 / 23

Basic Points The feasible set is a polyhedron in R n : a set with flat faces, edges, and vertices. A vertex is a point that doesn t lie on a line between two other feasible points. Vertices are important in linear programming because if the LP has a solution, then at least one of its solutions is a vertex. Thus, in seeking a solution, we can restrict our attention to vertices. But we can t look at all vertices there are too many in general (up to ( n m) ). Each vertex can be represented as a basic point (traditionally known as a basic feasible solution) defined by a square nonsingular column submatrix of A that contains m columns. This matrix is called a basis, denoted by B R m m. After a permutation, partition A into basic and nonbasic columns: [ B N ]. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 3 / 23

Basic Points We can partition x accordingly as [ xb The key is to set x N = 0 and let x B be defined by the linear equalities: x N ]. b = Ax = Bx B + Nx N, x N = 0 x B = B 1 b. In order for this to be a feasible point, we require x B 0. Can t take just any set of m columns of A. A single vertex can be defined by number of different choices of B. These happen when x B has some zero components. Such vertices are called denegerate. (Some pictures here...) Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 4 / 23

Simplex: One Step Simplex moves from one basic point to an adjacent basic point, by sliding along one edge of the feasible polyhedron. The new basic point differs from the current point in that one column is swapped between B and N. We choose the new point to have a lower function value than the current point. How to choose the new point? Substitute for x according to the current (B, N) decomposition: Then transform the LP to x B = B 1 (b Nx N ) = B 1 b B 1 Nx N. min x N c T B B 1 (b B 1 Nx N )+c T N x N s.t. x N 0, x B = B 1 (b Nx N ) 0, which is equivalent to min x N c T B B 1 b+(c T N ct B B 1 N)x N s.t. x N 0 x B = B 1 b B 1 Nx N 0. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 5 / 23

Simplex: One Step Strategy: Choose an index j N such that the j component of c T N ct B B 1 N is negative. Let this component x j increase away from 0. This has the effect of decreasing the objective. BUT it also causes x B to change. We need to stop increasing x j when one of the components of x B hits zero. Precisely, if N (j) denotes the column of N corresponding to x j, we have x B = B 1 b B 1 N (j) x j 0. We set the new value of x j to be the maximum value for which this inequality still holds. Column N (j) enters the basis matrix B. We move the column of B that corresponds to the component of x B that just became zero into N. At the end of this iteration we still have B square and nonsingular, the new x B is nonnegative, and the new x N is all zero. That s one step! Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 6 / 23

A Few Complications What if (c T N ct B B 1 N)? Solution, baby! What if B 1 N (j) 0, so that we can increase x j without limit while maintaining x B 0. Then the LP is unbounded. Trivial example: min x s.t. x 0. What if more than one component of x B reaches zero at the same time? Then just pick one of them to swap with N (j). What if one of the x B components is already zero (degenerate), and we can t increase x j away from zero at all without making it go negative? This is a degenerate pivot. There s no decrease in objective, but swap N (j) with the offending column of B anyway. The next pivot (or the one after...) may yield a decrease in objective. What if we do a string of degenerate pivots, and end up with some basis matrix B that we ve encountered earlier. This is cycling. It can be overcome by applying some rules for choosing N (j) judiciously. (There is usually more than one candidate for N (j).) Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 7 / 23

Details: Maintaining a Factorization of B For LP of practical size, we never want to compute B 1 directly it s too large. Instead we can maintain LU factors of some permuted version of B, say PB P T. Can exploit the fact that B changes in just one column during each step of simplex. Thus the same L factor almost works, but U now has a spike in the location of the replaced column. By applying some permutations and making some small modifications to L, we can restore U to upper triangular form. See (Nocedal and Wright, 2006, Section 13.4). Thus the L factor is stored in factored form. Occasionally, a fresh factorization of B is computed, to avoid possible buildup of error and blowup of storage. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 8 / 23

Choosing N (j) : Pricing Almost any negative component of (c T N ct B B 1 N) will lead to a decrease in objective. Usually there is more than one. How do we choose? This operation is called pricing and it s a critical operation in practical LP implementation. Possible strategies: Choose the most negative element of (c T N ct B B 1 N), as this leads to the biggest decrease in objective per unit increase in x j. Problem: We may not be able to increase x j very much before some component of x B hits zero. Choose the j that yields the steepest decrease per unit distance moved along the edge of the feasible polyhedron (that is, considering the changes in x B components as well as x j ). This steepest-edge strategy was proposed in the 1990s and is quite effective. Choose the component j with the smallest index among the possible options. This is guaranteed to prevent cycling, but is not otherwise the most practical. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 9 / 23

Partial Pricing In any case, it is impractical to maintain and update the full vector (c T N ct B B 1 N) in fact this would be the most expensive operation in simplex calculation. In practice, just a subvector is maintained a subset of the full N. We ignore the rest of the matrix until we have exhausted this subset, i.e. this subvector of c T N ct B B 1 N becomes nonnegative. Then we move to a fresh subset of N. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 10 / 23

Phase I We need to find a starting point: An intial choice of B and N such that B is square and nonsingular and B 1 b 0. How? Answer: Construct a modified (but related) problem for which the initial basis B is easy to identify. Do simplex on this problem until we find a suitable basis for the original problem. Specifically, add m extra variables (say z R m ) and solve: min (x,z) et z s.t. [ ] [ ] x A E = b, z [ ] x 0, z where e = (1, 1,..., 1) T and E is a diagonal matrix with ±1 on the diagonal. Note that we ve discarded the original objective c T x. Now set x = 0 and E ii = sign(b i ), z i = b i for i = 1, 2,..., m. Initial basis is B = E, with N = A. This is a Phase I LP. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 11 / 23

Phase I Now apply simplex from this starting basis to Phase I. Two outcomes: Have objective strictly positive. Then the original problem is infeasible: it s not possible to find an x with Ax = b, x 0. Have objective e T z = 0, so that z = 0. Then proceed to the solution of the real problem by replacing the Phase I objective with the original objective c T x; set upper bounds on z of zero. (We need to modify simplex slightly to handle upper bounds.) This ensures that from here on we solve the original problem, i.e. z stays at zero. Why not simply remove z from the problem at the end of Phase I? Because some of the z components may still be degenerate components of the basis B. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 12 / 23

Duality! We ve come a long way without discussing one of the most intriguing properties in linear programming: DUALITY. Duality is a powerful mathematical theory that s also of great practical importance. It plays a vital role too in other areas of convex optimization. Given the data objects A, b, c that define an LP, we can construct another LP called the dual LP from the same objects: (DUAL) max λ,s b T λ s.t. A T λ + s = c, s 0. Note that λ R m and s R n. The original LP is called the Primal to distinguish it from the dual. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 13 / 23

Weak Duality (D) (P) min c T x s.t. Ax = b, x 0. max λ,s b T λ s.t. A T λ + s = c, s 0. The two problems say a great deal about each other. One simple but useful relationship is weak duality, which says: Proof. If x is feasible for (P) and (λ, s) is feasible for (D), then c T x b T λ. c T x = (A T λ + s) T x = λ T (Ax) + s T x λ T b. Practical application: A feasible point for (D) is sometimes easy to find, and it gives a lower bound on the optimal value for (P). Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 14 / 23

Strong Duality The other key duality result is strong duality and its proof requires a lot more than one line. Theorem Exactly one of these three statements is true: (i) (P) and (D) both have solutions, and their objectives are the same. (ii) One of (P) and (D) is infeasible and the other is unbounded. (iii) Both (P) and (D) are infeasible. It excludes some plausible possibilities. e.g. if we find that (D) is infeasible, it s impossible for (P) to have a solution. If we find that (P) is unbounded, then (D) must be infeasible it can t be unbounded or have a solution. Parts (ii) and (iii) are easy to prove (do it!) but part (i) is hard. The conventional proof argues that the simplex method works, and it identifies solutions to both (P) and (D), with equal objectives. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 15 / 23

KKT Conditions We can use strong duality to derive a set of primal-dual optimality conditions. (These can be generalized to nonlinear programming, as we see later.) These are sometimes called the Karush-Kuhn-Tucker (KKT) conditions, after their inventors in 1948 and 1951. Ax = b, A T λ + s = c, 0 x s 0. where x s indicates that x T s = 0. KKT conditions are just feasibility conditions for (P) and (D), together with x T s = 0. This condition ensures that the duality gap is zero, i.e. no gap between primal and dual objectives. (See weak duality proof.) The KKT conditions are the key to deriving primal-dual interior-point methods, which we ll discuss later. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 16 / 23

Farkas Lemma Strong Duality can be used to prove some powerful results. An important one is the Farkas Lemma, which is critical to optimality theory for constrained optimization. Lemma Given a collection of vectors a i R n, i = 1, 2,..., m and a vector b R n, exactly one of the following claims is true: (1) b is a convex combination of the a i, that is, there exist x i R +, i = 1, 2,..., m such that b = m i=1 x ia i. (2) there is a vector λ R m such that b T λ > 0 and a T i λ 0 for all i = 1, 2,..., m. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 17 / 23

If statement (1) is true, then (P) is feasible and has optimal objective zero. Thus (D) is also feasible with optimal objective zero. Thus (2) cannot be true, since if it were, λ would be a feasible point for (D) with positive objective. If statement (1) is not true, then (P) is infeasible. But (D) is clearly not infeasible, since λ = 0, s = 0 is a feasible point. Thus by strong duality (case (ii)), (D) is feasible and unbounded. Thus (2) is true. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 18 / 23 Farkas Proof Proof. We set up a primal-dual pair of LP given the data. Define A = [a 1 : a 2 :... : a m ], x = (x 1, x 2,..., x m ) T and (P) min x 0 T x s.t. Ax = b, x 0. Note: zero objective vector (c = 0). The corresponding dual is: (D) max λ,s b T λ s.t. A T λ + s = 0, s 0.

Dual Simplex An important variant of the simplex method works with the primal formulation (P), but is based on duality. The idea is to start with an initial basis that is dual feasible i.e. satisfies c T N ct B B 1 N 0, but does not satisfy the constraints of (P), that is, B 1 b 0. Simplex pivots maintain the dual feasiblity property c T N ct B B 1 N 0 and gradually iterate toward satisfying B 1 b 0. Why the term dual feasible? Because this choice of B can be used to construct a feasible point for the dual, defined by: λ = B T c B, s B = 0, s N = c N N T λ = c N N T B T c B 0. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 19 / 23

Dual Simplex Iterations Each step proceeds by: Choose an index i for which the component of x B is negative. Consider the corresponding element of s B. Allow s i to increase away from zero. This changes all components of λ, since λ = B T (c B s i e i ), where e i = (0,..., 0, 1, 0,..., 0) T, with the 1 in the location corresponding to s i. This in turn changes the values of s N = c N N T λ. We increase s i as much as possible away from 0 while maintaining s N 0. We switch the column corresponding to s i out of B and replace it with the column of N that corresponds to the new zero component in s N. We can show that each iteration increases the value of b T λ, thus moves (D) toward better and better points. Keep track of values of x throughout the process. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 20 / 23

Presolving Practical LP codes have presolvers, which use common sense to eliminate some variables and constraints before actually applying simplex or interior-point methods to solve the problem. There are many tricks. Some very simple ones: Row singleton: 3x 10 = 13. Then (obviously), we can set x 10 = 13/3 and substitute it out of the problem, thus eliminating one variable and one constraint. Forcing Constraints: A combination of a constraint and bounds can force variables to the bounds. Example: x 1 + x 3 + x 7 = 3, x 1, x 3, x 7 [0, 1]. Then we must have x 1 = 1, x 3 = 1, x 7 = 1. These variables can be fixed and removed from the problem. Dominated constraints. Given constraints 3x 1 + 2x 5 4, 4x 1 + 3x 5 2, x 1 0, x 5 0, we can remove the constraint 4x 1 + 3x 5 2. Presolving can be applied in rounds. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 21 / 23

Topics Complexity: exponential in worst case. There are examples. Is there a pricing rule that makes it polynomial? Average-case analysis. Rounded analysis. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 22 / 23

References I Ferris, M. C., Mangasarian, O. L., and Wright, S. J. (2007). Linear Programming with Matlab. MOS-SIAM Series in Optimization. SIAM. Nocedal, J. and Wright, S. J. (2006). Numerical Optimization. Springer, New York. Stephen Wright (UW-Madison) Linear Programming: Simplex IMA, August 2016 23 / 23