csc373 week 7: linear programming

69
CSC373 Week 7: Linear Programming 373F21 - Nisarg Shah 1 Illustration Courtesy: Kevin Wayne & Denis Pankratov

Upload: others

Post on 27-Mar-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

CSC373

Week 7: Linear Programming

373F21 - Nisarg Shah 1

Illustration Courtesy: Kevin Wayne & Denis Pankratov

Recap

373F21 - Nisarg Shah 2

โ€ข Network flow

โžข Ford-Fulkerson algorithm

o Ways to make the running time polynomial

โžข Correctness using max-flow, min-cut

โžข Applications:

o Edge-disjoint paths

o Multiple sources/sinks

o Circulation

o Circulation with lower bounds

o Survey design

o Image segmentation

o Profit maximization

Brewery Example

373F21 - Nisarg Shah 3

โ€ข A brewery can invest its inventory of corn, hops and malt into producing some amount of ale and some amount of beerโžข Per unit resource requirement and profit of the two items are as

given below

Example Courtesy: Kevin Wayne

Brewery Example

373F21 - Nisarg Shah 4

โ€ข Suppose it produces ๐ดunits of ale and ๐ต units of beer

โ€ข Then we want to solve this program:

Linear Function

373F21 - Nisarg Shah 5

โ€ข ๐‘“:โ„๐‘› โ†’ โ„ is a linear function if ๐‘“ ๐‘ฅ = ๐‘Ž๐‘‡๐‘ฅ for some ๐‘Ž โˆˆ โ„๐‘›

โžข Example: ๐‘“ ๐‘ฅ1, ๐‘ฅ2 = 3๐‘ฅ1 โˆ’ 5๐‘ฅ2 =3โˆ’5

๐‘‡ ๐‘ฅ1๐‘ฅ2

โ€ข Linear objective: ๐‘“

โ€ข Linear constraints:โžข ๐‘” ๐‘ฅ = ๐‘, where ๐‘”:โ„๐‘› โ†’ โ„ is a linear function and ๐‘ โˆˆ โ„

โžข Line in the plane (or a hyperplane in โ„๐‘›)

โžข Example: 5๐‘ฅ1 + 7๐‘ฅ2 = 10

Linear Function

373F21 - Nisarg Shah 6

โ€ข Geometrically, ๐‘Ž is the normal vector of the line(or hyperplane) represented by ๐‘Ž๐‘‡๐‘ฅ = ๐‘

Linear Inequality

373F21 - Nisarg Shah 7

โ€ข ๐‘Ž๐‘‡๐‘ฅ โ‰ค ๐‘ represents a โ€œhalf-spaceโ€

Linear Programming

373F21 - Nisarg Shah 8

โ€ข Maximize/minimize a linear function subject to linear equality/inequality constraints

Geometricallyโ€ฆ

373F21 - Nisarg Shah 9

Back to Brewery Example

373F21 - Nisarg Shah 10

Back to Brewery Example

373F21 - Nisarg Shah 11

โ€ข Claim: Regardless of the objective function, there must be a vertex that is an optimal solution

Optimal Solution At A Vertex

373F21 - Nisarg Shah 12

Convexity

373F21 - Nisarg Shah 13

โ€ข Convex set: ๐‘† is convex if ๐‘ฅ, ๐‘ฆ โˆˆ ๐‘†, ๐œ† โˆˆ [0,1] โ‡’ ๐œ†๐‘ฅ + 1 โˆ’ ๐œ† ๐‘ฆ โˆˆ ๐‘†

โ€ข Vertex: A point which cannot be written as a strict convex combination of any two points in the set

โ€ข Observation: Feasible region of an LP is a convex set

Optimal Solution At A Vertex

373F21 - Nisarg Shah 14

โ€ข Intuitive proof of the claim:โžข Start at some point ๐‘ฅ in the feasible region

โžข If ๐‘ฅ is not a vertex:

o Find a direction ๐‘‘ such that points within a positive distance of ๐œ– from ๐‘ฅ in both ๐‘‘ and โˆ’๐‘‘ directions are within the feasible region

o Objective must not decrease in at least one of the two directions

o Follow that direction until you reach a new point ๐‘ฅ for which at least one more constraint is โ€œtightโ€

