CSC Design and Analysis of Algorithms. LP Shader Electronics Example

Similar documents
CPS 616 ITERATIVE IMPROVEMENTS 10-1

Math Models of OR: Some Definitions

Systems Analysis in Construction

Lesson 27 Linear Programming; The Simplex Method

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

The simplex algorithm

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

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

The Simplex Method. Lecture 5 Standard and Canonical Forms and Setting up the Tableau. Lecture 5 Slide 1. FOMGT 353 Introduction to Management Science

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

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

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

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

Math Models of OR: Sensitivity Analysis

TIM 206 Lecture 3: The Simplex Method

9.1 Linear Programs in canonical form

Part 1. The Review of Linear Programming

Summary of the simplex method

Optimization (168) Lecture 7-8-9

Chapter 5 Linear Programming (LP)

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

III. Linear Programming

MA 162: Finite Mathematics - Section 3.3/4.1

In Chapters 3 and 4 we introduced linear programming

9.5 THE SIMPLEX METHOD: MIXED CONSTRAINTS

IE 5531: Engineering Optimization I

Simplex tableau CE 377K. April 2, 2015

An example of LP problem: Political Elections

CS Algorithms and Complexity

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

Part III: A Simplex pivot

Today s class. Constrained optimization Linear programming. Prof. Jinbo Bi CSE, UConn. Numerical Methods, Fall 2011 Lecture 12

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

56:171 Operations Research Fall 1998

Chapter 4 The Simplex Algorithm Part I

Chapter 1: Linear Programming

Introduction to Linear and Combinatorial Optimization (ADM I)

6.2: The Simplex Method: Maximization (with problem constraints of the form )

The Simplex Method. Formulate Constrained Maximization or Minimization Problem. Convert to Standard Form. Convert to Canonical Form

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

Math Homework 3: solutions. 1. Consider the region defined by the following constraints: x 1 + x 2 2 x 1 + 2x 2 6

Section 4.1 Solving Systems of Linear Inequalities

Linear Programming Duality

AM 121: Intro to Optimization Models and Methods

MATH 4211/6211 Optimization Linear Programming

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

Lecture 2: The Simplex method

min3x 1 + 4x 2 + 5x 3 2x 1 + 2x 2 + x 3 6 x 1 + 2x 2 + 3x 3 5 x 1, x 2, x 3 0.

(P ) Minimize 4x 1 + 6x 2 + 5x 3 s.t. 2x 1 3x 3 3 3x 2 2x 3 6

Lecture 11: Post-Optimal Analysis. September 23, 2009

Linear Programming: Chapter 5 Duality

4.3 Minimizing & Mixed Constraints

Chapter 7 Network Flow Problems, I

Linear Programming, Lecture 4

Lecture 8 Network Optimization Algorithms

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

Simplex Method for LP (II)

The Simplex Algorithm and Goal Programming

UNIT-4 Chapter6 Linear Programming

maxz = 3x 1 +4x 2 2x 1 +x 2 6 2x 1 +3x 2 9 x 1,x 2

IP Cut Homework from J and B Chapter 9: 14, 15, 16, 23, 24, You wish to solve the IP below with a cutting plane technique.

ECE 307 Techniques for Engineering Decisions

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

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

The Graphical Method & Algebraic Technique for Solving LP s. Métodos Cuantitativos M. En C. Eduardo Bustos Farías 1

Simplex Algorithm Using Canonical Tableaus

Introduction to Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

AM 121: Intro to Optimization

Lectures 6, 7 and part of 8

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

15-780: LinearProgramming

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

AM 121: Intro to Optimization Models and Methods Fall 2018

Special cases of linear programming

MAT016: Optimization

1 Review Session. 1.1 Lecture 2

An introductory example

Lecture 5 Simplex Method. September 2, 2009

The Simplex Algorithm

The Simplex Method of Linear Programming

