Lecture slides by Kevin Wayne

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

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

LINEAR PROGRAMMING II

! Fast commercial solvers: CPLEX, OSL. ! Powerful modeling languages: AMPL, GAMS. ! Ranked among most important scientific advances of 20 th century.

Algorithms and Theory of Computation. Lecture 13: Linear Programming (2)

Part 1. The Review of Linear Programming

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

Class Meeting #20 COS 226 Spring 2018

ORF 522. Linear Programming and Convex Analysis

Linear Programming. Linear Programming. Brewery Problem: A Toy LP Example. Applications

TIM 206 Lecture 3: The Simplex Method

Optimization (168) Lecture 7-8-9

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

3 The Simplex Method. 3.1 Basic Solutions

1 Review Session. 1.1 Lecture 2

Simplex Algorithm Using Canonical Tableaus

February 17, Simplex Method Continued

Dr. Maddah ENMG 500 Engineering Management I 10/21/07

LINEAR PROGRAMMING III

The simplex algorithm

LP. Lecture 3. Chapter 3: degeneracy. degeneracy example cycling the lexicographic method other pivot rules the fundamental theorem of LP

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

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

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Simplex method(s) for solving LPs in standard form

Notes taken by Graham Taylor. January 22, 2005

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

CSC373: Algorithm Design, Analysis and Complexity Fall 2017 DENIS PANKRATOV NOVEMBER 1, 2017

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

IE 400: Principles of Engineering Management. Simplex Method Continued

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

OPERATIONS RESEARCH. Linear Programming Problem

Chap6 Duality Theory and Sensitivity Analysis

CS Algorithms and Complexity

III. Linear Programming

Lecture: Algorithms for LP, SOCP and SDP

Math 273a: Optimization The Simplex method

CO350 Linear Programming Chapter 8: Degeneracy and Finite Termination

Supplementary lecture notes on linear programming. We will present an algorithm to solve linear programs of the form. maximize.

Chapter 3, Operations Research (OR)

IE 5531: Engineering Optimization I

Linear and Integer Programming - ideas

Contents. 4.5 The(Primal)SimplexMethod NumericalExamplesoftheSimplexMethod

3. THE SIMPLEX ALGORITHM

The Simplex Method. Standard form (max) z c T x = 0 such that Ax = b.

15-780: LinearProgramming

MATH 445/545 Homework 2: Due March 3rd, 2016

The Simplex Method for Solving a Linear Program Prof. Stephen Graves

Example. 1 Rows 1,..., m of the simplex tableau remain lexicographically positive

Linear programs Optimization Geoff Gordon Ryan Tibshirani

3 Development of the Simplex Method Constructing Basic Solution Optimality Conditions The Simplex Method...

ECE 307 Techniques for Engineering Decisions

Gauss-Jordan Elimination for Solving Linear Equations Example: 1. Solve the following equations: (3)

AM 121: Intro to Optimization Models and Methods Fall 2018

The Avis-Kalunzy Algorithm is designed to find a basic feasible solution (BFS) of a given set of constraints. Its input: A R m n and b R m such that

MATH 4211/6211 Optimization Linear Programming

6. Linear Programming

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

MATH2070 Optimisation

AM 121: Intro to Optimization

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

Chapter 4 The Simplex Algorithm Part I

Discrete Optimization. Guyslain Naves

Simplex Method for LP (II)

1 The linear algebra of linear programs (March 15 and 22, 2015)

Algorithms. Linear Programming. brewer s problem simplex algorithm implementations duality modeling

The augmented form of this LP is the following linear system of equations:

CO 602/CM 740: Fundamentals of Optimization Problem Set 4

Linear Programming: Simplex

Chapter 5 Linear Programming (LP)

Lecture 2: The Simplex method

Prelude to the Simplex Algorithm. The Algebraic Approach The search for extreme point solutions.

Overview of course. Introduction to Optimization, DIKU Monday 12 November David Pisinger

Lecture 4: Algebra, Geometry, and Complexity of the Simplex Method. Reading: Sections 2.6.4, 3.5,

Lectures 6, 7 and part of 8

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

Systems Analysis in Construction

Introduction to optimization

Sensitivity Analysis and Duality in LP

CO350 Linear Programming Chapter 8: Degeneracy and Finite Termination

The Primal-Dual Algorithm P&S Chapter 5 Last Revised October 30, 2006

Lesson 27 Linear Programming; The Simplex Method

Summary of the simplex method

Linear Programming Redux