โžข Repeat until we are at a vertex

LP, Standard Formulation

373F21 - Nisarg Shah 15

โ€ข Input: ๐‘, ๐‘Ž1, ๐‘Ž2, โ€ฆ , ๐‘Ž๐‘š โˆˆ โ„๐‘›, ๐‘ โˆˆ โ„๐‘š

โžข There are ๐‘› variables and ๐‘š constraints

โ€ข Goal:

LP, Standard Matrix Form

373F21 - Nisarg Shah 16

โ€ข Input: ๐‘, ๐‘Ž1, ๐‘Ž2, โ€ฆ , ๐‘Ž๐‘š โˆˆ โ„๐‘›, ๐‘ โˆˆ โ„๐‘š

โžข There are ๐‘› variables and ๐‘š constraints

โ€ข Goal:

Convert to Standard Form

373F21 - Nisarg Shah 17

โ€ข What if the LP is not in standard form?

โžข Constraints that use โ‰ฅo ๐‘Ž๐‘‡๐‘ฅ โ‰ฅ ๐‘ โ‡” โˆ’๐‘Ž๐‘‡๐‘ฅ โ‰ค โˆ’๐‘

โžข Constraints that use equality

o ๐‘Ž๐‘‡๐‘ฅ = ๐‘ โ‡” ๐‘Ž๐‘‡๐‘ฅ โ‰ค ๐‘, ๐‘Ž๐‘‡๐‘ฅ โ‰ฅ ๐‘

โžข Objective function is a minimization

o Minimize ๐‘๐‘‡๐‘ฅ โ‡” Maximize โˆ’๐‘๐‘‡๐‘ฅ

โžข Variable is unconstrained

o ๐‘ฅ with no constraint โ‡” Replace ๐‘ฅ by two variables ๐‘ฅโ€ฒand ๐‘ฅโ€ฒโ€ฒ, replace every occurrence of ๐‘ฅ with ๐‘ฅโ€ฒ โˆ’ ๐‘ฅโ€ฒโ€ฒ, and add constraints ๐‘ฅโ€ฒ โ‰ฅ 0, ๐‘ฅโ€ฒโ€ฒ โ‰ฅ 0

LP Transformation Example

373F21 - Nisarg Shah 18

Optimal Solution

373F21 - Nisarg Shah 19

โ€ข Does an LP always have an optimal solution?

โ€ข No! The LP can โ€œfailโ€ for two reasons:

1. It is infeasible, i.e., ๐‘ฅ ๐ด๐‘ฅ โ‰ค ๐‘} = โˆ…o E.g., the set of constraints is ๐‘ฅ1 โ‰ค 1,โˆ’๐‘ฅ1โ‰ค โˆ’2

2. It is unbounded, i.e., the objective function can be made arbitrarily large (for maximization) or small (for minimization)o E.g., โ€œmaximize ๐‘ฅ1 subject to ๐‘ฅ1 โ‰ฅ 0โ€

โ€ข But if the LP has an optimal solution, we know that there must be a vertex which is optimal

Simplex Algorithm

373F21 - Nisarg Shah 20

โ€ข Simple algorithm, easy to specify geometrically

โ€ข Worst-case running time is exponential

โ€ข Excellent performance in practice

Simplex: Geometric View

373F21 - Nisarg Shah 21

Algorithmic Implementation

373F21 - Nisarg Shah 22

Start at a vertex of feasible

polytope

Move to a neighbor vertex

with better objective value

Terminate, declare the current

solution and value as optimal

Is there a neighbor vertex

with better objective value?

How Do We Implement This?

373F21 - Nisarg Shah 23

โ€ข Weโ€™ll work with the slack form of LPโžข Convenient for implementing simplex operations

โžข We want to maximize ๐‘ง in the slack form, but for now, forget about the maximization objective

Slack Form

373F21 - Nisarg Shah 24

Slack Form

373F21 - Nisarg Shah 25

Simplex: Step 1

373F21 - Nisarg Shah 26

โ€ข Start at a feasible vertexโžข How do we find a feasible vertex?

โžข For now, assume ๐‘ โ‰ฅ 0 (that is, each ๐‘๐‘– โ‰ฅ 0)o In this case, ๐‘ฅ = 0 is a feasible vertex.