Slack Variable. Max Z= 3x 1 + 4x 2 + 5X 3. Subject to: X 1 + X 2 + X x 1 + 4x 2 + X X 1 + X 2 + 4X 3 10 X 1 0, X 2 0, X 3 0

Summary of the simplex method

Linear Programming Duality P&S Chapter 3 Last Revised Nov 1, 2004

Review Solutions, Exam 2, Operations Research

IE 400: Principles of Engineering Management. Simplex Method Continued

Network Flows. CTU FEE Department of control engineering. March 28, 2017

Part 1. The Review of Linear Programming

MATH 445/545 Test 1 Spring 2016

Optimization - Examples Sheet 1

Chapter 1 Linear Programming. Paragraph 5 Duality

Linear Programming. Jie Wang. University of Massachusetts Lowell Department of Computer Science. J. Wang (UMass Lowell) Linear Programming 1 / 47

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

2. Linear Programming Problem

Exam 3 Review Math 118 Sections 1 and 2

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

Slide 1 Math 1520, Lecture 10

Linear programming on Cell/BE

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

MATH2070 Optimisation

SELECT TWO PROBLEMS (OF A POSSIBLE FOUR) FROM PART ONE, AND FOUR PROBLEMS (OF A POSSIBLE FIVE) FROM PART TWO. PART ONE: TOTAL GRAND

Transcription:

CSC 80- Design and Analysis of Algorithms Lecture (LP) LP Shader Electronics Example The Shader Electronics Company produces two products:.eclipse, a portable touchscreen digital player; it takes hours of electronic work and hours in the assembly shop; it sells for a profit of $7;.Watch-TV, a wristwatch-size color television; it takes hours in electronics and hour in assembly; it sells for a profit of $. During the current production period, 0 hours of electronic time and 00 hours of assembly time are available. What is the best possible combination of Eclipse and Watch-TV to manufacture for maximum profit?

LP Portfolio Example An investor has $00,000 to invest in the stock market and is considering investments in five stocks with the following current projected rates of return: Tech stocks Cisco (8%), Microsoft (%) and Intel (%) Bank Stocks Bank of America (7%), First Bank (%) Constraints: At most % of the funds in tech stocks must be in Microsoft At least as much in bank stocks as in tech stocks No more than $,000 in stocks with projected returns % or less What is the best possible investment to maximize the total expected annual return? Linear programming (LP) problem is to optimize a linear function of several variables subject to linear constraints: maximize (or minimize) c x +...+ c n x n subject to a i x +...+ a in x n (or or =) b i, i =,...,m x 0,..., x n 0 The function z = c x +...+ c n x n is called the objective function; constraints x 0,..., x n 0 are called nonnegativity constraints

Example maximize x + y subject to x + y x + y x 0, y 0 y 9 8 7 (0,0) 7 8 9 x 7 Geometric solution maximize x + y subject t x + y x + y x 0, y 0 y Optimal solution: x =, y = ( 0, ) (, ) ( 0, 0 ) (, 0 ) level lines x x + y = 0 x + y = x + y = 0 Extreme Point Theorem Any LP problem with a nonempty bounded feasible region has an optimal solution; moreover, an optimal solution can always be found at an extreme point of the problem's feasible region. 9

possible outcomes in solving an LP problem has a finite optimal solution, which may not be unique unbounded: the objective function of maximization (minimization) LP problem is unbounded from above (below) on its feasible region infeasible: there are no points satisfying all the constraints, i.e. the constraints are contradictory 0 The Simplex Method The classic method for solving LP problems; one of the most important algorithms ever invented Invented by George Dantzig in 97 Based on the iterative improvement idea: Generates a sequence of adjacent extreme points of the problem s feasible region with improving values of the objective function until no further improvement is possible ( 0, ) (, ) ( 0, 0 ) (, 0 )