In Chapters 3 and 4 we introduced linear programming

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

Example Bases and Basic Feasible Solutions 63 Let q = >: ; > and M = >: ;2 > and consider the LCP (q M). The class of ; ;2 complementary cones

3. Linear Programming and Polyhedral Combinatorics

Linear Programming, Lecture 4

February 22, Introduction to the Simplex Algorithm

3. Vector spaces 3.1 Linear dependence and independence 3.2 Basis and dimension. 5. Extreme points and basic feasible solutions

Lecture 10: Linear programming duality and sensitivity 0-0

The Simplex Algorithm

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

::::: OFTECHY. .0D 0 ::: ::_ I;. :.!:: t;0i f::t l. :- - :.. :?:: : ;. :--- :-.-i. .. r : : a o er -,:I :,--:-':: : :.:

The Simplex Algorithm and Goal Programming

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

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

A primal-simplex based Tardos algorithm

THE UNIVERSITY OF HONG KONG DEPARTMENT OF MATHEMATICS. Operations Research I

Transcription:

LINEAR PROGRAMMING I a refreshing example standard form fundamental questions geometry linear algebra simplex algorithm Lecture slides by Kevin Wayne Last updated on 7/25/17 11:09 AM

Linear programming Linear programming. Optimize a linear function subject to linear inequalities. (P) max c j x j n j=1 n s. t. a ij x j = b i 1 i m j=1 x j 0 1 j n (P) max c T x s. t. Ax = b x 0 2

Linear programming Linear programming. Optimize a linear function subject to linear inequalities. Generalizes: Ax = b, 2-person zero-sum games, shortest path, max flow, assignment problem, matching, multicommodity flow, MST, min weighted arborescence, Why significant? Design poly-time algorithms. Design approximation algorithms. Solve NP-hard problems using branch-and-cut. Ranked among most important scientific advances of 20th century. 3

LINEAR PROGRAMMING I a refreshing example standard form fundamental questions geometry linear algebra simplex algorithm Reference: The Allocation of Resources by Linear Programming, Scientific American, by Bob Bland

Brewery problem Small brewery produces ale and beer. Production limited by scarce resources: corn, hops, barley malt. Recipes for ale and beer require different proportions of resources. Beverage Corn (pounds) Hops (ounces) Malt (pounds) Profit () Ale (barrel) 5 4 35 Beer (barrel) 15 4 20 13 23 constraint 480 160 1190 How can brewer maximize profits? Devote all resources to ale: 34 barrels of ale 442 Devote all resources to beer: 32 barrels of beer 736 7.5 barrels of ale, 29.5 barrels of beer 776 12 barrels of ale, 28 barrels of beer 800 5

Brewery problem objective function Ale Beer max 13A + 23B s. t. 5A + 15B 480 4A + 4B 160 35A + 20B 1190 A, B 0 Profit Corn Hops Malt constraint decision variable 6

Reference 7

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

Standard form of a linear program Standard form of an LP. Input: real numbers a ij, c j, b i. Output: real numbers x j. n = # decision variables, m = # constraints. Maximize linear objective function subject to linear inequalities. (P) max c j x j n j=1 n s. t. a ij x j = b i 1 i m j=1 x j 0 1 j n (P) max c T x s. t. Ax = b x 0 Linear. No x 2, x y, arccos(x), etc. Programming. Planning (term predates computer programming). 9

Brewery problem: converting to standard form Original input. max 13A + 23B s. t. 5A + 15B 480 4A + 4B 160 35A + 20B 1190 A, B 0 Standard form. Add slack variable for each inequality. Now a 5-dimensional problem. max 13A + 23B s. t. 5A + 15B + S C = 480 4A + 4B + S H = 160 35A + 20B + S M = 1190 A, B, S C, S H, S M 0 10

Equivalent forms Easy to convert variants to standard form. (P) max c T x s. t. Ax = b x 0 Less than to equality. x + 2y 3z 17 x + 2y 3z + s = 17, s 0 Greater than to equality. x + 2y 3z 17 x + 2y 3z s = 17, s 0 Min to max. min x + 2y 3z max x 2y + 3z Unrestricted to nonnegative. x unrestricted x = x + x, x + 0, x 0 11

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

Fundamental questions LP. For A R m n, b R m, c R n, α R, does there exist x R n such that: Ax = b, x 0, c T x α? Q. Is LP in NP? Q. Is LP in co-np? Q. Is LP in P? Q. Is LP in P R? Blum Shub Smale model Input size. n = number of variables. m = number of constraints. L = number of bits to encode input. 13

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