o In the slack form, this means setting the nonbasic variables to 0

โžข Weโ€™ll later see what to do in the general case

Simple: Step 2

373F21 - Nisarg Shah 27

โ€ข What next? Letโ€™s look at an example

โ€ข To increase the value of ๐‘ง:โžข Find a nonbasic variable with a positive coefficient

o This is called an entering variable

โžข See how much you can increase its value without violating any constraints

Simple: Step 2

373F21 - Nisarg Shah 28

This is because the current values of ๐‘ฅ2 and ๐‘ฅ3 are 0,

and we need ๐‘ฅ4, ๐‘ฅ5, ๐‘ฅ6 โ‰ฅ 0

Simple: Step 2

373F21 - Nisarg Shah 29

Tightest obstacle

โžข Solve the tightest obstacle for the nonbasic variable

๐‘ฅ1 = 9 โˆ’๐‘ฅ24โˆ’๐‘ฅ32โˆ’๐‘ฅ64

o Substitute the entering variable (called pivot) in other equations

o Now ๐‘ฅ1 becomes basic and ๐‘ฅ6 becomes non-basic

o ๐‘ฅ6 is called the leaving variable

Simplex: Step 2

373F21 - Nisarg Shah 30

โ€ข After one iteration of this step:โžข The basic feasible solution (i.e., substituting 0 for all nonbasic

variables) improves from ๐‘ง = 0 to ๐‘ง = 27

โ€ข Repeat!

Simplex: Step 2

373F21 - Nisarg Shah 31

Simplex: Step 2

373F21 - Nisarg Shah 32

Simplex: Step 2

373F21 - Nisarg Shah 33

โ€ข There is no entering variable (nonbasic variable with positive coefficient) โ€ข What now? Nothing! We are done. โ€ข Take the basic feasible solution (๐‘ฅ3 = ๐‘ฅ5 = ๐‘ฅ6 = 0).โ€ข Gives the optimal value ๐‘ง = 28โ€ข In the optimal solution, ๐‘ฅ1 = 8, ๐‘ฅ2 = 4, ๐‘ฅ3 = 0

Simplex Overview

373F21 - Nisarg Shah 34

Start at a vertex of feasible

polytope

Move to a neighbor vertex

with better objective value

Terminate, declare the current

solution and value as optimal

Is there a neighbor vertex

with better objective value?

Simplex Overview

373F21 - Nisarg Shah 35

Assuming ๐‘ โ‰ฅ0, start with a basic feasible

solution

Move to a neighbor vertex

with better objective value

Terminate, declare the current

solution and value as optimal

Is there a neighbor vertex

with better objective value?

Simplex Overview

373F21 - Nisarg Shah 36

Assuming ๐‘ โ‰ฅ0, start with a basic feasible

solution

Move to a neighbor vertex

with better objective value

Terminate, declare the current

solution and value as optimal

Is there an entering variable

with positive coefficient?

Simplex Overview

373F21 - Nisarg Shah 37

Assuming ๐‘ โ‰ฅ0, start with a basic feasible

solution

Pivot on a leaving variable

Terminate, declare the current

solution and value as optimal

Is there an entering variable

with positive coefficient?

Simplex Overview

373F21 - Nisarg Shah 38

Assuming ๐‘ โ‰ฅ0, start with a basic feasible

solution

Pivot on a leaving variable

Terminate, declare optimal value

Is there an entering variable

with positive coefficient?

Some Outstanding Issues

373F21 - Nisarg Shah 39

โ€ข What if the entering variable has no upper bound?โžข If it doesnโ€™t appear in any constraints, or only appears in constraints

where it can go to โˆž

โžข Then ๐‘ง can also go to โˆž, so declare that LP is unbounded

โ€ข What if pivoting doesnโ€™t change the constant in ๐‘ง?โžข Known as degeneracy, and can lead to infinite loops

โžข Can be prevented by โ€œperturbingโ€ ๐‘ by a small random amount in each coordinate

โžข Or by carefully breaking ties among entering and leaving variables, e.g., by smallest index (known as Blandโ€™s rule)

Some Outstanding Issues

373F21 - Nisarg Shah 40

โ€ข We assumed ๐‘ โ‰ฅ 0, and then started with the vertex ๐‘ฅ = 0