Standard form of LP problem must be a maximization problem all constraints (except the nonnegativity constraints) must be in the form of linear equations all variables must be required to be nonnegative Thus, the general linear programming problem in standard form with m constraints and n unknowns (n m) is maximize c x +...+ c n x n subject to a i x +...+ a in x n = b i, i =,...,m, x 0,..., x n 0 Every LP problem can be represented in such form Example: convert to standard form maximize x + y subject to x + y x + y x 0, y 0

Example maximize x + y maximize x + y + 0u + 0v subject to x + y subject to x + y + u = x + y x + y + v = x 0, y 0 x 0, y 0, u 0, v 0 Variables u and v, transforming inequality constraints into equality constrains, are called slack variables Basic feasible solutions A basic solution to a system of m linear equations in n unknowns (n m) is obtained by setting n m variables to 0 and solving the resulting system to get the values of the other m variables. The variables set to 0 are called nonbasic; the variables obtained by solving the system are called basic. A basic solution is called feasible if all its (basic) variables are nonnegative. Example x + y + u = x + y + v = (0, 0,, ) is basic feasible solution (x, y are nonbasic; u, v are basic) There is a - correspondence between extreme points of LP s feasible region and its basic feasible solutions.

Simplex Tableau maximize z = x + y + 0u + 0v subject to x + y + u = x + y + v = x 0, y 0, u 0, v 0 basic variables u v x y u v 0 0 basic feasible solution (0, 0,, ) - x, y are nonbasic - u, v are basic objective row 0 0 0 Simplex Tableau maximize z = x + y + 0u + 0v subject to x + y + u = x + y + v = x 0, y 0, u 0, v 0 LP Canonical form: the constraints for the basic variables form an identity matrix (after permutations, if necessary) x y u v basic variables u v 0 0 basic feasible solution (0, 0,, ) objective row 0 0 0 value of z at (0, 0,, ) 7 7

Outline of the Simplex Method Step 0 [Initialization] Present a given LP problem in standard form and set up initial tableau. Step [Optimality test] If all entries in the objective row are nonnegative stop: the tableau represents an optimal solution. Step [Find entering variable] Select (the most) negative entry in the objective row. Mark its column to indicate the entering variable and the pivot column. Step [Find departing variable] For each positive entry in the pivot column, calculate the θ-ratio by dividing that row's entry in the rightmost column by its entry in the pivot column. (If there are no positive entries in the pivot column stop: the problem is unbounded.) Find the row with the smallest θ-ratio, mark this row to indicate the departing variable and the pivot row. Step [Form the next canonical tableau] Divide all the entries in the pivot row by its entry in the pivot column. Subtract from each of the other rows, including the objective row, the new pivot row multiplied by the entry in the pivot column of the row in question. Replace the label of the pivot row by the variable's name of the pivot column and go back to Step. 8 Simplex Method: Entering and Departing Variables maximize z = x + y + 0u + 0v subject to x + y + u = x + y + v = x 0, y 0, u 0, v 0 x y u v u v 0 0 0 0 0 basic feasible sol. (0, 0,, ) z = 0 9 8

Simplex Method: Pivoting maximize z = x + y + 0u + 0v subject to x + y + u = x + y + v = x 0, y 0, u 0, v 0 x y u v u 0 v 0 0 0 0 pivot basic feasible sol. (0, 0,, ) z = 0 0 Simplex Method: Next Iteration maximize z = x + y + 0u + 0v subject to x + y + u = x + y + v = x 0, y 0, u 0, v 0 x y u v u 0 y 0 0 0 0 basic feasible sol. (0,,, 0) z = 0 9

Example of Simplex Method Application maximize z = x + y + 0u + 0v subject to x + y + u = x + y + v = x 0, y 0, u 0, v 0 x y u v x y u v x y u v u 0 u 0 x 0 / / / v 0 y 0 y 0 / / pivot 0 0 0 0 0 0 0 0 basic feasible sol. (0, 0,, ) basic feasible sol. (0,,, 0) basic feasible sol. (,, 0, 0) z = 0 z = 0 z = Notes on the Simplex Method Finding an initial basic feasible solution is nontrivial Theoretical possibility of cycling Typical number of iterations is between m and m, where m is the number of equality constraints in the standard form Worse-case efficiency is exponential More recent interior-point algorithms such as Karmarkar s algorithm (98) have polynomial worst-case efficiency 0