Brewery problem: feasible region Hops 4A + 4B 160 Malt 35A + 20B 1190 (0, 32) (12, 28) (26, 14) Corn 5A + 15B 480 Beer (0, 0) Ale (34, 0) 15

Brewery problem: objective function Profit (0, 32) (12, 28) 13A + 23B = 1600 (26, 14) Beer 13A + 23B = 800 (0, 0) Ale (34, 0) 13A + 23B = 442 16

Brewery problem: geometry Brewery problem observation. Regardless of objective function coefficients, an optimal solution occurs at a vertex. (0, 32) (12, 28) (26, 14) vertex Beer (0, 0) Ale (34, 0) 17

Convexity Convex set. If two points x and y are in the set, then so is λ x + (1 λ) y for 0 λ 1. convex combination not a vertex iff d 0 s.t. x ± d in set Vertex. A point x in the set that can t be written as a strict convex combination of two distinct points in the set. vertex x y convex not convex Observation. LP feasible region is a convex set. 18

Purificaiton Theorem. If there exists an optimal solution to (P), then there exists one that is a vertex. (P) max c T x s. t. Ax = b x 0 Intuition. If x is not a vertex, move in a non-decreasing direction until you reach a boundary. Repeat. xʹ = x + α * d x + d x x - d 19

Purificaiton Theorem. If there exists an optimal solution to (P), then there exists one that is a vertex. Pf. Suppose x is an optimal solution that is not a vertex. There exist direction d 0 such that x ± d P. A d = 0 because A(x ± d) = b. Assume c T d 0 (by taking either d or d). Consider x + λ d, λ > 0 : Case 1. [ there exists j such that d j < 0 ] Increase λ to λ * until first new component of x + λ d hits 0. x + λ * d is feasible since A(x + λ * d) = Ax = b and x + λ * y 0. x + λ * d has one more zero component than x. c T xʹ = c T (x + λ * d) = c T x + λ * c T d c T x. d k = 0 whenever x k = 0 because x ± d P 20

Purificaiton Theorem. If there exists an optimal solution to (P), then there exists one that is a vertex. Pf. Suppose x is an optimal solution that is not a vertex. There exist direction d 0 such that x ± d P. A d = 0 because A(x ± d) = b. Assume c T d 0 (by taking either d or d). Consider x + λ d, λ > 0 : Case 2. [d j 0 for all j ] x + λd is feasible for all λ 0 since A(x + λd) = b and x + λd x 0. As λ, c T (x + λd) because c T d < 0. if c T d = 0, choose d so that case 1 applies 21

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

Intuition Intuition. A vertex in R m is uniquely specified by m linearly independent equations. 4A + 4B 160 35A + 20B 1190 (26, 14) 4A + 4B = 160 35A + 20B = 1190 23

Basic feasible solution Theorem. Let P = { x : Ax = b, x 0 }. For x P, define B = { j : x j > 0 }. Then, x is a vertex iff A B has linearly independent columns. Notation. Let B = set of column indices. Define A B to be the subset of columns of A indexed by B. Ex. A = " 2 1 3 0% 7 3 2 1 # 0 0 0 5&, b = " 7 % 16 # 0 & x = " 2 % 0 1 # 0 &, B = {1, 3}, A B = " 2 3% 7 2 # 0 0& 24

Basic feasible solution Theorem. Let P = { x : Ax = b, x 0 }. For x P, define B = { j : x j > 0 }. Then, x is a vertex iff A B has linearly independent columns. Pf. Assume x is not a vertex. There exist direction d 0 such that x ± d P. A d = 0 because A(x ± d) = b. Define Bʹ = { j : d j 0 }. A Bʹ has linearly dependent columns since d 0. Moreover, d j = 0 whenever x j = 0 because x ± d 0. Thus Bʹ B, so A Bʹ is a submatrix of A B. Therefore, A B has linearly dependent columns. 25

Basic feasible solution Theorem. Let P = { x : Ax = b, x 0 }. For x P, define B = { j : x j > 0 }. Then, x is a vertex iff A B has linearly independent columns. Pf. Assume A B has linearly dependent columns. There exist d 0 such that A B d = 0. Extend d to R n by adding 0 components. Now, A d = 0 and d j = 0 whenever x j = 0. For sufficiently small λ, x ± λ d P x is not a vertex. 26