โ€ข What if this assumption does not hold?

๐ฟ๐‘ƒ1

Max ๐‘๐‘‡๐‘ฅ

s.t. ๐‘Ž1๐‘‡๐‘ฅ โ‰ค ๐‘1

๐‘Ž2๐‘‡๐‘ฅ โ‰ค ๐‘2

โ‹ฎ

๐‘Ž๐‘š๐‘‡ ๐‘ฅ โ‰ค ๐‘๐‘š

๐‘ฅ โ‰ฅ 0

๐ฟ๐‘ƒ2

Max ๐‘๐‘‡๐‘ฅ

s.t. ๐‘Ž1๐‘‡๐‘ฅ + ๐‘ 1 = ๐‘1

๐‘Ž2๐‘‡๐‘ฅ + ๐‘ 2 = ๐‘2

โ‹ฎ

๐‘Ž๐‘š๐‘‡ ๐‘ฅ + ๐‘ ๐‘š = ๐‘๐‘š

๐‘ฅ, ๐‘  โ‰ฅ 0

๐ฟ๐‘ƒ3

Max ๐‘๐‘‡๐‘ฅ

s.t. ๐‘Ž1๐‘‡๐‘ฅ + ๐‘ 1 = ๐‘1

โˆ’๐‘Ž2๐‘‡๐‘ฅ โˆ’ ๐‘ 2 = โˆ’๐‘2

โ‹ฎ

โˆ’๐‘Ž๐‘š๐‘‡ ๐‘ฅ โˆ’ ๐‘ ๐‘š = โˆ’๐‘๐‘š

๐‘ฅ, ๐‘  โ‰ฅ 0

Multiply every constraint with negative ๐‘๐‘– by โˆ’ 1 so RHS is now positive

Some Outstanding Issues

373F21 - Nisarg Shah 41

โ€ข We assumed ๐‘ โ‰ฅ 0, and then started with the vertex ๐‘ฅ = 0

โ€ข What if this assumption does not hold?

๐ฟ๐‘ƒ3

Max ๐‘๐‘‡๐‘ฅ

s.t. ๐‘Ž1๐‘‡๐‘ฅ + ๐‘ 1 = ๐‘1

โˆ’๐‘Ž2๐‘‡๐‘ฅ โˆ’ ๐‘ 2 = โˆ’๐‘2

โ‹ฎ

โˆ’๐‘Ž๐‘š๐‘‡ ๐‘ฅ โˆ’ ๐‘ ๐‘š = โˆ’๐‘๐‘š

๐‘ฅ, ๐‘  โ‰ฅ 0 Remember: RHS is now positive

๐ฟ๐‘ƒ4

Min ฯƒ๐‘– ๐‘ง๐‘–

s.t. ๐‘Ž1๐‘‡๐‘ฅ + ๐‘ 1 + ๐‘ง1 = ๐‘1

โˆ’๐‘Ž2๐‘‡๐‘ฅ โˆ’ ๐‘ 2 + ๐‘ง2 = โˆ’๐‘2

โ‹ฎ

โˆ’๐‘Ž๐‘š๐‘‡ ๐‘ฅ โˆ’ ๐‘ ๐‘š + ๐‘ง๐‘š = โˆ’๐‘๐‘š

๐‘ฅ, ๐‘ , ๐‘ง โ‰ฅ 0

Remember: we only want to find a basic feasible solution to ๐ฟ๐‘ƒ1

Some Outstanding Issues

373F21 - Nisarg Shah 42

โ€ข We assumed ๐‘ โ‰ฅ 0, and then started with the vertex ๐‘ฅ = 0

โ€ข What if this assumption does not hold?

Remember: the RHS is now positive

๐ฟ๐‘ƒ4

Min ฯƒ๐‘– ๐‘ง๐‘–

s.t. ๐‘Ž1๐‘‡๐‘ฅ + ๐‘ 1 + ๐‘ง1 = ๐‘1

โˆ’๐‘Ž2๐‘‡๐‘ฅ โˆ’ ๐‘ 2 + ๐‘ง2 = โˆ’๐‘2

โ‹ฎ

โˆ’๐‘Ž๐‘š๐‘‡ ๐‘ฅ โˆ’ ๐‘ ๐‘š + ๐‘ง๐‘š = โˆ’๐‘๐‘š