The Maximum Flow Problem Flow Network Source Sink Given a network of pipes and a source and a sink, how much water can flow from the source to the sink? - the pipes have upper flow limits

The Maximum Flow Problem The problem of maximizing the flow of a material through a transportation network (e.g., pipeline system, communications or transportation networks). Formally, represented by a connected weighted digraph with n vertices numbered from to n with the following properties: contains exactly one vertex with no entering edges, called the source (numbered ) contains exactly one vertex with no leaving edges, called the sink (numbered n) has positive integer weight u ij on each directed edge (i.j), called the edge capacity, indicating the upper bound on the amount of the material that can be sent from i to j through a link represented by this edge Flow Network Source u = u = u = u = u = u = u = Sink 7

Definition of a Flow A flow is an assignment of real numbers x ij to edges (i,j) of a given network that satisfy the following: flow-conservation requirements The total amount of material entering an intermediate vertex must be equal to the total amount of the material leaving the vertex capacity constraints x ji = x ij for i =,,, n- j: (j,i) є E i: (i,j) є E 0 x ij u ij for every edge (i,j) E 8 Flow Example u = x = Source u = u = x = x = u = x = u = x = u = x = 0 u = x = 0 Sink 9

Flow value and Maximum Flow Problem Since no material can be lost or added to by going through intermediate vertices of the network, the total amount of the material leaving the source must end up at the sink: x j = x jn j: (,j) є E j: (j,n) є E The value of the flow is defined as the total outflow from the source (= the total inflow in the sink). The maximum flow problem is to find a flow of the largest value (maximum flow) for a given network. 0 Maximum-Flow Problem as a LP problem Maximize v = x j j: (,j) E subject to x ji - x ij = 0 for i =,,,n- j: (j,i) E j: (i,j) E 0 x ij u ij for every edge (i,j) E

Maximum-Flow Solution / / / / / x ij /u ij 0/ 0/ Flow value = Faster Algorithm: Ford-Fulkerson Ford-Fulkerson s Method Start with the zero flow (x ij =0 for every edge) On each iteration, try to find a flow-augmenting path from source to sink, which is a path along which some additional flow can be sent If a flow-augmenting path is found, adjust the flow along the edges of this path to get a flow of increased value and try again If no flow-augmenting path is found, the current flow is optimal

Example 0/ 0/ 0/ 0/ 0/ 0/ 0/ x ij /u ij Augmenting path: Example 0/ 0/ / / / 0/ 0/ x ij /u ij Augmenting path:

0/ 0/ / / / 0/ 0/ Augmenting path: / / / / / / / Flow value = 7 7

Finding a flow-augmenting path To find a flow-augmenting path for a flow x, we need to consider paths from source to sink in the underlying undirected graph in which any two consecutive vertices i,j are either: connected by a directed edge (i to j) with some positive unused capacity r ij = u ij x ij known as forward edge ( ) OR connected by a directed edge (j to i) with some positive flow x ji known as backward edge ( ) If a flow-augmenting path is found, the current flow can be increased by r units by increasing x ij by r on each forward edge and decreasing x ji by r on each backward edge, where r = min {r ij on all forward edges, x ji on all backward edges} 8 Cont Assuming the edge capacities are integers, r is a positive integer. On each iteration, the flow value increases by at least one. Maximum value is bounded by the sum of the capacities of the edges leaving the source so the augmenting-path method has to stop after a finite number of iterations. The final flow is always maximal, it does not depend on the sequence of augmenting paths. Issue: how to find an augmenting path? 9 8

Homework Exercises.: 8 Exercises 0.:, Exercises 0.: a,,, 0 Read subsection on linear programming in Sec.. Read Sec. 0., 0. 0 9