Basic feasible solution Theorem. Given P = { x : Ax = b, x 0 }, x is a vertex iff there exists B { 1,, n } such B = m and: A B is nonsingular. x B = A B -1 b 0. x N = 0. basic feasible solution Pf. Augment A B with linearly independent columns (if needed). x = " # 2 0 1 0 " 2 1 3 0% " 7 % A = 7 3 2 1, b = 16 # 0 0 0 5& # 0 & % " 2 3 0, B = { 1, 3, 4 }, A B = 7 2 1 # 0 0 5 & % & Assumption. A R m n has full row rank. 27

Basic feasible solution: example Basic feasible solutions. {B, S H, S M } (0, 32) Basis {A, B, S M } (12, 28) Infeasible {A, B, S H } (19.41, 25.53) max 13A + 23B s. t. 5A + 15B + S C = 480 4A + 4B + S H = 160 35A + 20B + S M = 1190 A, B, S C, S H, S M 0 Beer {A, B, S C } (26, 14) {S H, S M, S C } (0, 0) Ale {A, S H, S C } (34, 0) 28

Fundamental questions LP. For A R m n, b R m, c R n, α R, does there exist x R n such that: Ax = b, x 0, c T x α? Q. Is LP in NP? A. Yes. Number of vertices ( ) nm. C(n, m) = n m Cramer s rule can check a vertex in poly-time. Cramer s rule. For B R n n invertible, b R n, the solution to Bx = b is given by: x i = det(b i ) det(b) replace ith column of B with b 29

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

Simplex algorithm: intuition Simplex algorithm. [George Dantzig 1947] Move from BFS to adjacent BFS, without decreasing objective function. replace one basic variable with another edge Greedy property. BFS optimal iff no adjacent BFS is better. Challenge. Number of BFS can be exponential! 31

Simplex algorithm: initialization max Z subject to 13A + 23B Z = 0 5A + 15B + S C = 480 4A + 4B + S H = 160 35A + 20B + S M = 1190 A, B, S C, S H, S M 0 Basis = {S C, S H, S M } A = B = 0 Z = 0 S C = 480 S H = 160 S M = 1190 32

Simplex algorithm: pivot 1 max Z subject to 13A + 23B Z = 0 5A + 15B + S C = 480 4A + 4B + S H = 160 35A + 20B + S M = 1190 A, B, S C, S H, S M 0 Basis = {S C, S H, S M } A = B = 0 Z = 0 S C = 480 S H = 160 S M = 1190 Substitute: B = 1/15 (480 5A S C ) max Z subject to 16 3 A 15 23 S C Z = 736 1 A + B + 1 S 3 15 C = 32 8 3 A 4 15 S C + S H = 32 85 3 A 4 3 S C + S M = 550 A, B, S C, S H, S M 0 Basis = {B, S H, S M } A = S C = 0 Z = 736 B = 32 S H = 32 S M = 550 33

Simplex algorithm: pivot 1 max Z subject to 13A + 23B Z = 0 5A + 15B + S C = 480 4A + 4B + S H = 160 35A + 20B + S M = 1190 A, B, S C, S H, S M 0 Basis = {S C, S H, S M } A = B = 0 Z = 0 S C = 480 S H = 160 S M = 1190 Q. Why pivot on column 2 (or 1)? A. Each unit increase in B increases objective value by 23. Q. Why pivot on row 2? A. Preserves feasibility by ensuring RHS 0. min ratio rule: min { 480/15, 160/4, 1190/20 } 34

Simplex algorithm: pivot 2 max Z subject to 16 3 A 15 23 S C Z = 736 1 A + B + 1 S 3 15 C = 32 8 3 A 4 15 S C + S H = 32 85 3 A 4 3 S C + S M = 550 A, B, S C, S H, S M 0 Basis = {B, S H, S M } A = S C = 0 Z = 736 B = 32 S H = 32 S M = 550 Substitute: A = 3/8 (32 + 4/15 S C S H ) max Z subject to S C 2 S H Z = 800 B + 1 10 S C + 1 8 S H = 28 A 1 10 C + 3 8 S H = 12 25 6 C 85 8 S H + S M = 110 A, B, S C, S H, S M 0 Basis = {A, B, S M } S C = S H = 0 Z = 800 B = 28 A = 12 S M = 110 35