๐‘ฅ, ๐‘ , ๐‘ง โ‰ฅ 0

What now?โ€ข Solve ๐ฟ๐‘ƒ4 using simplex with

the initial basic solution being ๐‘ฅ = ๐‘  = 0, ๐‘ง = ๐‘

โ€ข If its optimum value is 0, extract a basic feasible solution ๐‘ฅโˆ— from it, use it to solve ๐ฟ๐‘ƒ1 using simplex

โ€ข If optimum value for ๐ฟ๐‘ƒ4 is greater than 0, then ๐ฟ๐‘ƒ1 is infeasible

Some Outstanding Issues

373F21 - Nisarg Shah 43

โ€ข Curious about pseudocode? Proof of correctness? Running time analysis?

โ€ข See textbook for details, but this is NOT in syllabus!

Running Time

373F21 - Nisarg Shah 44

โ€ข Notesโžข #vertices of a polytope can be exponential in the #constraints

o There are examples where simplex takes exponential time if you choose your pivots arbitrarily

o No pivot rule known which guarantees polynomial running time

โžข Other algorithms known which run in polynomial time

o Ellipsoid method, interior point method, โ€ฆ

o Ellipsoid uses ๐‘‚(๐‘š๐‘›3๐ฟ) arithmetic operations

โ€ข ๐ฟ = length of input in binary

o But no known strongly polynomial time algorithm

โ€ข Number of arithmetic operations = poly(m,n)

โ€ข We know how to avoid dependence on length(b), but not for length(A)

Certificate of Optimality

373F21 - Nisarg Shah 45

โ€ข Suppose you design a state-of-the-art LP solver that can solve very large problem instances

โ€ข You want to convince someone that you have this new technology without showing them the codeโžข Idea: They can give you very large LPs and you can quickly return the

optimal solutions

โžข Question: But how would they know that your solutions are optimal, if they donโ€™t have the technology to solve those LPs?

Certificate of Optimality

373F21 - Nisarg Shah 46

โ€ข Suppose I tell you that ๐‘ฅ1, ๐‘ฅ2 = (100,300) is optimal with objective value 1900

โ€ข How can you check this?โžข Note: Can easily substitute (๐‘ฅ1, ๐‘ฅ2), and verify that it is feasible, and

its objective value is indeed 1900

Certificate of Optimality

373F21 - Nisarg Shah 47

โ€ข Any solution that satisfies these inequalities also satisfies their positive combinationsโžข E.g. 2*first_constraint + 5*second_constraint + 3*third_constraint

โžข Try to take combinations which give you ๐‘ฅ1 + 6๐‘ฅ2 on LHS

โ€ข Claim: ๐‘ฅ1, ๐‘ฅ2 = (100,300) is optimal with objective value 1900

Certificate of Optimality

373F21 - Nisarg Shah 48

โ€ข first_constraint + 6*second_constraintโžข ๐‘ฅ1 + 6๐‘ฅ2 โ‰ค 200 + 6 โˆ— 300 = 2000

โžข This shows that no feasible solution can beat 2000

โ€ข Claim: ๐‘ฅ1, ๐‘ฅ2 = (100,300) is optimal with objective value 1900

Certificate of Optimality

373F21 - Nisarg Shah 49

โ€ข 5*second_constraint + third_constraintโžข 5๐‘ฅ2 + ๐‘ฅ1 + ๐‘ฅ2 โ‰ค 5 โˆ— 300 + 400 = 1900

โžข This shows that no feasible solution can beat 1900

o No need to proceed further

o We already know one solution that achieves 1900, so it must be optimal!

โ€ข Claim: ๐‘ฅ1, ๐‘ฅ2 = (100,300) is optimal with objective value 1900

Is There a General Algorithm?

373F21 - Nisarg Shah 50

โ€ข Introduce variables ๐‘ฆ1, ๐‘ฆ2, ๐‘ฆ3 by which we will be multiplying the three constraintsโžข Note: These need not be integers. They can be reals.

โ€ข After multiplying and adding constraints, we get:๐‘ฆ1 + ๐‘ฆ3 ๐‘ฅ1 + ๐‘ฆ2 + ๐‘ฆ3 ๐‘ฅ2 โ‰ค 200๐‘ฆ1 + 300๐‘ฆ2 + 400๐‘ฆ3

Is There a General Algorithm?

373F21 - Nisarg Shah 51

โžข We have: ๐‘ฆ1 + ๐‘ฆ3 ๐‘ฅ1 + ๐‘ฆ2 + ๐‘ฆ3 ๐‘ฅ2 โ‰ค 200๐‘ฆ1 + 300๐‘ฆ2 + 400๐‘ฆ3

โžข What do we want?

o ๐‘ฆ1, ๐‘ฆ2, ๐‘ฆ3 โ‰ฅ 0 because otherwise direction of inequality flips

o LHS to look like objective ๐‘ฅ1 + 6๐‘ฅ2โ€ข In fact, it is sufficient for LHS to be an upper bound on objective

โ€ข So, we want ๐‘ฆ1 + ๐‘ฆ3 โ‰ฅ 1 and ๐‘ฆ2 + ๐‘ฆ3 โ‰ฅ 6

Is There a General Algorithm?

373F21 - Nisarg Shah 52

โžข We have: ๐‘ฆ1 + ๐‘ฆ3 ๐‘ฅ1 + ๐‘ฆ2 + ๐‘ฆ3 ๐‘ฅ2 โ‰ค 200๐‘ฆ1 + 300๐‘ฆ2 + 400๐‘ฆ3

โžข What do we want?

o ๐‘ฆ1, ๐‘ฆ2, ๐‘ฆ3 โ‰ฅ 0

o ๐‘ฆ1 + ๐‘ฆ3 โ‰ฅ 1, ๐‘ฆ2 + ๐‘ฆ3 โ‰ฅ 6

o Subject to these, we want to minimize the upper bound 200๐‘ฆ1 +300๐‘ฆ2 + 400๐‘ฆ3

Is There a General Algorithm?

373F21 - Nisarg Shah 53

โžข We have: ๐‘ฆ1 + ๐‘ฆ3 ๐‘ฅ1 + ๐‘ฆ2 + ๐‘ฆ3 ๐‘ฅ2 โ‰ค 200๐‘ฆ1 + 300๐‘ฆ2 + 400๐‘ฆ3

โžข What do we want?

o This is just another LP!

o Called the dual

o Original LP is called the primal

Is There a General Algorithm?

373F21 - Nisarg Shah 54

โžข The problem of verifying optimality is another LPo For any ๐‘ฆ1, ๐‘ฆ2, ๐‘ฆ3 that you can find, the objective value of the

dual is an upper bound on the objective value of the primal

o If you found a specific ๐‘ฆ1, ๐‘ฆ2, ๐‘ฆ3 for which this dual objective becomes equal to the primal objective for the (๐‘ฅ1, ๐‘ฅ2) given to you, then you would know that the given ๐‘ฅ1, ๐‘ฅ2 is optimal for primal (and your (๐‘ฆ1, ๐‘ฆ2, ๐‘ฆ3) is optimal for dual)

Is There a General Algorithm?

373F21 - Nisarg Shah 55

โžข The problem of verifying optimality is another LPo Issue 1: Butโ€ฆbutโ€ฆif I canโ€™t solve large LPs, how will I solve the dual

to verify if optimality of (๐‘ฅ1, ๐‘ฅ2) given to me?

โ€ข You donโ€™t. Ask the other party to give you both (๐‘ฅ1, ๐‘ฅ2) and the corresponding ๐‘ฆ1, ๐‘ฆ2, ๐‘ฆ3 for proof of optimality

o Issue 2: What if there are no (๐‘ฆ1, ๐‘ฆ2, ๐‘ฆ3) for which dual objective matches primal objective under optimal solution (๐‘ฅ1, ๐‘ฅ2)?

โ€ข As we will see, this canโ€™t happen!

Is There a General Algorithm?

373F21 - Nisarg Shah 56

Primal LP Dual LP

โžข General version, in our standard form for LPs

Is There a General Algorithm?

373F21 - Nisarg Shah 57

Primal LP Dual LP

o ๐‘๐‘‡๐‘ฅ for any feasible ๐‘ฅ โ‰ค ๐‘ฆ๐‘‡๐‘ for any feasible ๐‘ฆ