Simplex algorithm: optimality Q. When to stop pivoting? A. When all coefficients in top row are nonpositive. Q. Why is resulting solution optimal? A. Any feasible solution satisfies system of equations in tableaux. In particular: Z = 800 S C 2 S H, S C 0, S H 0. Thus, optimal objective value Z* 800. Current BFS has value 800 optimal. max Z subject to S C 2 S H Z = 800 B + 1 10 S C + 1 8 S H = 28 A 1 10 C + 3 8 S H = 12 25 6 C 85 8 S H + S M = 110 A, B, S C, S H, S M 0 Basis = {A, B, S M } S C = S H = 0 Z = 800 B = 28 A = 12 S M = 110 36

Simplex tableaux: matrix form Initial simplex tableaux. c B T x B + c N T x N = Z A B x B + A N x N = b x B, x N 0 Simplex tableaux corresponding to basis B. (c N T c B T A B 1 A N ) x N = Z c B T A B 1 b I x B + A 1 B A N x N = A 1 B b x B, x N 0 subtract c B T A B -1 times constraints multiply by A B -1 x B = A B -1 b 0 x N = 0 basic feasible solution c N T c B T A B -1 A N 0 optimal basis 37

Simplex algorithm: corner cases Simplex algorithm. Missing details for corner cases. Q. What if min ratio test fails? Q. How to find initial basis? Q. How to guarantee termination? 38

Unboundedness Q. What happens if min ratio test fails? all coefficients in entering column are nonpositive max Z subject to + 2x 4 + 20x 5 Z = 2 x 1 4x 4 8x 5 = 3 x 2 + 5x 4 12x 5 = 4 x 3 = 5 x 1, x 2, x 3, x 4, x 5 0 A. Unbounded objective function. Z = 2 + 20x 5 " # x 1 x 2 x 3 x 4 x 5 % & = " # 3 + 8x 5 4 + 12x 5 5 0 0 % & 39

Phase I simplex method Q. How to find initial basis? (P) max c T x s. t. Ax = b x 0 A. Solve (P ), starting from basis consisting of all the z i variables. m ( P ") max z i i=1 s. t. A x + I z = b x, z 0 Case 1: min > 0 (P) is infeasible. Case 2: min = 0, basis has no z i variables okay to start Phase II. Case 3a: min = 0, basis has z i variables. Pivot z i variables out of basis. If successful, start Phase II; else remove linear dependent rows. 40

Simplex algorithm: degeneracy Degeneracy. New basis, same vertex. Degenerate pivot. Min ratio = 0. max Z subject to 3 x 4 4 20x 5 + 1 x 2 6 6x 7 Z = 0 x 1 + 1 x 4 4 8x 5 x 6 + 9x 7 = 0 x 2 + 1 2 x 4 12x 5 1 2 x 6 + 3x 7 = 0 x 3 + x 6 = 1 x 1, x 2, x 3, x 4, x 5, x 6, x 7 0 41

Simplex algorithm: degeneracy Degeneracy. New basis, same vertex. Cycling. Infinite loop by cycling through different bases that all correspond to same vertex. Anti-cycling rules. Bland s rule: choose eligible variable with smallest index. Random rule: choose eligible variable uniformly at random. Lexicographic rule: perturb constraints so nondegenerate. 42

Lexicographic rule Intuition. No degeneracy no cycling. Perturbed problem. much much greater, say ε i = δ i for small δ ( P ") max c T x s. t. Ax = b + ε x 0 where ε = # ε 1 % % ε 2 %! % ε n & ( ( ( (, such that ε 1 ε 2 # ε n Lexicographic rule. Apply perturbation virtually by manipulating ε symbolically: 17 + 5ε 1 + 11ε 2 + 8ε 3 17 + 5ε 1 + 14ε 2 + 3ε 3 43

Lexicographic rule Intuition. No degeneracy no cycling. Perturbed problem. much much greater, say ε i = δ i for small δ ( P ") max c T x s. t. Ax = b + ε x 0 where ε = # ε 1 % % ε 2 %! % ε n & ( ( ( (, such that ε 1 ε 2 # ε n Claim. In perturbed problem, x B = A B -1 (b + ε) is always nonzero. Pf. The j th component of x B is a (nonzero) linear combination of the components of b + ε contains at least one of the ε i terms. Corollary. No cycling. which can t cancel 44

Simplex algorithm: practice Remarkable property. In practice, simplex algorithm typically terminates after at most 2(m + n) pivots. but no polynomial pivot rule known Issues. Avoid stalling. Choose the pivot. Maintain sparsity. Ensure numerical stability. Preprocess to eliminate variables and constraints. Commercial solvers can solve LPs with millions of variables and tens of thousands of constraints. 45