o maxprimal feasible ๐‘ฅ

๐‘๐‘‡๐‘ฅ โ‰ค mindual feasible ๐‘ฆ

๐‘ฆ๐‘‡๐‘

o If there is (๐‘ฅโˆ—, ๐‘ฆโˆ—) with ๐‘๐‘‡๐‘ฅโˆ— = ๐‘ฆโˆ— ๐‘‡๐‘, then both must be optimal

o In fact, for optimal ๐‘ฅโˆ—, ๐‘ฆโˆ— , we claim that this must happen!

โ€ข Does this remind you of something? Max-flow, min-cutโ€ฆ

Weak Duality

373F21 - Nisarg Shah 58

โ€ข From here on, assume primal LP is feasible and bounded

โ€ข Weak duality theorem:โžข For any primal feasible ๐‘ฅ and dual feasible ๐‘ฆ, ๐‘๐‘‡๐‘ฅ โ‰ค ๐‘ฆ๐‘‡๐‘

โ€ข Proof:๐‘๐‘‡๐‘ฅ โ‰ค ๐‘ฆ๐‘‡๐ด ๐‘ฅ = ๐‘ฆ๐‘‡ ๐ด๐‘ฅ โ‰ค ๐‘ฆ๐‘‡๐‘

Primal LP Dual LP

Strong Duality

373F21 - Nisarg Shah 59

โ€ข Strong duality theorem:โžข For any primal optimal ๐‘ฅโˆ— and dual optimal ๐‘ฆโˆ—, ๐‘๐‘‡๐‘ฅโˆ— = ๐‘ฆโˆ— ๐‘‡๐‘

Primal LP Dual LP

Strong Duality Proof

373F21 - Nisarg Shah 60

โ€ข Farkasโ€™ lemma (one of many, many versions):โžข Exactly one of the following holds:

1) There exists ๐‘ฅ such that ๐ด๐‘ฅ โ‰ค ๐‘

2) There exists ๐‘ฆ such that ๐‘ฆ๐‘‡๐ด = 0, ๐‘ฆ โ‰ฅ 0, ๐‘ฆ๐‘‡๐‘ < 0

โ€ข Geometric intuition:โžข Define image of ๐ด = set of all possible values of ๐ด๐‘ฅ

โžข It is known that this is a โ€œlinear subspaceโ€ (e.g., a line in a plane, a line or plane in 3D, etc)

This slide is not in the scope of the course

Strong Duality Proof

373F21 - Nisarg Shah 61

โ€ข Farkasโ€™ lemma: Exactly one of the following holds:1) There exists ๐‘ฅ such that ๐ด๐‘ฅ โ‰ค ๐‘

2) There exists ๐‘ฆ such that ๐‘ฆ๐‘‡๐ด = 0, ๐‘ฆ โ‰ฅ 0, ๐‘ฆ๐‘‡๐‘ < 0

1) Image of ๐ด contains a point โ€œbelowโ€ ๐‘ 2) The region โ€œbelowโ€ ๐‘ doesnโ€™t intersect image of ๐ดthis is witnessed by normal vector to the image of ๐ด

This slide is not in the scope of the course

Strong Duality

373F21 - Nisarg Shah 62

โ€ข Strong duality theorem:โžข For any primal optimal ๐‘ฅโˆ— and dual optimal ๐‘ฆโˆ—, ๐‘๐‘‡๐‘ฅโˆ— = ๐‘ฆโˆ— ๐‘‡๐‘

โžข Proof (by contradiction):

o Let ๐‘งโˆ— = ๐‘๐‘‡๐‘ฅโˆ— be the optimal primal value.

o Suppose optimal dual objective value > ๐‘งโˆ—

o So, there is no ๐‘ฆ such that ๐‘ฆ๐‘‡๐ด โ‰ฅ ๐‘๐‘‡ and ๐‘ฆ๐‘‡๐‘ โ‰ค ๐‘งโˆ—, i.e.,

Primal LP Dual LP

This slide is not in the scope of the course

Strong Duality

373F21 - Nisarg Shah 63

โžข There is no ๐‘ฆ such that

โžข By Farkasโ€™ lemma, there is ๐‘ฅ and ๐œ† such that

โžข Case 1: ๐œ† > 0o Note: ๐‘๐‘‡๐‘ฅ > ๐œ†๐‘งโˆ— and ๐ด๐‘ฅ = 0 = ๐œ†๐‘.

o Divide both by ๐œ† to get ๐ด๐‘ฅ

๐œ†= ๐‘ and ๐‘๐‘‡

๐‘ฅ

๐œ†> ๐‘งโˆ—

โ€ข Contradicts optimality of ๐‘งโˆ—

โžข Case 2: ๐œ† = 0

o We have ๐ด๐‘ฅ = 0 and ๐‘๐‘‡๐‘ฅ > 0

o Adding ๐‘ฅ to optimal ๐‘ฅโˆ— of primal improves objective value beyond ๐‘งโˆ— โ‡’contradiction

This slide is not in the scope of the course

Exercise: Formulating LPs

373F21 - Nisarg Shah 64

โ€ข A canning company operates twocanning plants (A and B).

โ€ข Three suppliers of fresh fruits:

โ€ข Shipping costs in $/tonne:

โ€ข Plant capacities and labour costs:

โ€ข Selling price: $50/tonne, no limit

โ€ข Objective: Find which plant should get how much supply from each grower to maximize profit

Exercise: Formulating LPs

373F21 - Nisarg Shah 66

โ€ข Similarly to the brewery example from earlier:โžข A brewery can invest its inventory of corn, hops and malt into

producing three types of beer

โžข Per unit resource requirement and profit are as given below

โžข The brewery cannot produce positive amounts of both A and B

โžข Goal: maximize profit

Beverage Corn (kg) Hops (kg) Malt (kg) Profit ($)

A 5 4 35 13

B 15 4 20 23

C 10 7 25 15

Limit 500 300 1000

Exercise: Formulating LPs

373F21 - Nisarg Shah 67

โ€ข Similarly to the brewery example from the beginning:โžข A brewery can invest its inventory of corn, hops and malt into

producing three types of beer

โžข Per unit resource requirement and profit are as given below

โžข The brewery can only produce ๐ถ in integral quantities up to 100

โžข Goal: maximize profit

Beverage Corn (kg) Hops (kg) Malt (kg) Profit ($)

A 5 4 35 13

B 15 4 20 23

C 10 7 25 15

Limit 500 300 1000

Exercise: Formulating LPs

373F21 - Nisarg Shah 68

โ€ข Similarly to the brewery example from the beginning:โžข A brewery can invest its inventory of corn, hops and malt into

producing three types of beer

โžข Per unit resource requirement and profit are as given below

โžข Goal: maximize profit, but if there are multiple profit-maximizing solutions, thenโ€ฆ

o Break ties to choose those with the largest quantity of ๐ด

o Break any further ties to choose those with the largest quantity of ๐ต

Beverage Corn (kg) Hops (kg) Malt (kg) Profit ($)

A 5 4 35 13

B 15 4 20 23

C 10 7 25 15

Limit 500 300 1000

More Tricks

373F21 - Nisarg Shah 69

โ€ข Constraint: ๐‘ฅ โ‰ค 3โžข Replace with constraints ๐‘ฅ โ‰ค 3 and โˆ’๐‘ฅ โ‰ค 3

โžข What if the constraint is ๐‘ฅ โ‰ฅ 3?

โ€ข Objective: minimize 3 ๐‘ฅ + ๐‘ฆโžข Add a variable ๐‘ก

โžข Add the constraints ๐‘ก โ‰ฅ ๐‘ฅ and ๐‘ก โ‰ฅ โˆ’๐‘ฅ (so ๐‘ก โ‰ฅ |๐‘ฅ|)

โžข Change the objective to minimize 3๐‘ก + ๐‘ฆ

โžข What if the objective is to maximize 3 ๐‘ฅ + ๐‘ฆ?

โ€ข Objective: minimize max(3๐‘ฅ + ๐‘ฆ, ๐‘ฅ + 2๐‘ฆ)โžข Hint: minimizing 3 ๐‘ฅ + ๐‘ฆ in the earlier bullet was equivalent to

minimizing max(3๐‘ฅ + ๐‘ฆ,โˆ’3๐‘ฅ + ๐‘ฆ)

โ€ข โ€ฆ

373F21 - Nisarg Shah 70